From fd80a7b7c44e91fd365e0204bd83ce0d46d2ff67 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Thu, 23 Apr 2009 00:04:04 +0200 Subject: [PATCH] mciqtz32: Stop the device only after param and device checks are done. --- dlls/mciqtz32/mciqtz.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c index 07b774c5c90..0435a11f07c 100644 --- a/dlls/mciqtz32/mciqtz.c +++ b/dlls/mciqtz32/mciqtz.c @@ -99,12 +99,12 @@ static DWORD MCIQTZ_drvClose(DWORD dwDevID) TRACE("(%04x)\n", dwDevID); - /* finish all outstanding things */ - MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL); - wma = MCIQTZ_mciGetOpenDev(dwDevID); if (wma) { + /* finish all outstanding things */ + MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL); + HeapFree(GetProcessHeap(), 0, wma); return 1; } @@ -121,16 +121,15 @@ static DWORD MCIQTZ_drvConfigure(DWORD dwDevID) TRACE("(%04x)\n", dwDevID); + wma = MCIQTZ_mciGetOpenDev(dwDevID); + if (!wma) + return 0; + MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL); - wma = MCIQTZ_mciGetOpenDev(dwDevID); + MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK); - if (wma) { - MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK); - return 1; - } - - return 0; + return 1; } /*************************************************************************** @@ -144,8 +143,6 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags, TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms); - MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); - if (!lpOpenParms) return MCIERR_NULL_PARAMETER_BLOCK; @@ -153,6 +150,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags, if (!wma) return MCIERR_INVALID_DEVICE_ID; + MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); + CoInitializeEx(NULL, COINIT_MULTITHREADED); 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); - MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); - wma = MCIQTZ_mciGetOpenDev(wDevID); if (!wma) return MCIERR_INVALID_DEVICE_ID; + MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); + if (wma->opened) { IGraphBuilder_Release(wma->pgraph); 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); - MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); - if (!lpParms) return MCIERR_NULL_PARAMETER_BLOCK; @@ -276,6 +273,8 @@ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms if (!wma) return MCIERR_INVALID_DEVICE_ID; + MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL); + if (dwFlags & MCI_SEEK_TO_START) { newpos = 0; } else if (dwFlags & MCI_SEEK_TO_END) {