diff --git a/dlls/winmm/tests/Makefile.in b/dlls/winmm/tests/Makefile.in index 22a61af..2e353f8 100644 --- a/dlls/winmm/tests/Makefile.in +++ b/dlls/winmm/tests/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = winmm.dll -IMPORTS = winmm user32 kernel32 +IMPORTS = winmm user32 advapi32 kernel32 C_SRCS = \ capture.c \ diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c index 7ce402d..8b4f5b5 100644 --- a/dlls/winmm/tests/midi.c +++ b/dlls/winmm/tests/midi.c @@ -21,6 +21,7 @@ #include #include #include "windows.h" +#include "winreg.h" #include "mmsystem.h" #include "wine/test.h" @@ -199,6 +200,38 @@ static void test_midi_mci(HWND hwnd) if (!err) trace("Found %s MCI sequencer devices\n", buf); } +static BOOL skip_device(UINT udev) +{ + MMRESULT rc; + MIDIOUTCAPSA capsA; + HKEY hkey; + LONG ret; + + rc = midiOutGetDevCapsA(udev, &capsA, sizeof(capsA)); + + /* Skip the tests if the user told us to only use the default device */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\MultiMedia\\Sound Mapper", &hkey); + if (ret == ERROR_SUCCESS) { + DWORD pref = 0, size = sizeof(DWORD); + RegQueryValueExA(hkey, "PreferredOnly", NULL, NULL, (LPBYTE)&pref, &size); + RegCloseKey(hkey); + if (pref == 1) { + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Multimedia\\MIDIMap", &hkey); + if (ret == ERROR_SUCCESS) { + char name[MAX_PATH]; + name[0] = 0; + size = MAX_PATH; + RegQueryValueExA(hkey, "szPname", NULL, NULL, (LPBYTE)name, &size); + RegCloseKey(hkey); + if (lstrcmpA(name, capsA.szPname)) { + win_skip("'%s' is not the preferred device\n", capsA.szPname); + return TRUE; + } + } + } + } + return FALSE; +} static void test_midiOut_device(UINT udev, HWND hwnd) { @@ -215,6 +248,10 @@ static void test_midiOut_device(UINT udev, HWND hwnd) capsA.szPname, capsA.wMid, capsA.wPid, capsA.wTechnology, capsA.dwSupport, capsA.wVoices, capsA.wNotes); } + if (udev != MIDIMAPPER && skip_device(udev)) { + return; + } + if (hwnd) rc = midiOutOpen(&hm, udev, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW); else @@ -354,6 +391,10 @@ static void test_midiStream(UINT udev, HWND hwnd) BYTE * const evt1 = &strmNops[1*offsetof(MIDIEVENT,dwParms)-1]; BYTE * const evt2 = &strmNops[2*offsetof(MIDIEVENT,dwParms)-1]; + if (udev != MIDIMAPPER && skip_device(udev)) { + return; + } + if (hwnd) rc = midiStreamOpen(&hm, &udev, 1, (DWORD_PTR)hwnd, (DWORD_PTR)MYCBINST, CALLBACK_WINDOW); else