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);
if (!dwRet && (dwFlags & MCI_NOTIFY)) {
mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)),
wDevID, MCI_NOTIFY_SUCCESSFUL);
}
return dwRet;
}

View File

@ -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;

View File

@ -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:

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;