Jörg Höhle : winmm: Support MCI "close all" command.
Alexandre Julliard
julliard at winehq.org
Thu Apr 1 11:25:04 CDT 2010
Module: wine
Branch: master
Commit: e89468734d09334f830cf98c255d68ccf2d6293f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e89468734d09334f830cf98c255d68ccf2d6293f
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Wed Mar 31 16:08:48 2010 +0200
winmm: Support MCI "close all" command.
This is not yet generalized to "pause all" or "stop all".
---
dlls/winmm/mci.c | 12 +++++++++---
dlls/winmm/tests/mci.c | 6 +++---
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index 0a15f09..54e9e19 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -1224,6 +1224,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
{
LPWSTR verb, dev, args;
LPWINE_MCIDRIVER wmd = 0;
+ MCIDEVICEID uDevID;
DWORD dwFlags = 0, dwRet = 0;
int offset = 0;
DWORD_PTR data[MCI_DATA_SIZE];
@@ -1252,6 +1253,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
if ((dwRet = MCI_GetString(&dev, &args))) {
goto errCleanUp;
}
+ uDevID = strcmpiW(dev, wszAll) ? 0 : MCI_ALL_DEVICE_ID;
/* Determine devType from open */
if (!strcmpW(verb, wszOpen)) {
@@ -1307,6 +1309,10 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
dwFlags |= MCI_OPEN_ELEMENT;
data[3] = (DWORD_PTR)dev;
}
+ if (MCI_ALL_DEVICE_ID == uDevID) {
+ dwRet = MCIERR_CANNOT_USE_ALL;
+ goto errCleanUp;
+ }
if (!strstrW(args, wszSAliasS) && !dev) {
dwRet = MCIERR_NEW_REQUIRES_ALIAS;
goto errCleanUp;
@@ -1320,7 +1326,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
MCI_UnLoadMciDriver(wmd);
goto errCleanUp;
}
- } else if (!(wmd = MCI_GetDriver(mciGetDeviceIDW(dev)))) {
+ } else if ((MCI_ALL_DEVICE_ID != uDevID) && !(wmd = MCI_GetDriver(mciGetDeviceIDW(dev)))) {
/* auto open */
static const WCHAR wszOpenWait[] = {'o','p','e','n',' ','%','s',' ','w','a','i','t',0};
WCHAR buf[128];
@@ -1384,7 +1390,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
if (lpstrRet && uRetLen) *lpstrRet = '\0';
TRACE("[%d, %s, %08x, %08lx/%s %08lx/%s %08lx/%s %08lx/%s %08lx/%s %08lx/%s]\n",
- wmd->wDeviceID, MCI_MessageToString(MCI_GetMessage(lpCmd)), dwFlags,
+ wmd ? wmd->wDeviceID : uDevID, MCI_MessageToString(MCI_GetMessage(lpCmd)), dwFlags,
data[0], debugstr_w((WCHAR *)data[0]), data[1], debugstr_w((WCHAR *)data[1]),
data[2], debugstr_w((WCHAR *)data[2]), data[3], debugstr_w((WCHAR *)data[3]),
data[4], debugstr_w((WCHAR *)data[4]), data[5], debugstr_w((WCHAR *)data[5]));
@@ -1394,7 +1400,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet,
MCI_UnLoadMciDriver(wmd);
/* FIXME: notification is not properly shared across two opens */
} else {
- dwRet = MCI_SendCommand(wmd->wDeviceID, MCI_GetMessage(lpCmd), dwFlags, (DWORD_PTR)data);
+ dwRet = MCI_SendCommand(wmd ? wmd->wDeviceID : uDevID, MCI_GetMessage(lpCmd), dwFlags, (DWORD_PTR)data);
}
TRACE("=> 1/ %x (%s)\n", dwRet, debugstr_w(lpstrRet));
dwRet = MCI_HandleReturnValues(dwRet, wmd, retType, data, lpstrRet, uRetLen);
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index 0e7ce9d..6bdfefe 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -217,11 +217,11 @@ static void test_openCloseWAVE(HWND hwnd)
}
err = mciSendString(command_close_all, NULL, 0, NULL);
- todo_wine ok(!err,"mci %s (without buffer) returned %s\n", command_close_all, dbg_mcierr(err));
+ ok(!err,"mci %s (without buffer) returned %s\n", command_close_all, dbg_mcierr(err));
memset(buf, 0, sizeof(buf));
err = mciSendString(command_close_all, buf, sizeof(buf), hwnd);
- todo_wine ok(!err,"mci %s (with output buffer) returned %s\n", command_close_all, dbg_mcierr(err));
+ ok(!err,"mci %s (with output buffer) returned %s\n", command_close_all, dbg_mcierr(err));
ok(buf[0] == 0, "mci %s changed output buffer: %s\n", command_close_all, buf);
/* No notification left, everything closed already */
test_notification(hwnd, command_close_all, 0);
@@ -864,7 +864,7 @@ START_TEST(mci)
test_AutoOpenWAVE(hwnd);
/* Win9X hangs when exiting with something still open. */
err = mciSendString("close all", NULL, 0, hwnd);
- todo_wine ok(!err,"final close all returned %s\n", dbg_mcierr(err));
+ ok(!err,"final close all returned %s\n", dbg_mcierr(err));
ok(DeleteFile("tempfile.wav")||ok_saved,"Delete tempfile.wav (cause auto-open?)\n");
DestroyWindow(hwnd);
}
More information about the wine-cvs
mailing list