Commit 604172dd authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

devenum: Set FriendlyName and wave*ID for devices.

parent 71723ad0
...@@ -52,6 +52,9 @@ static const WCHAR wszAllowedZero[] = {'A','l','l','o','w','e','d','Z','e','r',' ...@@ -52,6 +52,9 @@ static const WCHAR wszAllowedZero[] = {'A','l','l','o','w','e','d','Z','e','r','
static const WCHAR wszDirection[] = {'D','i','r','e','c','t','i','o','n',0}; static const WCHAR wszDirection[] = {'D','i','r','e','c','t','i','o','n',0};
static const WCHAR wszIsRendered[] = {'I','s','R','e','n','d','e','r','e','d',0}; static const WCHAR wszIsRendered[] = {'I','s','R','e','n','d','e','r','e','d',0};
static const WCHAR wszTypes[] = {'T','y','p','e','s',0}; static const WCHAR wszTypes[] = {'T','y','p','e','s',0};
static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
static const WCHAR wszWaveInID[] = {'W','a','v','e','I','n','I','D',0};
static const WCHAR wszWaveOutID[] = {'W','a','v','e','O','u','t','I','D',0};
static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface); static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface);
static HRESULT DEVENUM_CreateSpecialCategories(void); static HRESULT DEVENUM_CreateSpecialCategories(void);
...@@ -629,6 +632,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) ...@@ -629,6 +632,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
WAVEINCAPSW wicaps; WAVEINCAPSW wicaps;
MIDIOUTCAPSW mocaps; MIDIOUTCAPSW mocaps;
REGPINTYPES * pTypes; REGPINTYPES * pTypes;
IPropertyBag * pPropBag = NULL;
numDevs = waveOutGetNumDevs(); numDevs = waveOutGetNumDevs();
...@@ -666,10 +670,24 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) ...@@ -666,10 +670,24 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
wocaps.szPname, wocaps.szPname,
&rf2); &rf2);
/* FIXME: do additional stuff with IMoniker here, depending on what RegisterFilter does */
if (pMoniker) if (pMoniker)
{ {
VARIANT var;
V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszWaveOutID, &var);
else
pPropBag = NULL;
V_VT(&var) = VT_LPWSTR;
V_UNION(&var, bstrVal) = wocaps.szPname;
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
if (pPropBag)
IPropertyBag_Release(pPropBag);
IMoniker_Release(pMoniker); IMoniker_Release(pMoniker);
pMoniker = NULL; pMoniker = NULL;
} }
...@@ -733,10 +751,27 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) ...@@ -733,10 +751,27 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
wicaps.szPname, wicaps.szPname,
&rf2); &rf2);
/* FIXME: do additional stuff with IMoniker here, depending on what RegisterFilter does */
if (pMoniker) if (pMoniker) {
VARIANT var;
V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszWaveInID, &var);
else
pPropBag = NULL;
V_VT(&var) = VT_LPWSTR;
V_UNION(&var, bstrVal) = wicaps.szPname;
if (SUCCEEDED(res))
res = IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
if (pPropBag)
IPropertyBag_Release(pPropBag);
IMoniker_Release(pMoniker); IMoniker_Release(pMoniker);
}
CoTaskMemFree(pTypes); CoTaskMemFree(pTypes);
} }
...@@ -803,7 +838,6 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) ...@@ -803,7 +838,6 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
szDeviceVersion, sizeof(szDeviceVersion)/sizeof(WCHAR))) szDeviceVersion, sizeof(szDeviceVersion)/sizeof(WCHAR)))
{ {
IMoniker * pMoniker = NULL; IMoniker * pMoniker = NULL;
IPropertyBag * pPropBag = NULL;
WCHAR dprintf[] = { 'v','i','d','e','o','%','d',0 }; WCHAR dprintf[] = { 'v','i','d','e','o','%','d',0 };
snprintfW(szDevicePath, sizeof(szDevicePath)/sizeof(WCHAR), dprintf, i); snprintfW(szDevicePath, sizeof(szDevicePath)/sizeof(WCHAR), dprintf, i);
/* The above code prevents 1 device with a different ID overwriting another */ /* The above code prevents 1 device with a different ID overwriting another */
...@@ -834,8 +868,10 @@ static HRESULT DEVENUM_CreateSpecialCategories(void) ...@@ -834,8 +868,10 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
V_VT(&var) = VT_I4; V_VT(&var) = VT_I4;
V_UNION(&var, ulVal) = i; V_UNION(&var, ulVal) = i;
res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag); res = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
if (SUCCEEDED(res)) if (SUCCEEDED(res)) {
res = IPropertyBag_Write(pPropBag, wszVfwIndex, &var); res = IPropertyBag_Write(pPropBag, wszVfwIndex, &var);
IPropertyBag_Release(pPropBag);
}
IMoniker_Release(pMoniker); IMoniker_Release(pMoniker);
} }
......
...@@ -232,6 +232,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write( ...@@ -232,6 +232,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
switch (V_VT(pVar)) switch (V_VT(pVar))
{ {
case VT_BSTR: case VT_BSTR:
case VT_LPWSTR:
TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal))); TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal)));
lpData = V_UNION(pVar, bstrVal); lpData = V_UNION(pVar, bstrVal);
dwType = REG_SZ; dwType = REG_SZ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment