From 3ae829d11b38d70244d8e0601e5b32a9313a44ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Wed, 15 Dec 2010 22:47:45 +0100 Subject: [PATCH] mciseq: Refactor use of mciGetDriverData. --- dlls/mciseq/mcimidi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c index e35abc5f20d..e7671d6ac11 100644 --- a/dlls/mciseq/mcimidi.c +++ b/dlls/mciseq/mcimidi.c @@ -196,11 +196,11 @@ static DWORD MIDI_drvClose(DWORD dwDevID) /************************************************************************** * MIDI_mciGetOpenDev [internal] */ -static WINE_MCIMIDI* MIDI_mciGetOpenDev(UINT wDevID) +static WINE_MCIMIDI* MIDI_mciGetOpenDev(MCIDEVICEID wDevID, UINT wMsg) { WINE_MCIMIDI* wmm = (WINE_MCIMIDI*)mciGetDriverData(wDevID); - if (wmm == NULL || wmm->nUseCount == 0) { + if (wmm == NULL || ((wmm->nUseCount == 0) ^ (wMsg == MCI_OPEN_DRIVER))) { WARN("Invalid wDevID=%u\n", wDevID); return 0; } @@ -1600,8 +1600,7 @@ LRESULT CALLBACK MCIMIDI_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - wmm = (wMsg == MCI_OPEN_DRIVER) ? - (WINE_MCIMIDI*)mciGetDriverData(dwDevID) : MIDI_mciGetOpenDev(dwDevID); + wmm = MIDI_mciGetOpenDev(dwDevID, wMsg); if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID; switch (wMsg) {