Commit ef372e25 authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

winmm: MCI open always creates an alias for subsequent commands.

parent dd1a4709
...@@ -123,7 +123,7 @@ static UINT MCI_GetDriverFromString(LPCWSTR lpstrName) ...@@ -123,7 +123,7 @@ static UINT MCI_GetDriverFromString(LPCWSTR lpstrName)
EnterCriticalSection(&WINMM_cs); EnterCriticalSection(&WINMM_cs);
for (wmd = MciDrivers; wmd; wmd = wmd->lpNext) { for (wmd = MciDrivers; wmd; wmd = wmd->lpNext) {
if (wmd->lpstrElementName && strcmpW(wmd->lpstrElementName, lpstrName) == 0) { if (wmd->lpstrAlias && strcmpiW(wmd->lpstrAlias, lpstrName) == 0) {
ret = wmd->wDeviceID; ret = wmd->wDeviceID;
break; break;
} }
...@@ -131,10 +131,6 @@ static UINT MCI_GetDriverFromString(LPCWSTR lpstrName) ...@@ -131,10 +131,6 @@ static UINT MCI_GetDriverFromString(LPCWSTR lpstrName)
ret = wmd->wDeviceID; ret = wmd->wDeviceID;
break; break;
} }
if (wmd->lpstrAlias && strcmpiW(wmd->lpstrAlias, lpstrName) == 0) {
ret = wmd->wDeviceID;
break;
}
} }
LeaveCriticalSection(&WINMM_cs); LeaveCriticalSection(&WINMM_cs);
...@@ -770,7 +766,6 @@ static BOOL MCI_UnLoadMciDriver(LPWINE_MCIDRIVER wmd) ...@@ -770,7 +766,6 @@ static BOOL MCI_UnLoadMciDriver(LPWINE_MCIDRIVER wmd)
HeapFree(GetProcessHeap(), 0, wmd->lpstrDeviceType); HeapFree(GetProcessHeap(), 0, wmd->lpstrDeviceType);
HeapFree(GetProcessHeap(), 0, wmd->lpstrAlias); HeapFree(GetProcessHeap(), 0, wmd->lpstrAlias);
HeapFree(GetProcessHeap(), 0, wmd->lpstrElementName);
HeapFree(GetProcessHeap(), 0, wmd); HeapFree(GetProcessHeap(), 0, wmd);
return TRUE; return TRUE;
...@@ -888,15 +883,23 @@ static DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dw ...@@ -888,15 +883,23 @@ static DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dw
static DWORD MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSW lpParms, static DWORD MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSW lpParms,
DWORD dwParam) DWORD dwParam)
{ {
if (dwParam & MCI_OPEN_ELEMENT) LPCWSTR alias = NULL;
{ /* Open always defines an alias for further reference */
wmd->lpstrElementName = HeapAlloc(GetProcessHeap(),0,(strlenW(lpParms->lpstrElementName)+1) * sizeof(WCHAR)); if (dwParam & MCI_OPEN_ALIAS) /* open ... alias */
strcpyW( wmd->lpstrElementName, lpParms->lpstrElementName ); alias = lpParms->lpstrAlias;
} else {
if (dwParam & MCI_OPEN_ALIAS) if ((dwParam & MCI_OPEN_ELEMENT) /* open file.wav */
{ && !(dwParam & MCI_OPEN_ELEMENT_ID))
wmd->lpstrAlias = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpParms->lpstrAlias)+1) * sizeof(WCHAR)); alias = lpParms->lpstrElementName;
strcpyW( wmd->lpstrAlias, lpParms->lpstrAlias); else if (dwParam & MCI_OPEN_TYPE ) /* open cdaudio */
alias = wmd->lpstrDeviceType;
}
if (alias) {
wmd->lpstrAlias = HeapAlloc(GetProcessHeap(), 0, (strlenW(alias)+1) * sizeof(WCHAR));
if (!wmd->lpstrAlias) return MCIERR_OUT_OF_MEMORY;
strcpyW( wmd->lpstrAlias, alias);
/* In most cases, natives adds MCI_OPEN_ALIAS to the flags passed to the driver.
* Don't. The drivers don't care about the winmm alias. */
} }
lpParms->wDeviceID = wmd->wDeviceID; lpParms->wDeviceID = wmd->wDeviceID;
......
...@@ -644,7 +644,7 @@ static void test_asyncWAVE(HWND hwnd) ...@@ -644,7 +644,7 @@ static void test_asyncWAVE(HWND hwnd)
/* Only the alias is looked up. */ /* Only the alias is looked up. */
err = mciGetDeviceID("tempfile.wav"); err = mciGetDeviceID("tempfile.wav");
todo_wine ok(err==0,"mciGetDeviceID element returned %u, expected 0\n", err); ok(err==0,"mciGetDeviceID element returned %u, expected 0\n", err);
err = mciGetDeviceID("waveaudio"); err = mciGetDeviceID("waveaudio");
todo_wine ok(err==0,"mciGetDeviceID waveaudio returned %u, expected 0\n", err); todo_wine ok(err==0,"mciGetDeviceID waveaudio returned %u, expected 0\n", err);
......
...@@ -95,7 +95,6 @@ typedef struct { ...@@ -95,7 +95,6 @@ typedef struct {
typedef struct tagWINE_MCIDRIVER { typedef struct tagWINE_MCIDRIVER {
UINT wDeviceID; UINT wDeviceID;
UINT wType; UINT wType;
LPWSTR lpstrElementName;
LPWSTR lpstrDeviceType; LPWSTR lpstrDeviceType;
LPWSTR lpstrAlias; LPWSTR lpstrAlias;
HDRVR hDriver; HDRVR hDriver;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment