wineoss: Move MIDM_GETDEVCAPS to the unixlib.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2022-04-26 07:27:59 +01:00 committed by Alexandre Julliard
parent 3d0e1a4fe9
commit 0cd1affc9a
2 changed files with 15 additions and 17 deletions

View File

@ -378,21 +378,6 @@ static DWORD WINAPI midRecThread(void *arg)
return 0;
}
/**************************************************************************
* midGetDevCaps [internal]
*/
static DWORD midGetDevCaps(WORD wDevID, LPMIDIINCAPSW lpCaps, DWORD dwSize)
{
TRACE("(%04X, %p, %08X);\n", wDevID, lpCaps, dwSize);
if (wDevID >= MIDM_NumDevs) return MMSYSERR_BADDEVICEID;
if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
memcpy(lpCaps, &MidiInDev[wDevID].caps, min(dwSize, sizeof(*lpCaps)));
return MMSYSERR_NOERROR;
}
/**************************************************************************
* midOpen [internal]
*/
@ -620,8 +605,6 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser,
return midClose(wDevID);
case MIDM_ADDBUFFER:
return midAddBuffer(wDevID, (LPMIDIHDR)dwParam1, dwParam2);
case MIDM_GETDEVCAPS:
return midGetDevCaps(wDevID, (LPMIDIINCAPSW)dwParam1,dwParam2);
case MIDM_GETNUMDEVS:
return MIDM_NumDevs;
case MIDM_RESET:

View File

@ -1131,6 +1131,18 @@ static UINT midi_in_unprepare(WORD dev_id, MIDIHDR *hdr, UINT hdr_size)
return MMSYSERR_NOERROR;
}
static UINT midi_in_get_devcaps(WORD dev_id, MIDIINCAPSW *caps, UINT size)
{
TRACE("(%04X, %p, %08X);\n", dev_id, caps, size);
if (dev_id >= num_srcs) return MMSYSERR_BADDEVICEID;
if (!caps) return MMSYSERR_INVALPARAM;
memcpy(caps, &srcs[dev_id].caps, min(size, sizeof(*caps)));
return MMSYSERR_NOERROR;
}
NTSTATUS midi_out_message(void *args)
{
struct midi_out_message_params *params = args;
@ -1202,6 +1214,9 @@ NTSTATUS midi_in_message(void *args)
case MIDM_UNPREPARE:
*params->err = midi_in_unprepare(params->dev_id, (MIDIHDR *)params->param_1, params->param_2);
break;
case MIDM_GETDEVCAPS:
*params->err = midi_in_get_devcaps(params->dev_id, (MIDIINCAPSW *)params->param_1, params->param_2);
break;
default:
TRACE("Unsupported message\n");
*params->err = MMSYSERR_NOTSUPPORTED;