Jörg Höhle : winmm: Have MCI drivers handle notification for MCI_OPEN.

Alexandre Julliard julliard at winehq.org
Thu May 20 11:03:01 CDT 2010


Module: wine
Branch: master
Commit: 594a70f55024c1c98cf842f21a4aaea8a6017cda
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=594a70f55024c1c98cf842f21a4aaea8a6017cda

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Wed May 19 05:42:18 2010 +0200

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 a3bce9d..731083e 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 5c99534..9f62594 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 75f2c01..a42529b 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 87753c3..ec9a24a 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 8a66ab4..f65aee7 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 b064c0c..66633bc 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;




More information about the wine-cvs mailing list