devenum: Set FriendlyName and wave*ID for devices.
This commit is contained in:
parent
71723ad086
commit
604172dd98
|
@ -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 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 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 HRESULT DEVENUM_CreateSpecialCategories(void);
|
||||
|
@ -629,6 +632,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
WAVEINCAPSW wicaps;
|
||||
MIDIOUTCAPSW mocaps;
|
||||
REGPINTYPES * pTypes;
|
||||
IPropertyBag * pPropBag = NULL;
|
||||
|
||||
numDevs = waveOutGetNumDevs();
|
||||
|
||||
|
@ -666,10 +670,24 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
wocaps.szPname,
|
||||
&rf2);
|
||||
|
||||
/* FIXME: do additional stuff with IMoniker here, depending on what RegisterFilter does */
|
||||
|
||||
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);
|
||||
pMoniker = NULL;
|
||||
}
|
||||
|
@ -725,7 +743,7 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
|
||||
rfp2.lpMediaType = pTypes;
|
||||
|
||||
res = IFilterMapper2_RegisterFilter(pMapper,
|
||||
res = IFilterMapper2_RegisterFilter(pMapper,
|
||||
&CLSID_AudioRecord,
|
||||
wicaps.szPname,
|
||||
&pMoniker,
|
||||
|
@ -733,10 +751,27 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
wicaps.szPname,
|
||||
&rf2);
|
||||
|
||||
/* FIXME: do additional stuff with IMoniker here, depending on what RegisterFilter does */
|
||||
|
||||
if (pMoniker)
|
||||
IMoniker_Release(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);
|
||||
}
|
||||
|
||||
CoTaskMemFree(pTypes);
|
||||
}
|
||||
|
@ -803,7 +838,6 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
szDeviceVersion, sizeof(szDeviceVersion)/sizeof(WCHAR)))
|
||||
{
|
||||
IMoniker * pMoniker = NULL;
|
||||
IPropertyBag * pPropBag = NULL;
|
||||
WCHAR dprintf[] = { 'v','i','d','e','o','%','d',0 };
|
||||
snprintfW(szDevicePath, sizeof(szDevicePath)/sizeof(WCHAR), dprintf, i);
|
||||
/* The above code prevents 1 device with a different ID overwriting another */
|
||||
|
@ -834,8 +868,10 @@ static HRESULT DEVENUM_CreateSpecialCategories(void)
|
|||
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, wszVfwIndex, &var);
|
||||
if (SUCCEEDED(res)) {
|
||||
res = IPropertyBag_Write(pPropBag, wszVfwIndex, &var);
|
||||
IPropertyBag_Release(pPropBag);
|
||||
}
|
||||
IMoniker_Release(pMoniker);
|
||||
}
|
||||
|
||||
|
|
|
@ -232,6 +232,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
|
|||
switch (V_VT(pVar))
|
||||
{
|
||||
case VT_BSTR:
|
||||
case VT_LPWSTR:
|
||||
TRACE("writing %s\n", debugstr_w(V_UNION(pVar, bstrVal)));
|
||||
lpData = V_UNION(pVar, bstrVal);
|
||||
dwType = REG_SZ;
|
||||
|
|
Loading…
Reference in New Issue