From 594a70f55024c1c98cf842f21a4aaea8a6017cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Wed, 19 May 2010 05:42:18 +0200 Subject: [PATCH] winmm: Have MCI drivers handle notification for MCI_OPEN. All notifications are handled locally by the drivers. --- dlls/mciavi32/mciavi.c | 5 +++++ dlls/mcicda/mcicda.c | 11 +++++++++-- dlls/mciqtz32/mciqtz.c | 3 +++ dlls/mciseq/mcimidi.c | 5 +++++ dlls/winmm/mci.c | 8 +------- dlls/winmm/tests/mci.c | 3 +-- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/dlls/mciavi32/mciavi.c b/dlls/mciavi32/mciavi.c index a3bce9d761..731083eea1 100644 --- a/dlls/mciavi32/mciavi.c +++ b/dlls/mciavi32/mciavi.c @@ -286,6 +286,11 @@ static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags, } LeaveCriticalSection(&wma->cs); + + if (!dwRet && (dwFlags & MCI_NOTIFY)) { + mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), + wDevID, MCI_NOTIFY_SUCCESSFUL); + } return dwRet; } diff --git a/dlls/mcicda/mcicda.c b/dlls/mcicda/mcicda.c index 5c995344c3..9f62594ed2 100644 --- a/dlls/mcicda/mcicda.c +++ b/dlls/mcicda/mcicda.c @@ -464,8 +464,15 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenPar /* now, open the handle */ root[0] = root[1] = '\\'; root[2] = '.'; root[3] = '\\'; root[4] = drive; root[5] = ':'; root[6] = '\0'; wmcda->handle = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); - if (wmcda->handle != INVALID_HANDLE_VALUE) - return 0; + if (wmcda->handle == INVALID_HANDLE_VALUE) + goto the_error; + + if (dwFlags & MCI_NOTIFY) { + TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpOpenParms->dwCallback); + mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), + wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); + } + return 0; the_error: --wmcda->nUseCount; diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c index 75f2c0131c..a42529bb1f 100644 --- a/dlls/mciqtz32/mciqtz.c +++ b/dlls/mciqtz32/mciqtz.c @@ -221,6 +221,9 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags, wma->opened = TRUE; + if (dwFlags & MCI_NOTIFY) + mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL); + return 0; err: diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c index 87753c33dd..ec9a24ae4f 100644 --- a/dlls/mciseq/mcimidi.c +++ b/dlls/mciseq/mcimidi.c @@ -799,6 +799,11 @@ static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpParms) } else { wmm->dwPositionMS = 0; wmm->dwStatus = MCI_MODE_STOP; + if (dwFlags & MCI_NOTIFY) { + TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); + mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)), + wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); + } } return dwRet; } diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 8a66ab4390..f65aee7549 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -1660,16 +1660,10 @@ static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms) /* only handled devices fall through */ TRACE("wDevID=%04X wDeviceID=%d dwRet=%d\n", wmd->wDeviceID, lpParms->wDeviceID, dwRet); - - if (dwParam & MCI_NOTIFY) - mciDriverNotify((HWND)lpParms->dwCallback, wmd->wDeviceID, MCI_NOTIFY_SUCCESSFUL); - return 0; + errCleanUp: if (wmd) MCI_UnLoadMciDriver(wmd); - - if (dwParam & MCI_NOTIFY) - mciDriverNotify((HWND)lpParms->dwCallback, 0, MCI_NOTIFY_FAILURE); return dwRet; } diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c index b064c0c79d..66633bc070 100644 --- a/dlls/winmm/tests/mci.c +++ b/dlls/winmm/tests/mci.c @@ -359,9 +359,8 @@ static void test_recordWAVE(HWND hwnd) err = mciGetDeviceID("waveaudio"); todo_wine ok(err==0,"mciGetDeviceID waveaudio returned %u, expected 0\n", err); - /* In Wine, both MCI_Open and the individual drivers send notifications. */ test_notification(hwnd, "open new", MCI_NOTIFY_SUCCESSFUL); - todo_wine test_notification(hwnd, "open new no #2", 0); + test_notification(hwnd, "open new no #2", 0); /* Do not query time format as string because result depends on locale! */ parm.status.dwItem = MCI_STATUS_TIME_FORMAT;