From 0cd1affc9a613138ba75bc3ee2eac356130f9237 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Tue, 26 Apr 2022 07:27:59 +0100 Subject: [PATCH] wineoss: Move MIDM_GETDEVCAPS to the unixlib. Signed-off-by: Huw Davies Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/wineoss.drv/midi.c | 17 ----------------- dlls/wineoss.drv/ossmidi.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index ab68d7c8d25..2a1619cced3 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -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: diff --git a/dlls/wineoss.drv/ossmidi.c b/dlls/wineoss.drv/ossmidi.c index 6b8de674b7b..6ac75284812 100644 --- a/dlls/wineoss.drv/ossmidi.c +++ b/dlls/wineoss.drv/ossmidi.c @@ -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;