From e36db94c7cf8b8d56adda70ef1c753c5231e7974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Sun, 25 Oct 2009 20:18:41 +0100 Subject: [PATCH] winmm: Don't stop parsing after MCI's alias keyword. --- dlls/winmm/mci.c | 15 +-------------- dlls/winmm/tests/mci.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index c46c4c5b554..49e859859bd 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -1232,7 +1232,6 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet, DWORD data[MCI_DATA_SIZE]; DWORD retType; LPCWSTR lpCmd = 0; - LPWSTR devAlias = NULL; static const WCHAR wszNew[] = {'n','e','w',0}; static const WCHAR wszSAliasS[] = {' ','a','l','i','a','s',' ',0}; static const WCHAR wszTypeS[] = {'t','y','p','e',' ',0}; @@ -1311,19 +1310,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpstrCommand, LPWSTR lpstrRet, dwFlags |= MCI_OPEN_ELEMENT; data[3] = (DWORD)dev; } - if ((devAlias = strstrW(args, wszSAliasS))) { - WCHAR* tmp2; - devAlias += 7; - if (!(tmp = strchrW(devAlias,' '))) tmp = devAlias + strlenW(devAlias); - if (tmp) *tmp = '\0'; - tmp2 = HeapAlloc(GetProcessHeap(), 0, (tmp - devAlias + 1) * sizeof(WCHAR) ); - memcpy( tmp2, devAlias, (tmp - devAlias) * sizeof(WCHAR) ); - tmp2[tmp - devAlias] = 0; - data[4] = (DWORD)tmp2; - /* should be done in regular options parsing */ - /* dwFlags |= MCI_OPEN_ALIAS; */ - } else if (dev == 0) { - /* "open new" requires alias */ + if (!strstrW(args, wszSAliasS) && !dev) { dwRet = MCIERR_NEW_REQUIRES_ALIAS; goto errCleanUp; } diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c index c72c81d593f..6607e17c99f 100644 --- a/dlls/winmm/tests/mci.c +++ b/dlls/winmm/tests/mci.c @@ -168,7 +168,7 @@ static void test_openCloseWAVE(HWND hwnd) { MCIERROR err; MCI_GENERIC_PARMS parm; - const char command_open[] = "open new type waveaudio alias mysound"; + const char command_open[] = "open new type waveaudio alias mysound notify"; const char command_close_my[] = "close mysound notify"; const char command_close_all[] = "close all notify"; const char command_sysinfo[] = "sysinfo waveaudio quantity open"; @@ -180,9 +180,18 @@ static void test_openCloseWAVE(HWND hwnd) todo_wine ok(!err,"mci %s returned %s\n", command_open, dbg_mcierr(err)); if(!err) trace("[MCI] with %s drivers\n", buf); - err = mciSendString(command_open, buf, sizeof(buf), NULL); + err = mciSendString("open new type waveaudio alias r shareable", buf, sizeof(buf), NULL); + ok(err==MCIERR_UNSUPPORTED_FUNCTION,"mci open new shareable returned %s\n", dbg_mcierr(err)); + if(!err) { + err = mciSendString("close r", NULL, 0, NULL); + ok(!err,"mci close shareable returned %s\n", dbg_mcierr(err)); + } + + err = mciSendString(command_open, buf, sizeof(buf), hwnd); ok(!err,"mci %s returned %s\n", command_open, dbg_mcierr(err)); ok(!strcmp(buf,"1"), "mci open deviceId: %s, expected 1\n", buf); + /* Wine<=1.1.33 used to ignore anything past alias XY */ + test_notification(hwnd,"open new alias notify",MCI_NOTIFY_SUCCESSFUL); err = mciSendString("status mysound time format", buf, sizeof(buf), hwnd); ok(!err,"mci status time format returned %s\n", dbg_mcierr(err)); @@ -514,7 +523,7 @@ static void test_asyncWAVE(HWND hwnd) char buf[1024]; memset(buf, 0, sizeof(buf)); - err = mciSendString("open tempfile.wav alias mysound", buf, sizeof(buf), NULL); + err = mciSendString("open tempfile.wav alias mysound notify", buf, sizeof(buf), hwnd); ok(err==ok_saved,"mci open tempfile.wav returned %s\n", dbg_mcierr(err)); if(err) { skip("Cannot open tempfile.wav for playing (%s), skipping\n", dbg_mcierr(err)); @@ -523,6 +532,7 @@ static void test_asyncWAVE(HWND hwnd) ok(!strcmp(buf,"1"), "mci open deviceId: %s, expected 1\n", buf); wDeviceID = atoi(buf); ok(wDeviceID,"mci open DeviceID: %d\n", wDeviceID); + test_notification(hwnd,"open alias notify",MCI_NOTIFY_SUCCESSFUL); err = mciSendString("status mysound mode", buf, sizeof(buf), hwnd); ok(!err,"mci status mode returned %s\n", dbg_mcierr(err));