From 4dd778b23e054e6459e34305a5a7f3733e9fc3f3 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 19 Jul 2015 22:41:06 +0000 Subject: [PATCH 1/1] [MMDEVAPI_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924 svn path=/trunk/; revision=68450 --- rostests/winetests/mmdevapi/CMakeLists.txt | 5 +- rostests/winetests/mmdevapi/capture.c | 8 +- rostests/winetests/mmdevapi/propstore.c | 93 +++++++++++++++++++++- rostests/winetests/mmdevapi/render.c | 9 +-- 4 files changed, 104 insertions(+), 11 deletions(-) diff --git a/rostests/winetests/mmdevapi/CMakeLists.txt b/rostests/winetests/mmdevapi/CMakeLists.txt index bbb6a290656..c266e7a6cd2 100644 --- a/rostests/winetests/mmdevapi/CMakeLists.txt +++ b/rostests/winetests/mmdevapi/CMakeLists.txt @@ -1,4 +1,7 @@ +remove_definitions(-D_WIN32_WINNT=0x502) +add_definitions(-D_WIN32_WINNT=0x600) + add_executable(mmdevapi_winetest capture.c dependency.c @@ -9,5 +12,5 @@ add_executable(mmdevapi_winetest set_module_type(mmdevapi_winetest win32cui) target_link_libraries(mmdevapi_winetest uuid) -add_importlibs(mmdevapi_winetest ole32 user32 msvcrt kernel32 ntdll) +add_importlibs(mmdevapi_winetest ole32 user32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET mmdevapi_winetest DESTINATION reactos/bin FOR all) diff --git a/rostests/winetests/mmdevapi/capture.c b/rostests/winetests/mmdevapi/capture.c index 23075ea633e..702843cac1d 100644 --- a/rostests/winetests/mmdevapi/capture.c +++ b/rostests/winetests/mmdevapi/capture.c @@ -948,15 +948,15 @@ static void test_volume_dependence(void) hr = IAudioStreamVolume_GetChannelVolume(asv, 0, &vol); ok(hr == S_OK, "ASV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.2) < 0.05f, "ASV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.2f) < 0.05f, "ASV_GetChannelVolume gave wrong volume: %f\n", vol); hr = IChannelAudioVolume_GetChannelVolume(cav, 0, &vol); ok(hr == S_OK, "CAV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.4) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.4f) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); hr = ISimpleAudioVolume_GetMasterVolume(sav, &vol); ok(hr == S_OK, "SAV_GetMasterVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.6) < 0.05f, "SAV_GetMasterVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.6f) < 0.05f, "SAV_GetMasterVolume gave wrong volume: %f\n", vol); hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac2); @@ -976,7 +976,7 @@ static void test_volume_dependence(void) hr = IChannelAudioVolume_GetChannelVolume(cav2, 0, &vol); ok(hr == S_OK, "CAV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.4) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.4f) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); hr = IAudioStreamVolume_GetChannelVolume(asv2, 0, &vol); ok(hr == S_OK, "ASV_GetChannelVolume failed: %08x\n", hr); diff --git a/rostests/winetests/mmdevapi/propstore.c b/rostests/winetests/mmdevapi/propstore.c index bcb5044ab0e..06fe6900f17 100644 --- a/rostests/winetests/mmdevapi/propstore.c +++ b/rostests/winetests/mmdevapi/propstore.c @@ -30,6 +30,19 @@ #include "mmdeviceapi.h" #include "devpkey.h" +static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *); + +static const WCHAR software_renderW[] = + { 'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'M','M','D','e','v','i','c','e','s','\\', + 'A','u','d','i','o','\\', + 'R','e','n','d','e','r',0 }; +static const WCHAR propertiesW[] = {'P','r','o','p','e','r','t','i','e','s',0}; + + static void test_propertystore(IPropertyStore *store) { HRESULT hr; @@ -109,12 +122,86 @@ static void test_getat(IPropertyStore *store) ok(found_desc == TRUE, "DEVPKEY_Device_DeviceDesc not found\n"); } +static void test_setvalue_on_wow64(IPropertyStore *store) +{ + PROPVARIANT pv; + HRESULT hr; + LONG ret; + WCHAR *guidW; + HKEY root, props, devkey; + DWORD type, regval, size; + + static const PROPERTYKEY PKEY_Bogus = { + {0x1da5d803, 0xd492, 0x4edd, {0x8c, 0x23, 0xe0, 0xc0, 0xff, 0xee, 0x7f, 0x00}}, 0x7f + }; + static const WCHAR bogusW[] = {'{','1','D','A','5','D','8','0','3','-','D','4','9','2','-','4','E','D','D','-','8','C','2','3','-','E','0','C','0','F','F','E','E','7','F','0','0','}',',','1','2','7',0}; + + PropVariantInit(&pv); + + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv); + ok(hr == S_OK, "Failed to get Endpoint GUID: %08x\n", hr); + + guidW = pv.u.pwszVal; + + pv.vt = VT_UI4; + pv.u.ulVal = 0xAB; + + hr = IPropertyStore_SetValue(store, &PKEY_Bogus, &pv); + ok(hr == S_OK || hr == E_ACCESSDENIED, "SetValue failed: %08x\n", hr); + if (hr != S_OK) + { + win_skip("Missing permission to write to registry\n"); + return; + } + + pv.u.ulVal = 0x00; + + hr = IPropertyStore_GetValue(store, &PKEY_Bogus, &pv); + ok(hr == S_OK, "GetValue failed: %08x\n", hr); + ok(pv.u.ulVal == 0xAB, "Got wrong value: 0x%x\n", pv.u.ulVal); + + /* should find the key in 64-bit view */ + ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, software_renderW, 0, KEY_READ|KEY_WOW64_64KEY, &root); + ok(ret == ERROR_SUCCESS, "Couldn't open mmdevices Render key: %u\n", ret); + + ret = RegOpenKeyExW(root, guidW, 0, KEY_READ|KEY_WOW64_64KEY, &devkey); + ok(ret == ERROR_SUCCESS, "Couldn't open mmdevice guid key: %u\n", ret); + + ret = RegOpenKeyExW(devkey, propertiesW, 0, KEY_READ|KEY_WOW64_64KEY, &props); + ok(ret == ERROR_SUCCESS, "Couldn't open mmdevice property key: %u\n", ret); + + /* Note: the registry key exists even without calling IPropStore::Commit */ + size = sizeof(regval); + ret = RegGetValueW(props, NULL, bogusW, RRF_RT_DWORD, &type, ®val, &size); + ok(ret == ERROR_SUCCESS, "Couldn't get bogus propertykey value: %u\n", ret); + ok(type == REG_DWORD, "Got wrong value type: %u\n", type); + ok(regval == 0xAB, "Got wrong value: 0x%x\n", regval); + + RegCloseKey(props); + RegCloseKey(devkey); + RegCloseKey(root); + + CoTaskMemFree(guidW); + + /* should NOT find the key in 32-bit view */ + ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, software_renderW, 0, KEY_READ, &root); + ok(ret == ERROR_FILE_NOT_FOUND, "Wrong error when opening mmdevices Render key: %u\n", ret); +} + START_TEST(propstore) { HRESULT hr; IMMDeviceEnumerator *mme = NULL; IMMDevice *dev = NULL; IPropertyStore *store; + BOOL is_wow64 = FALSE; + HMODULE hk32 = GetModuleHandleA("kernel32.dll"); + + pIsWow64Process = (void *)GetProcAddress(hk32, "IsWow64Process"); + + if (pIsWow64Process) + pIsWow64Process(GetCurrentProcess(), &is_wow64); CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme); @@ -149,13 +236,17 @@ START_TEST(propstore) ok(hr == E_POINTER, "Wrong hr returned: %08x\n", hr); store = NULL; - hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &store); + hr = IMMDevice_OpenPropertyStore(dev, STGM_READWRITE, &store); + if(hr == E_ACCESSDENIED) + hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &store); ok(hr == S_OK, "Opening valid store returned %08x\n", hr); if (store) { test_propertystore(store); test_deviceinterface(store); test_getat(store); + if (is_wow64) + test_setvalue_on_wow64(store); IPropertyStore_Release(store); } IMMDevice_Release(dev); diff --git a/rostests/winetests/mmdevapi/render.c b/rostests/winetests/mmdevapi/render.c index 691994c19c0..02f47b540d6 100644 --- a/rostests/winetests/mmdevapi/render.c +++ b/rostests/winetests/mmdevapi/render.c @@ -1226,7 +1226,6 @@ static void test_clock(int share) last = pos; Sleep(100); - slept += 100; hr = IAudioClock_GetPosition(acl, &pos, NULL); ok(hr == S_OK, "GetPosition failed: %08x\n", hr); @@ -2018,15 +2017,15 @@ static void test_volume_dependence(void) hr = IAudioStreamVolume_GetChannelVolume(asv, 0, &vol); ok(hr == S_OK, "ASV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.2) < 0.05f, "ASV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.2f) < 0.05f, "ASV_GetChannelVolume gave wrong volume: %f\n", vol); hr = IChannelAudioVolume_GetChannelVolume(cav, 0, &vol); ok(hr == S_OK, "CAV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.4) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.4f) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); hr = ISimpleAudioVolume_GetMasterVolume(sav, &vol); ok(hr == S_OK, "SAV_GetMasterVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.6) < 0.05f, "SAV_GetMasterVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.6f) < 0.05f, "SAV_GetMasterVolume gave wrong volume: %f\n", vol); hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac2); @@ -2052,7 +2051,7 @@ static void test_volume_dependence(void) hr = IChannelAudioVolume_GetChannelVolume(cav2, 0, &vol); ok(hr == S_OK, "CAV_GetChannelVolume failed: %08x\n", hr); - ok(fabsf(vol - 0.4) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); + ok(fabsf(vol - 0.4f) < 0.05f, "CAV_GetChannelVolume gave wrong volume: %f\n", vol); hr = IAudioStreamVolume_GetChannelVolume(asv2, 0, &vol); ok(hr == S_OK, "ASV_GetChannelVolume failed: %08x\n", hr); -- 2.17.1