winmm: Have MCI drivers handle notification for MCI_OPEN.

All notifications are handled locally by the drivers.
This commit is contained in:
Jörg Höhle 2010-05-19 05:42:18 +02:00 committed by Alexandre Julliard
parent efe1c945f2
commit 594a70f550
6 changed files with 24 additions and 11 deletions

View File

@ -286,6 +286,11 @@ static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
} }
LeaveCriticalSection(&wma->cs); LeaveCriticalSection(&wma->cs);
if (!dwRet && (dwFlags & MCI_NOTIFY)) {
mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)),
wDevID, MCI_NOTIFY_SUCCESSFUL);
}
return dwRet; return dwRet;
} }

View File

@ -464,8 +464,15 @@ static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenPar
/* now, open the handle */ /* now, open the handle */
root[0] = root[1] = '\\'; root[2] = '.'; root[3] = '\\'; root[4] = drive; root[5] = ':'; root[6] = '\0'; 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); wmcda->handle = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (wmcda->handle != INVALID_HANDLE_VALUE) if (wmcda->handle == INVALID_HANDLE_VALUE)
return 0; 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: the_error:
--wmcda->nUseCount; --wmcda->nUseCount;

View File

@ -221,6 +221,9 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
wma->opened = TRUE; wma->opened = TRUE;
if (dwFlags & MCI_NOTIFY)
mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);
return 0; return 0;
err: err:

View File

@ -799,6 +799,11 @@ static DWORD MIDI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpParms)
} else { } else {
wmm->dwPositionMS = 0; wmm->dwPositionMS = 0;
wmm->dwStatus = MCI_MODE_STOP; 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; return dwRet;
} }

View File

@ -1660,16 +1660,10 @@ static DWORD MCI_Open(DWORD dwParam, LPMCI_OPEN_PARMSW lpParms)
/* only handled devices fall through */ /* only handled devices fall through */
TRACE("wDevID=%04X wDeviceID=%d dwRet=%d\n", wmd->wDeviceID, lpParms->wDeviceID, dwRet); 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; return 0;
errCleanUp: errCleanUp:
if (wmd) MCI_UnLoadMciDriver(wmd); if (wmd) MCI_UnLoadMciDriver(wmd);
if (dwParam & MCI_NOTIFY)
mciDriverNotify((HWND)lpParms->dwCallback, 0, MCI_NOTIFY_FAILURE);
return dwRet; return dwRet;
} }

View File

@ -359,9 +359,8 @@ static void test_recordWAVE(HWND hwnd)
err = mciGetDeviceID("waveaudio"); err = mciGetDeviceID("waveaudio");
todo_wine ok(err==0,"mciGetDeviceID waveaudio returned %u, expected 0\n", err); 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); 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! */ /* Do not query time format as string because result depends on locale! */
parm.status.dwItem = MCI_STATUS_TIME_FORMAT; parm.status.dwItem = MCI_STATUS_TIME_FORMAT;