From: Bernhard Kölbl <bkoelbl@codeweavers.com> --- dlls/mmdevapi/tests/propstore.c | 41 +++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c index 5c15ba24aee..18024428102 100644 --- a/dlls/mmdevapi/tests/propstore.c +++ b/dlls/mmdevapi/tests/propstore.c @@ -37,6 +37,8 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *); static const WCHAR software_renderW[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\MMDevices\\Audio\\Render"; +static const WCHAR software_captureW[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\MMDevices\\Audio\\Capture"; static void test_propertystore(IPropertyStore *store) { @@ -147,19 +149,21 @@ static void test_getat(IPropertyStore *store) ok(found_desc, "DEVPKEY_Device_DeviceDesc not found\n"); } -static void test_setvalue_on_wow64(IPropertyStore *store) +static void test_setvalue_on_wow64(IPropertyStore *store, EDataFlow data_flow) { PROPVARIANT pv; HRESULT hr; LONG ret; - WCHAR *guidW; + WCHAR *guidW, value[128]; 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 friendly_nameW[] = L"{A45C254E-DF1C-4EFD-8020-67D146A850E0},14"; static const WCHAR bogusW[] = L"{1DA5D803-D492-4EDD-8C23-E0C0FFEE7F00},127"; + const WCHAR *rootW = data_flow ? software_captureW : software_renderW; PropVariantInit(&pv); @@ -187,7 +191,7 @@ static void test_setvalue_on_wow64(IPropertyStore *store) ok(pv.ulVal == 0xAB, "Got wrong value: 0x%lx\n", pv.ulVal); /* should find the key in 64-bit view */ - ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, software_renderW, 0, KEY_READ|KEY_WOW64_64KEY, &root); + ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, rootW, 0, KEY_READ|KEY_WOW64_64KEY, &root); ok(ret == ERROR_SUCCESS, "Couldn't open mmdevices Render key: %lu\n", ret); ret = RegOpenKeyExW(root, guidW, 0, KEY_READ|KEY_WOW64_64KEY, &devkey); @@ -203,6 +207,25 @@ static void test_setvalue_on_wow64(IPropertyStore *store) ok(type == REG_DWORD, "Got wrong value type: %lu\n", type); ok(regval == 0xAB, "Got wrong value: 0x%lx\n", regval); + /* DEVPKEY_Device_FriendlyName won't be stored in the registry. */ + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv); + ok(hr == S_OK, "IPropertyStore_GetValue failed with %#lx\n", hr); + ok(pv.vt == VT_LPWSTR && pv.pwszVal, "DeviceInterface_FriendlyName returned incorrect type %#x\n", pv.vt); + + size = ARRAY_SIZE(value); + ret = RegQueryValueExW(props, friendly_nameW, NULL, NULL, (BYTE *)&value, &size); + todo_wine ok(ret == ERROR_FILE_NOT_FOUND, "RegQueryValueExW returned unexpected value %lu\n", ret); + + pv.vt = VT_LPWSTR; + pv.pwszVal = (WCHAR *)L"FooBar"; + hr = IPropertyStore_SetValue(store, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv); + todo_wine ok(hr == E_ACCESSDENIED, "IPropertyStore_SetValue failed with %#lx\n", hr); + + size = ARRAY_SIZE(value); + ret = RegQueryValueExW(props, friendly_nameW, NULL, NULL, (BYTE *)&value, &size); + todo_wine ok(ret == ERROR_FILE_NOT_FOUND, "RegQueryValueExW returned unexpected value %lu\n", ret); + RegCloseKey(props); RegCloseKey(devkey); RegCloseKey(root); @@ -235,13 +258,15 @@ START_TEST(propstore) hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme); ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eRender, DEVICE_STATE_ACTIVE, &collection); + hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eAll, DEVICE_STATE_ACTIVE, &collection); ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = IMMDeviceCollection_GetCount(collection, &count); ok(hr == S_OK, "Got hr %#lx.\n", hr); for (i = 0; i < count; ++i) { + IMMEndpoint *endpoint; + EDataFlow data_flow; IMMDevice *dev; hr = IMMDeviceCollection_Item(collection, i, &dev); @@ -265,12 +290,18 @@ START_TEST(propstore) hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &store); ok(hr == S_OK, "Opening valid store returned %08lx\n", hr); + hr = IMMDevice_QueryInterface(dev, &IID_IMMEndpoint, (void **)&endpoint); + ok(hr == S_OK, "IMMDevice_QueryInterface returned %#lx\n", hr); + hr = IMMEndpoint_GetDataFlow(endpoint, &data_flow); + ok(hr == S_OK, "IMMEndpoint_GetDataFlow returned %#lx\n", hr); + test_propertystore(store); test_deviceinterface(store); test_getat(store); if (is_wow64) - test_setvalue_on_wow64(store); + test_setvalue_on_wow64(store, data_flow); + IMMEndpoint_Release(endpoint); IPropertyStore_Release(store); IMMDevice_Release(dev); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9915