From: Zebediah Figura zfigura@codeweavers.com
--- dlls/mmdevapi/tests/propstore.c | 56 +++++++++++++-------------------- 1 file changed, 22 insertions(+), 34 deletions(-)
diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c index bbefd5a9ead..72dae09d0c3 100644 --- a/dlls/mmdevapi/tests/propstore.c +++ b/dlls/mmdevapi/tests/propstore.c @@ -47,12 +47,9 @@ static void test_propertystore(IPropertyStore *store) hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv); ok(hr == S_OK, "Failed with %08lx\n", hr); ok(pv.vt == VT_LPWSTR, "Value should be %i, is %i\n", VT_LPWSTR, pv.vt); - if (hr == S_OK && pv.vt == VT_LPWSTR) - { - WideCharToMultiByte(CP_ACP, 0, pv.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL); - trace("guid: %s\n", temp); - PropVariantClear(&pv); - } + WideCharToMultiByte(CP_ACP, 0, pv.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL); + trace("guid: %s\n", temp); + PropVariantClear(&pv);
pv.vt = VT_EMPTY; hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv); @@ -204,33 +201,25 @@ START_TEST(propstore)
CoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&mme); - if (FAILED(hr)) - { - skip("mmdevapi not available: 0x%08lx\n", hr); - goto cleanup; - } + ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(mme, eRender, eMultimedia, &dev); ok(hr == S_OK || hr == E_NOTFOUND, "GetDefaultAudioEndpoint failed: 0x%08lx\n", hr); if (hr != S_OK) { - if (hr == E_NOTFOUND) - skip("No sound card available\n"); - else - skip("GetDefaultAudioEndpoint returns 0x%08lx\n", hr); + skip("No sound card available\n"); goto cleanup; } + store = NULL; hr = IMMDevice_OpenPropertyStore(dev, 3, &store); ok(hr == E_INVALIDARG, "Wrong hr returned: %08lx\n", hr); - if (hr != S_OK) - /* It seems on windows returning with E_INVALIDARG doesn't - * set store to NULL, so just don't set store to non-null - * before calling this function - */ - ok(!store, "Store set to non-NULL on failure: %p/%08lx\n", store, hr); - else if (store) - IPropertyStore_Release(store); + /* It seems on windows returning with E_INVALIDARG doesn't + * set store to NULL, so just don't set store to non-null + * before calling this function + */ + ok(!store, "Got unexpected store %p\n", store); + hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, NULL); ok(hr == E_POINTER, "Wrong hr returned: %08lx\n", hr);
@@ -239,18 +228,17 @@ START_TEST(propstore) if(hr == E_ACCESSDENIED) hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &store); ok(hr == S_OK, "Opening valid store returned %08lx\n", hr); - if (store) - { - test_propertystore(store); - test_deviceinterface(store); - test_getat(store); - if (is_wow64) - test_setvalue_on_wow64(store); - IPropertyStore_Release(store); - } + + test_propertystore(store); + test_deviceinterface(store); + test_getat(store); + if (is_wow64) + test_setvalue_on_wow64(store); + IPropertyStore_Release(store); + IMMDevice_Release(dev); + cleanup: - if (mme) - IMMDeviceEnumerator_Release(mme); + IMMDeviceEnumerator_Release(mme); CoUninitialize(); }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/mmdevapi/tests/propstore.c | 74 ++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 34 deletions(-)
diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c index 72dae09d0c3..0eb524c8dbd 100644 --- a/dlls/mmdevapi/tests/propstore.c +++ b/dlls/mmdevapi/tests/propstore.c @@ -188,11 +188,12 @@ static void test_setvalue_on_wow64(IPropertyStore *store) START_TEST(propstore) { HRESULT hr; + IMMDeviceCollection *collection; IMMDeviceEnumerator *mme = NULL; - IMMDevice *dev = NULL; IPropertyStore *store; BOOL is_wow64 = FALSE; HMODULE hk32 = GetModuleHandleA("kernel32.dll"); + unsigned int i, count;
pIsWow64Process = (void *)GetProcAddress(hk32, "IsWow64Process");
@@ -203,42 +204,47 @@ 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_GetDefaultAudioEndpoint(mme, eRender, eMultimedia, &dev); - ok(hr == S_OK || hr == E_NOTFOUND, "GetDefaultAudioEndpoint failed: 0x%08lx\n", hr); - if (hr != S_OK) + hr = IMMDeviceEnumerator_EnumAudioEndpoints(mme, eRender, 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) { - skip("No sound card available\n"); - goto cleanup; + IMMDevice *dev; + + hr = IMMDeviceCollection_Item(collection, i, &dev); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + store = NULL; + hr = IMMDevice_OpenPropertyStore(dev, 3, &store); + ok(hr == E_INVALIDARG, "Wrong hr returned: %08lx\n", hr); + /* It seems on windows returning with E_INVALIDARG doesn't + * set store to NULL, so just don't set store to non-null + * before calling this function + */ + ok(!store, "Got unexpected store %p\n", store); + + hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, NULL); + ok(hr == E_POINTER, "Wrong hr returned: %08lx\n", hr); + + store = NULL; + 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 %08lx\n", hr); + + test_propertystore(store); + test_deviceinterface(store); + test_getat(store); + if (is_wow64) + test_setvalue_on_wow64(store); + + IPropertyStore_Release(store); + IMMDevice_Release(dev); }
- store = NULL; - hr = IMMDevice_OpenPropertyStore(dev, 3, &store); - ok(hr == E_INVALIDARG, "Wrong hr returned: %08lx\n", hr); - /* It seems on windows returning with E_INVALIDARG doesn't - * set store to NULL, so just don't set store to non-null - * before calling this function - */ - ok(!store, "Got unexpected store %p\n", store); - - hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, NULL); - ok(hr == E_POINTER, "Wrong hr returned: %08lx\n", hr); - - store = NULL; - 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 %08lx\n", hr); - - test_propertystore(store); - test_deviceinterface(store); - test_getat(store); - if (is_wow64) - test_setvalue_on_wow64(store); - IPropertyStore_Release(store); - - IMMDevice_Release(dev); - -cleanup: + IMMDeviceCollection_Release(collection); IMMDeviceEnumerator_Release(mme); CoUninitialize(); }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/mmdevapi/tests/propstore.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c index 0eb524c8dbd..9701f074e2f 100644 --- a/dlls/mmdevapi/tests/propstore.c +++ b/dlls/mmdevapi/tests/propstore.c @@ -29,6 +29,9 @@ #include "uuids.h" #include "mmdeviceapi.h" #include "devpkey.h" +#include "ks.h" +#include "ksmedia.h" +#include "mmreg.h"
static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *);
@@ -38,6 +41,7 @@ static const WCHAR software_renderW[] =
static void test_propertystore(IPropertyStore *store) { + const WAVEFORMATEXTENSIBLE *format; HRESULT hr; PROPVARIANT pv; char temp[128]; @@ -68,6 +72,20 @@ static void test_propertystore(IPropertyStore *store) ok(hr == S_OK, "Failed with %08lx\n", hr); ok(pv.vt == VT_EMPTY, "Key should not be found\n"); PropVariantClear(&pv); + + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, (const PROPERTYKEY *)&PKEY_AudioEngine_DeviceFormat, &pv); + ok(hr == S_OK, "Failed with %08lx\n", hr); + ok(pv.vt == VT_BLOB, "Got type %u\n", pv.vt); + ok(pv.blob.cbSize == sizeof(WAVEFORMATEXTENSIBLE), "Got size %lu\n", pv.blob.cbSize); + format = (const void *)pv.blob.pBlobData; + ok(format->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE, "Got format tag %#x\n", format->Format.wFormatTag); + ok(format->Format.cbSize == sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX), + "Got extra size %u\n", format->Format.cbSize); + todo_wine ok(format->Format.wBitsPerSample == 16, "Got bit depth %u\n", format->Format.wBitsPerSample); + todo_wine ok(IsEqualGUID(&format->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM), + "Got subformat %s\n", debugstr_guid(&format->SubFormat)); + PropVariantClear(&pv); }
static void test_deviceinterface(IPropertyStore *store)
This merge request was approved by Huw Davies.