* - Also creates the special registry keys created at run-time
*/
-#define NONAMELESSSTRUCT
-#define NONAMELESSUNION
-
#include "devenum_private.h"
-#include <vfw.h>
-#include <wine/debug.h>
-//#include "wine/unicode.h"
-//#include "mmddk.h"
+#include <vfw.h>
-WINE_DEFAULT_DEBUG_CHANNEL(devenum);
+#include "resource.h"
extern HINSTANCE DEVENUM_hInstance;
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);
/**********************************************************************
* DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown)
*/
-static HRESULT WINAPI DEVENUM_ICreateDevEnum_QueryInterface(
- ICreateDevEnum * iface,
- REFIID riid,
- LPVOID *ppvObj)
+static HRESULT WINAPI DEVENUM_ICreateDevEnum_QueryInterface(ICreateDevEnum *iface, REFIID riid,
+ void **ppv)
{
- TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
- if (ppvObj == NULL) return E_POINTER;
+ if (!ppv)
+ return E_POINTER;
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ICreateDevEnum))
{
- *ppvObj = iface;
+ *ppv = iface;
DEVENUM_ICreateDevEnum_AddRef(iface);
return S_OK;
}
FIXME("- no interface IID: %s\n", debugstr_guid(riid));
+ *ppv = NULL;
return E_NOINTERFACE;
}
for (i1 = 0; i1 < dwMinorTypes; i1++)
{
WCHAR wszMinorTypeName[64];
- DWORD cName = sizeof(wszMinorTypeName) / sizeof(WCHAR);
CLSID *clsMajorType = NULL, *clsMinorType = NULL;
HRESULT hr;
+ cName = sizeof(wszMinorTypeName) / sizeof(WCHAR);
if (RegEnumKeyExW(hkeyMajorType, i1, wszMinorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;
clsMinorType = CoTaskMemAlloc(sizeof(CLSID));
HKEY hkeyCategoryBaseKey;
WCHAR wszRegKey[MAX_PATH];
HKEY hkeyInstance = NULL;
- HRESULT hr;
if (RegEnumKeyExW(hkeyFilter, i, wszFilterSubkeyName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;
HKEY hkey;
HKEY hbasekey;
HRESULT hr;
- CreateDevEnumImpl *This = (CreateDevEnumImpl *)iface;
- TRACE("(%p)->(%s, %p, %x)\n\tDeviceClass:\t%s\n", This, debugstr_guid(clsidDeviceClass), ppEnumMoniker, dwFlags, debugstr_guid(clsidDeviceClass));
+ TRACE("(%p)->(%s, %p, %x)\n", iface, debugstr_guid(clsidDeviceClass), ppEnumMoniker, dwFlags);
if (!ppEnumMoniker)
return E_POINTER;
/**********************************************************************
* static CreateDevEnum instance
*/
-CreateDevEnumImpl DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl };
+ICreateDevEnum DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl };
/**********************************************************************
* DEVENUM_CreateAMCategoryKey (INTERNAL)
WAVEINCAPSW wicaps;
MIDIOUTCAPSW mocaps;
REGPINTYPES * pTypes;
+ IPropertyBag * pPropBag = NULL;
numDevs = waveOutGetNumDevs();
wocaps.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, 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;
+ }
wsprintfW(szDSoundName, szDSoundNameFormat, wocaps.szPname);
res = IFilterMapper2_RegisterFilter(pMapper,
rfp2.lpMediaType = pTypes;
- res = IFilterMapper2_RegisterFilter(pMapper,
+ res = IFilterMapper2_RegisterFilter(pMapper,
&CLSID_AudioRecord,
wicaps.szPname,
&pMoniker,
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);
}
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 */
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);
}