mciqtz32: Stop the device only after param and device checks are done.

This commit is contained in:
Christian Costa 2009-04-23 00:04:04 +02:00 committed by Alexandre Julliard
parent 7b1b498a31
commit fd80a7b7c4
1 changed files with 15 additions and 16 deletions

View File

@ -99,12 +99,12 @@ static DWORD MCIQTZ_drvClose(DWORD dwDevID)
TRACE("(%04x)\n", dwDevID); TRACE("(%04x)\n", dwDevID);
/* finish all outstanding things */
MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
wma = MCIQTZ_mciGetOpenDev(dwDevID); wma = MCIQTZ_mciGetOpenDev(dwDevID);
if (wma) { if (wma) {
/* finish all outstanding things */
MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
HeapFree(GetProcessHeap(), 0, wma); HeapFree(GetProcessHeap(), 0, wma);
return 1; return 1;
} }
@ -121,16 +121,15 @@ static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
TRACE("(%04x)\n", dwDevID); TRACE("(%04x)\n", dwDevID);
wma = MCIQTZ_mciGetOpenDev(dwDevID);
if (!wma)
return 0;
MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL); MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
wma = MCIQTZ_mciGetOpenDev(dwDevID); MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
if (wma) { return 1;
MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
return 1;
}
return 0;
} }
/*************************************************************************** /***************************************************************************
@ -144,8 +143,6 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms); TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (!lpOpenParms) if (!lpOpenParms)
return MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
@ -153,6 +150,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
if (!wma) if (!wma)
return MCIERR_INVALID_DEVICE_ID; return MCIERR_INVALID_DEVICE_ID;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph); hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
@ -211,12 +210,12 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
wma = MCIQTZ_mciGetOpenDev(wDevID); wma = MCIQTZ_mciGetOpenDev(wDevID);
if (!wma) if (!wma)
return MCIERR_INVALID_DEVICE_ID; return MCIERR_INVALID_DEVICE_ID;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (wma->opened) { if (wma->opened) {
IGraphBuilder_Release(wma->pgraph); IGraphBuilder_Release(wma->pgraph);
IMediaControl_Release(wma->pmctrl); IMediaControl_Release(wma->pmctrl);
@ -267,8 +266,6 @@ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (!lpParms) if (!lpParms)
return MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
@ -276,6 +273,8 @@ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if (!wma) if (!wma)
return MCIERR_INVALID_DEVICE_ID; return MCIERR_INVALID_DEVICE_ID;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (dwFlags & MCI_SEEK_TO_START) { if (dwFlags & MCI_SEEK_TO_START) {
newpos = 0; newpos = 0;
} else if (dwFlags & MCI_SEEK_TO_END) { } else if (dwFlags & MCI_SEEK_TO_END) {