mmdevapi: Store device interface in registry.

This commit is contained in:
Andrew Eikum 2012-04-05 14:16:40 -05:00 committed by Alexandre Julliard
parent 9c79ba8a04
commit e6638bd86f
2 changed files with 27 additions and 0 deletions

View File

@ -268,6 +268,10 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
WCHAR guidstr[39];
DWORD i;
static const PROPERTYKEY deviceinterface_key = {
{0x233164c8, 0x1b2c, 0x4c7d, {0xbc, 0x68, 0xb6, 0x71, 0x68, 0x7a, 0x25, 0x67}}, 1
};
for (i = 0; i < MMDevice_count; ++i)
{
MMDevice *device = MMDevice_head[i];
@ -319,10 +323,15 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
if (!RegCreateKeyExW(key, reg_properties, 0, NULL, 0, KEY_WRITE|KEY_READ, NULL, &keyprop, NULL))
{
PROPVARIANT pv;
pv.vt = VT_LPWSTR;
pv.u.pwszVal = name;
MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv);
MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_Device_DeviceDesc, &pv);
pv.u.pwszVal = guidstr;
MMDevice_SetPropValue(id, flow, &deviceinterface_key, &pv);
RegCloseKey(keyprop);
}
RegCloseKey(key);

View File

@ -64,6 +64,23 @@ static void test_propertystore(IPropertyStore *store)
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
}
static void test_deviceinterface(IPropertyStore *store)
{
HRESULT hr;
PROPVARIANT pv;
static const PROPERTYKEY deviceinterface_key = {
{0x233164c8, 0x1b2c, 0x4c7d, {0xbc, 0x68, 0xb6, 0x71, 0x68, 0x7a, 0x25, 0x67}}, 1
};
pv.vt = VT_EMPTY;
hr = IPropertyStore_GetValue(store, &deviceinterface_key, &pv);
ok(hr == S_OK, "GetValue failed: %08x\n", hr);
ok(pv.vt == VT_LPWSTR, "Got wrong variant type: 0x%x\n", pv.vt);
trace("device interface: %s\n", wine_dbgstr_w(pv.u.pwszVal));
CoTaskMemFree(pv.u.pwszVal);
}
START_TEST(propstore)
{
HRESULT hr;
@ -109,6 +126,7 @@ START_TEST(propstore)
if (store)
{
test_propertystore(store);
test_deviceinterface(store);
IPropertyStore_Release(store);
}
IMMDevice_Release(dev);