From 85339cdb5f44d6a5dff86d565f1cf45c84bef3cf Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 22 Apr 2010 22:59:58 +0200 Subject: [PATCH] mmdevapi: Add some DEVPKEY's to property tests. --- dlls/mmdevapi/devenum.c | 1 + dlls/mmdevapi/tests/mmdevenum.c | 1 + dlls/mmdevapi/tests/propstore.c | 24 ++++++++++++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c index a5f49a6caea..0a7a661b48e 100644 --- a/dlls/mmdevapi/devenum.c +++ b/dlls/mmdevapi/devenum.c @@ -1211,6 +1211,7 @@ static HRESULT WINAPI MMDevPropStore_GetValue(IPropertyStore *iface, REFPROPERTY /* Special case */ if (IsEqualPropertyKey(*key, PKEY_AudioEndpoint_GUID)) { + pv->vt = VT_LPWSTR; pv->u.pwszVal = CoTaskMemAlloc(39 * sizeof(WCHAR)); if (!pv->u.pwszVal) return E_OUTOFMEMORY; diff --git a/dlls/mmdevapi/tests/mmdevenum.c b/dlls/mmdevapi/tests/mmdevenum.c index 014cbf3de4a..f2b8f1381b8 100644 --- a/dlls/mmdevapi/tests/mmdevenum.c +++ b/dlls/mmdevapi/tests/mmdevenum.c @@ -26,6 +26,7 @@ #include "audioclient.h" #include "dshow.h" #include "dsound.h" +#include "devpkey.h" DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); diff --git a/dlls/mmdevapi/tests/propstore.c b/dlls/mmdevapi/tests/propstore.c index bb9ff1606d3..13d6f75a69d 100644 --- a/dlls/mmdevapi/tests/propstore.c +++ b/dlls/mmdevapi/tests/propstore.c @@ -29,22 +29,38 @@ #include "unknwn.h" #include "uuids.h" #include "mmdeviceapi.h" +#include "devpkey.h" static void test_propertystore(IPropertyStore *store) { HRESULT hr; - PROPVARIANT pv = { 0 }; - char temp[40]; + PROPVARIANT pv; + char temp[128]; + temp[sizeof(temp)-1] = 0; + pv.vt = VT_EMPTY; hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv); ok(hr == S_OK, "Failed with %08x\n", hr); - if (hr == S_OK) + 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.u.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL); - temp[sizeof(temp)-1] = 0; trace("guid: %s\n", temp); CoTaskMemFree(pv.u.pwszVal); } + + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv); + ok(hr == S_OK, "Failed with %08x\n", hr); + ok(pv.vt == VT_EMPTY, "Key should not be found\n"); + + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_Enabled, &pv); + ok(pv.vt == VT_EMPTY, "Key should not be found\n"); + + pv.vt = VT_EMPTY; + hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_ClassGuid, &pv); + ok(pv.vt == VT_EMPTY, "Key should not be found\n"); } START_TEST(propstore) -- 2.11.4.GIT