Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 56 ------------------------------------ 1 file changed, 56 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index 8e82fcdeac5..eba93f0fa06 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -52,7 +52,6 @@ static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a', static const WCHAR wszFilterData[] = {'F','i','l','t','e','r','D','a','t','a',0};
static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface); -static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory);
/********************************************************************** * DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown) @@ -429,9 +428,6 @@ static void register_legacy_filters(void) hr = HRESULT_FROM_WIN32(lRet); }
- if (SUCCEEDED(hr)) - hr = DEVENUM_CreateAMCategoryKey(&CLSID_LegacyAmFilterCategory); - if (SUCCEEDED(hr)) { for (i = 0; i < dwFilterSubkeys; i++) @@ -517,10 +513,6 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons VARIANT var; HRESULT hr;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory); - if (FAILED(hr)) - return FALSE; - if (guid) { WCHAR *name = heap_alloc(sizeof(defaultW) + lstrlenW(desc) * sizeof(WCHAR)); @@ -578,9 +570,6 @@ static void register_waveout_devices(void) VARIANT var; HRESULT hr;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory); - if (FAILED(hr)) return; - count = waveOutGetNumDevs();
for (i = -1; i < count; i++) @@ -627,9 +616,6 @@ static void register_wavein_devices(void) VARIANT var; HRESULT hr;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory); - if (FAILED(hr)) return; - count = waveInGetNumDevs();
for (i = 0; i < count; i++) @@ -671,9 +657,6 @@ static void register_midiout_devices(void) VARIANT var; HRESULT hr;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory); - if (FAILED(hr)) return; - count = midiOutGetNumDevs();
for (i = -1; i < count; i++) @@ -724,9 +707,6 @@ static void register_vfw_codecs(void) int i = 0; HIC hic;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_AudioRendererCategory); - if (FAILED(hr)) return; - while (ICInfo(ICTYPE_VIDEO, i++, &info)) { WCHAR name[5] = {LOBYTE(LOWORD(info.fccHandler)), HIBYTE(LOWORD(info.fccHandler)), @@ -784,10 +764,6 @@ static void register_avicap_devices(void) HRESULT hr; int i = 0;
- hr = DEVENUM_CreateAMCategoryKey(&CLSID_VideoInputDeviceCategory); - if (FAILED(hr)) - return; - for (i = 0; i < 10; ++i) { if (!capGetDriverDescriptionW(i, friendlyname, ARRAY_SIZE(friendlyname), @@ -896,35 +872,3 @@ static const ICreateDevEnumVtbl ICreateDevEnum_Vtbl = * static CreateDevEnum instance */ ICreateDevEnum DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl }; - -/********************************************************************** - * DEVENUM_CreateAMCategoryKey (INTERNAL) - * - * Creates a registry key for a category at HKEY_CURRENT_USER\Software\ - * Microsoft\ActiveMovie\devenum{clsid} - */ -static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory) -{ - WCHAR wszRegKey[MAX_PATH]; - HRESULT res = S_OK; - HKEY hkeyDummy = NULL; - - lstrcpyW(wszRegKey, wszActiveMovieKey); - - if (!StringFromGUID2(clsidCategory, wszRegKey + lstrlenW(wszRegKey), ARRAY_SIZE(wszRegKey) - lstrlenW(wszRegKey))) - res = E_INVALIDARG; - - if (SUCCEEDED(res)) - { - LONG lRes = RegCreateKeyW(HKEY_CURRENT_USER, wszRegKey, &hkeyDummy); - res = HRESULT_FROM_WIN32(lRes); - } - - if (hkeyDummy) - RegCloseKey(hkeyDummy); - - if (FAILED(res)) - ERR("Failed to create key HKEY_CURRENT_USER\%s\n", debugstr_w(wszRegKey)); - - return res; -}
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 39 +++---- dlls/devenum/devenum_main.c | 4 +- dlls/devenum/devenum_private.h | 8 +- dlls/devenum/mediacatenum.c | 178 ++++++++++++++------------------ dlls/devenum/parsedisplayname.c | 30 ++---- 5 files changed, 108 insertions(+), 151 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index eba93f0fa06..866b8d8a60d 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -51,13 +51,7 @@ 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 wszFilterData[] = {'F','i','l','t','e','r','D','a','t','a',0};
-static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface); - -/********************************************************************** - * DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown) - */ -static HRESULT WINAPI DEVENUM_ICreateDevEnum_QueryInterface(ICreateDevEnum *iface, REFIID riid, - void **ppv) +static HRESULT WINAPI devenum_factory_QueryInterface(ICreateDevEnum *iface, REFIID riid, void **ppv) { TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
@@ -68,7 +62,7 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_QueryInterface(ICreateDevEnum *ifac IsEqualGUID(riid, &IID_ICreateDevEnum)) { *ppv = iface; - DEVENUM_ICreateDevEnum_AddRef(iface); + ICreateDevEnum_AddRef(iface); return S_OK; }
@@ -77,10 +71,7 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_QueryInterface(ICreateDevEnum *ifac return E_NOINTERFACE; }
-/********************************************************************** - * DEVENUM_ICreateDevEnum_AddRef (also IUnknown) - */ -static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface) +static ULONG WINAPI devenum_factory_AddRef(ICreateDevEnum *iface) { TRACE("\n");
@@ -89,10 +80,7 @@ static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface) return 2; /* non-heap based object */ }
-/********************************************************************** - * DEVENUM_ICreateDevEnum_Release (also IUnknown) - */ -static ULONG WINAPI DEVENUM_ICreateDevEnum_Release(ICreateDevEnum * iface) +static ULONG WINAPI devenum_factory_Release(ICreateDevEnum *iface) { TRACE("\n");
@@ -799,11 +787,8 @@ static void register_avicap_devices(void) } }
-/********************************************************************** - * DEVENUM_ICreateDevEnum_CreateClassEnumerator - */ -static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( - ICreateDevEnum *iface, REFCLSID class, IEnumMoniker **out, DWORD flags) +static HRESULT WINAPI devenum_factory_CreateClassEnumerator(ICreateDevEnum *iface, + REFCLSID class, IEnumMoniker **out, DWORD flags) { WCHAR guidstr[CHARS_IN_GUID]; HRESULT hr; @@ -838,7 +823,7 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( else if (IsEqualGUID(class, &CLSID_VideoInputDeviceCategory)) register_avicap_devices();
- if (SUCCEEDED(hr = create_EnumMoniker(class, out))) + if (SUCCEEDED(hr = enum_moniker_create(class, out))) { IMoniker *mon; hr = IEnumMoniker_Next(*out, 1, &mon, NULL); @@ -862,13 +847,13 @@ static HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( */ static const ICreateDevEnumVtbl ICreateDevEnum_Vtbl = { - DEVENUM_ICreateDevEnum_QueryInterface, - DEVENUM_ICreateDevEnum_AddRef, - DEVENUM_ICreateDevEnum_Release, - DEVENUM_ICreateDevEnum_CreateClassEnumerator, + devenum_factory_QueryInterface, + devenum_factory_AddRef, + devenum_factory_Release, + devenum_factory_CreateClassEnumerator, };
/********************************************************************** * static CreateDevEnum instance */ -ICreateDevEnum DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl }; +ICreateDevEnum devenum_factory = { &ICreateDevEnum_Vtbl }; diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c index a694e388ce1..d8b0f2cf692 100644 --- a/dlls/devenum/devenum_main.c +++ b/dlls/devenum/devenum_main.c @@ -114,8 +114,8 @@ static const IClassFactoryVtbl ClassFactory_vtbl = { ClassFactory_LockServer };
-static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_CreateDevEnum }; -static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&DEVENUM_ParseDisplayName }; +static struct class_factory create_devenum_cf = { { &ClassFactory_vtbl }, (IUnknown *)&devenum_factory }; +static struct class_factory device_moniker_cf = { { &ClassFactory_vtbl }, (IUnknown *)&devenum_parser };
/*********************************************************************** * DllGetClassObject (DEVENUM.@) diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index 59ac722bfb2..0df964b72d5 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -68,11 +68,11 @@ typedef struct }; } MediaCatMoniker;
-MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) DECLSPEC_HIDDEN; -HRESULT create_EnumMoniker(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN; +MediaCatMoniker *moniker_create(void) DECLSPEC_HIDDEN; +HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN;
-extern ICreateDevEnum DEVENUM_CreateDevEnum DECLSPEC_HIDDEN; -extern IParseDisplayName DEVENUM_ParseDisplayName DECLSPEC_HIDDEN; +extern ICreateDevEnum devenum_factory DECLSPEC_HIDDEN; +extern IParseDisplayName devenum_parser DECLSPEC_HIDDEN;
/********************************************************************** * Global string constant declarations diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index e728be342b1..085bdaea695 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -61,10 +61,7 @@ static inline RegPropBagImpl *impl_from_IPropertyBag(IPropertyBag *iface) return CONTAINING_RECORD(iface, RegPropBagImpl, IPropertyBag_iface); }
-static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface( - LPPROPERTYBAG iface, - REFIID riid, - LPVOID *ppvObj) +static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppvObj) { RegPropBagImpl *This = impl_from_IPropertyBag(iface);
@@ -84,10 +81,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface( return E_NOINTERFACE; }
-/********************************************************************** - * DEVENUM_IPropertyBag_AddRef (also IUnknown) - */ -static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface) +static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface) { RegPropBagImpl *This = impl_from_IPropertyBag(iface);
@@ -96,10 +90,7 @@ static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface) return InterlockedIncrement(&This->ref); }
-/********************************************************************** - * DEVENUM_IPropertyBag_Release (also IUnknown) - */ -static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface) +static ULONG WINAPI property_bag_Release(IPropertyBag *iface) { RegPropBagImpl *This = impl_from_IPropertyBag(iface); ULONG ref; @@ -114,11 +105,8 @@ static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface) return ref; }
-static HRESULT WINAPI DEVENUM_IPropertyBag_Read( - LPPROPERTYBAG iface, - LPCOLESTR pszPropName, - VARIANT* pVar, - IErrorLog* pErrorLog) +static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, + const WCHAR *pszPropName, VARIANT *pVar, IErrorLog *pErrorLog) { static const WCHAR FriendlyNameW[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}; LPVOID pData = NULL; @@ -254,10 +242,8 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read( return res; }
-static HRESULT WINAPI DEVENUM_IPropertyBag_Write( - LPPROPERTYBAG iface, - LPCOLESTR pszPropName, - VARIANT* pVar) +static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, + const WCHAR *pszPropName, VARIANT *pVar) { RegPropBagImpl *This = impl_from_IPropertyBag(iface); LPVOID lpData = NULL; @@ -326,14 +312,14 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Write(
static const IPropertyBagVtbl IPropertyBag_Vtbl = { - DEVENUM_IPropertyBag_QueryInterface, - DEVENUM_IPropertyBag_AddRef, - DEVENUM_IPropertyBag_Release, - DEVENUM_IPropertyBag_Read, - DEVENUM_IPropertyBag_Write + property_bag_QueryInterface, + property_bag_AddRef, + property_bag_Release, + property_bag_Read, + property_bag_Write, };
-static HRESULT create_PropertyBag(MediaCatMoniker *mon, IPropertyBag **ppBag) +static HRESULT property_bag_create(MediaCatMoniker *mon, IPropertyBag **ppBag) { RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl)); if (!rpb) @@ -378,8 +364,7 @@ static inline MediaCatMoniker *impl_from_IMoniker(IMoniker *iface) return CONTAINING_RECORD(iface, MediaCatMoniker, IMoniker_iface); }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface(IMoniker *iface, REFIID riid, - void **ppv) +static HRESULT WINAPI moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv) { TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
@@ -401,7 +386,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface(IMoniker *iface, R return E_NOINTERFACE; }
-static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(IMoniker *iface) +static ULONG WINAPI moniker_AddRef(IMoniker *iface) { MediaCatMoniker *This = impl_from_IMoniker(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -411,7 +396,7 @@ static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(IMoniker *iface) return ref; }
-static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(IMoniker *iface) +static ULONG WINAPI moniker_Release(IMoniker *iface) { MediaCatMoniker *This = impl_from_IMoniker(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -426,7 +411,7 @@ static ULONG WINAPI DEVENUM_IMediaCatMoniker_Release(IMoniker *iface) return ref; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(IMoniker *iface, CLSID *pClassID) +static HRESULT WINAPI moniker_GetClassID(IMoniker *iface, CLSID *pClassID) { MediaCatMoniker *This = impl_from_IMoniker(iface);
@@ -440,28 +425,28 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetClassID(IMoniker *iface, CLSID return S_OK; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsDirty(IMoniker *iface) +static HRESULT WINAPI moniker_IsDirty(IMoniker *iface) { FIXME("(%p)->(): stub\n", iface);
return S_FALSE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Load(IMoniker *iface, IStream *pStm) +static HRESULT WINAPI moniker_Load(IMoniker *iface, IStream *pStm) { FIXME("(%p)->(%p): stub\n", iface, pStm);
return E_NOTIMPL; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty) +static HRESULT WINAPI moniker_Save(IMoniker *iface, IStream *pStm, BOOL fClearDirty) { FIXME("(%p)->(%p, %s): stub\n", iface, pStm, fClearDirty ? "true" : "false");
return STG_E_CANTSAVE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize) +static HRESULT WINAPI moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize) { FIXME("(%p)->(%p): stub\n", iface, pcbSize);
@@ -470,7 +455,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetSizeMax(IMoniker *iface, ULARG return S_OK; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riidResult, void **ppvResult) { MediaCatMoniker *This = impl_from_IMoniker(iface); @@ -539,7 +524,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToObject(IMoniker *iface, IBi return res; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **ppvObj) { MediaCatMoniker *This = impl_from_IMoniker(iface); @@ -563,13 +548,13 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_BindToStorage(IMoniker *iface, IB
if (IsEqualGUID(riid, &IID_IPropertyBag)) { - return create_PropertyBag(This, (IPropertyBag**)ppvObj); + return property_bag_create(This, (IPropertyBag **)ppvObj); }
return MK_E_NOSTORAGE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced) { TRACE("(%p)->(%p, %d, %p, %p)\n", iface, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced); @@ -581,7 +566,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Reduce(IMoniker *iface, IBindCtx return MK_S_REDUCED_TO_SELF; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight, +static HRESULT WINAPI moniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite) { FIXME("(%p)->(%p, %s, %p): stub\n", iface, pmkRight, fOnlyIfNotGeneric ? "true" : "false", ppmkComposite); @@ -592,7 +577,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ComposeWith(IMoniker *iface, IMon return E_NOTIMPL; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(IMoniker *iface, BOOL fForward, +static HRESULT WINAPI moniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker) { FIXME("(%p)->(%s, %p): stub\n", iface, fForward ? "true" : "false", ppenumMoniker); @@ -602,7 +587,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Enum(IMoniker *iface, BOOL fForwa return S_OK; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker) +static HRESULT WINAPI moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker) { CLSID clsid; LPOLESTR this_name, other_name; @@ -636,7 +621,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsEqual(IMoniker *iface, IMoniker return res; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(IMoniker *iface, DWORD *pdwHash) +static HRESULT WINAPI moniker_Hash(IMoniker *iface, DWORD *pdwHash) { TRACE("(%p)->(%p)\n", iface, pdwHash);
@@ -645,7 +630,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(IMoniker *iface, DWORD *pdwH return S_OK; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsRunning(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning) { FIXME("(%p)->(%p, %p, %p): stub\n", iface, pbc, pmkToLeft, pmkNewlyRunning); @@ -653,7 +638,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsRunning(IMoniker *iface, IBindC return S_FALSE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime) { TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, pFileTime); @@ -664,7 +649,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetTimeOfLastChange(IMoniker *ifa return MK_E_UNAVAILABLE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(IMoniker *iface, IMoniker **ppmk) +static HRESULT WINAPI moniker_Inverse(IMoniker *iface, IMoniker **ppmk) { TRACE("(%p)->(%p)\n", iface, ppmk);
@@ -673,7 +658,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Inverse(IMoniker *iface, IMoniker return MK_E_NOINVERSE; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(IMoniker *iface, +static HRESULT WINAPI moniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOtherMoniker, IMoniker **ppmkPrefix) { TRACE("(%p)->(%p, %p)\n", iface, pmkOtherMoniker, ppmkPrefix); @@ -683,7 +668,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_CommonPrefixWith(IMoniker *iface, return MK_E_NOPREFIX; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther, +static HRESULT WINAPI moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkRelPath) { TRACE("(%p)->(%p, %p)\n", iface, pmkOther, ppmkRelPath); @@ -693,7 +678,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_RelativePathTo(IMoniker *iface, I return MK_S_HIM; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName) { MediaCatMoniker *This = impl_from_IMoniker(iface); @@ -738,7 +723,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_GetDisplayName(IMoniker *iface, I return S_OK; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, +static HRESULT WINAPI moniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut) { FIXME("(%p)->(%p, %p, %s, %p, %p)\n", iface, pbc, pmkToLeft, debugstr_w(pszDisplayName), pchEaten, ppmkOut); @@ -749,7 +734,7 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_ParseDisplayName(IMoniker *iface, return MK_E_SYNTAX; }
-static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys) +static HRESULT WINAPI moniker_IsSystemMoniker(IMoniker *iface, DWORD *pdwMksys) { TRACE("(%p)->(%p)\n", iface, pdwMksys);
@@ -758,32 +743,32 @@ static HRESULT WINAPI DEVENUM_IMediaCatMoniker_IsSystemMoniker(IMoniker *iface,
static const IMonikerVtbl IMoniker_Vtbl = { - DEVENUM_IMediaCatMoniker_QueryInterface, - DEVENUM_IMediaCatMoniker_AddRef, - DEVENUM_IMediaCatMoniker_Release, - DEVENUM_IMediaCatMoniker_GetClassID, - DEVENUM_IMediaCatMoniker_IsDirty, - DEVENUM_IMediaCatMoniker_Load, - DEVENUM_IMediaCatMoniker_Save, - DEVENUM_IMediaCatMoniker_GetSizeMax, - DEVENUM_IMediaCatMoniker_BindToObject, - DEVENUM_IMediaCatMoniker_BindToStorage, - DEVENUM_IMediaCatMoniker_Reduce, - DEVENUM_IMediaCatMoniker_ComposeWith, - DEVENUM_IMediaCatMoniker_Enum, - DEVENUM_IMediaCatMoniker_IsEqual, - DEVENUM_IMediaCatMoniker_Hash, - DEVENUM_IMediaCatMoniker_IsRunning, - DEVENUM_IMediaCatMoniker_GetTimeOfLastChange, - DEVENUM_IMediaCatMoniker_Inverse, - DEVENUM_IMediaCatMoniker_CommonPrefixWith, - DEVENUM_IMediaCatMoniker_RelativePathTo, - DEVENUM_IMediaCatMoniker_GetDisplayName, - DEVENUM_IMediaCatMoniker_ParseDisplayName, - DEVENUM_IMediaCatMoniker_IsSystemMoniker + moniker_QueryInterface, + moniker_AddRef, + moniker_Release, + moniker_GetClassID, + moniker_IsDirty, + moniker_Load, + moniker_Save, + moniker_GetSizeMax, + moniker_BindToObject, + moniker_BindToStorage, + moniker_Reduce, + moniker_ComposeWith, + moniker_Enum, + moniker_IsEqual, + moniker_Hash, + moniker_IsRunning, + moniker_GetTimeOfLastChange, + moniker_Inverse, + moniker_CommonPrefixWith, + moniker_RelativePathTo, + moniker_GetDisplayName, + moniker_ParseDisplayName, + moniker_IsSystemMoniker, };
-MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) +MediaCatMoniker *moniker_create(void) { MediaCatMoniker * pMoniker = NULL; pMoniker = CoTaskMemAlloc(sizeof(MediaCatMoniker)); @@ -791,12 +776,10 @@ MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void) return NULL;
pMoniker->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; - pMoniker->ref = 0; + pMoniker->ref = 1; pMoniker->has_class = FALSE; pMoniker->name = NULL;
- DEVENUM_IMediaCatMoniker_AddRef(&pMoniker->IMoniker_iface); - DEVENUM_LockModule();
return pMoniker; @@ -807,8 +790,7 @@ static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface) return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface); }
-static HRESULT WINAPI DEVENUM_IEnumMoniker_QueryInterface(IEnumMoniker *iface, REFIID riid, - void **ppv) +static HRESULT WINAPI enum_moniker_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppv) { TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
@@ -828,7 +810,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_QueryInterface(IEnumMoniker *iface, R return E_NOINTERFACE; }
-static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(IEnumMoniker *iface) +static ULONG WINAPI enum_moniker_AddRef(IEnumMoniker *iface) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -838,7 +820,7 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(IEnumMoniker *iface) return ref; }
-static ULONG WINAPI DEVENUM_IEnumMoniker_Release(IEnumMoniker *iface) +static ULONG WINAPI enum_moniker_Release(IEnumMoniker *iface) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -857,7 +839,7 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_Release(IEnumMoniker *iface) return ref; }
-static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, +static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); @@ -878,7 +860,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, /* try DMOs */ if ((hr = IEnumDMO_Next(This->dmo_enum, 1, &clsid, NULL, NULL)) == S_OK) { - if (!(pMoniker = DEVENUM_IMediaCatMoniker_Construct())) + if (!(pMoniker = moniker_create())) return E_OUTOFMEMORY;
pMoniker->type = DEVICE_DMO; @@ -894,7 +876,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, if ((res = RegOpenKeyExW(This->sw_key, buffer, 0, KEY_QUERY_VALUE, &hkey))) break;
- if (!(pMoniker = DEVENUM_IMediaCatMoniker_Construct())) + if (!(pMoniker = moniker_create())) return E_OUTOFMEMORY;
pMoniker->type = DEVICE_FILTER; @@ -914,7 +896,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, if ((res = RegOpenKeyExW(This->cm_key, buffer, 0, KEY_QUERY_VALUE, &hkey))) break;
- if (!(pMoniker = DEVENUM_IMediaCatMoniker_Construct())) + if (!(pMoniker = moniker_create())) return E_OUTOFMEMORY;
pMoniker->type = DEVICE_CODEC; @@ -947,7 +929,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt, return S_OK; }
-static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(IEnumMoniker *iface, ULONG celt) +static HRESULT WINAPI enum_moniker_Skip(IEnumMoniker *iface, ULONG celt) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
@@ -977,7 +959,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Skip(IEnumMoniker *iface, ULONG celt) return S_OK; }
-static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(IEnumMoniker *iface) +static HRESULT WINAPI enum_moniker_Reset(IEnumMoniker *iface) { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
@@ -990,7 +972,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Reset(IEnumMoniker *iface) return S_OK; }
-static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(IEnumMoniker *iface, IEnumMoniker **ppenum) +static HRESULT WINAPI enum_moniker_Clone(IEnumMoniker *iface, IEnumMoniker **ppenum) { FIXME("(%p)->(%p): stub\n", iface, ppenum);
@@ -1002,16 +984,16 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(IEnumMoniker *iface, IEnumMonik */ static const IEnumMonikerVtbl IEnumMoniker_Vtbl = { - DEVENUM_IEnumMoniker_QueryInterface, - DEVENUM_IEnumMoniker_AddRef, - DEVENUM_IEnumMoniker_Release, - DEVENUM_IEnumMoniker_Next, - DEVENUM_IEnumMoniker_Skip, - DEVENUM_IEnumMoniker_Reset, - DEVENUM_IEnumMoniker_Clone + enum_moniker_QueryInterface, + enum_moniker_AddRef, + enum_moniker_Release, + enum_moniker_Next, + enum_moniker_Skip, + enum_moniker_Reset, + enum_moniker_Clone, };
-HRESULT create_EnumMoniker(REFCLSID class, IEnumMoniker **ppEnumMoniker) +HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **ppEnumMoniker) { EnumMonikerImpl * pEnumMoniker = CoTaskMemAlloc(sizeof(EnumMonikerImpl)); WCHAR buffer[78]; diff --git a/dlls/devenum/parsedisplayname.c b/dlls/devenum/parsedisplayname.c index 62523c08d8a..f472e4c1bec 100644 --- a/dlls/devenum/parsedisplayname.c +++ b/dlls/devenum/parsedisplayname.c @@ -27,8 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
-static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface(IParseDisplayName *iface, - REFIID riid, void **ppv) +static HRESULT WINAPI devenum_parser_QueryInterface(IParseDisplayName *iface, REFIID riid, void **ppv) { TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
@@ -48,7 +47,7 @@ static HRESULT WINAPI DEVENUM_IParseDisplayName_QueryInterface(IParseDisplayName return E_NOINTERFACE; }
-static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef(IParseDisplayName *iface) +static ULONG WINAPI devenum_parser_AddRef(IParseDisplayName *iface) { TRACE("\n");
@@ -57,7 +56,7 @@ static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef(IParseDisplayName *iface) return 2; /* non-heap based object */ }
-static ULONG WINAPI DEVENUM_IParseDisplayName_Release(IParseDisplayName *iface) +static ULONG WINAPI devenum_parser_Release(IParseDisplayName *iface) { TRACE("\n");
@@ -66,16 +65,7 @@ static ULONG WINAPI DEVENUM_IParseDisplayName_Release(IParseDisplayName *iface) return 1; /* non-heap based object */ }
-/********************************************************************** - * DEVENUM_IParseDisplayName_ParseDisplayName - * - * Creates a moniker referenced to by the display string argument - * - * POSSIBLE BUGS: - * Might not handle more complicated strings properly (ie anything - * not in "@device:sw:{CLSID1}<filter name or CLSID>" format - */ -static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(IParseDisplayName *iface, +static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret) { WCHAR buffer[MAX_PATH]; @@ -112,7 +102,7 @@ static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(IParseDisplayNa return MK_E_SYNTAX; }
- if (!(mon = DEVENUM_IMediaCatMoniker_Construct())) + if (!(mon = moniker_create())) return E_OUTOFMEMORY;
if (type == DEVICE_DMO) @@ -161,11 +151,11 @@ static HRESULT WINAPI DEVENUM_IParseDisplayName_ParseDisplayName(IParseDisplayNa */ static const IParseDisplayNameVtbl IParseDisplayName_Vtbl = { - DEVENUM_IParseDisplayName_QueryInterface, - DEVENUM_IParseDisplayName_AddRef, - DEVENUM_IParseDisplayName_Release, - DEVENUM_IParseDisplayName_ParseDisplayName + devenum_parser_QueryInterface, + devenum_parser_AddRef, + devenum_parser_Release, + devenum_parser_ParseDisplayName, };
/* The one instance of this class */ -IParseDisplayName DEVENUM_ParseDisplayName = { &IParseDisplayName_Vtbl }; +IParseDisplayName devenum_parser = { &IParseDisplayName_Vtbl };
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/devenum_private.h | 6 +++--- dlls/devenum/mediacatenum.c | 27 ++++++++++++++------------- dlls/devenum/parsedisplayname.c | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index 0df964b72d5..bdb5fb7b011 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -54,7 +54,7 @@ enum device_type DEVICE_DMO, };
-typedef struct +struct moniker { IMoniker IMoniker_iface; LONG ref; @@ -66,9 +66,9 @@ typedef struct WCHAR *name; /* for filters and codecs */ CLSID clsid; /* for DMOs */ }; -} MediaCatMoniker; +};
-MediaCatMoniker *moniker_create(void) DECLSPEC_HIDDEN; +struct moniker *moniker_create(void) DECLSPEC_HIDDEN; HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN;
extern ICreateDevEnum devenum_factory DECLSPEC_HIDDEN; diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 085bdaea695..fff40e4af34 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -319,7 +319,7 @@ static const IPropertyBagVtbl IPropertyBag_Vtbl = property_bag_Write, };
-static HRESULT property_bag_create(MediaCatMoniker *mon, IPropertyBag **ppBag) +static HRESULT property_bag_create(struct moniker *mon, IPropertyBag **ppBag) { RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl)); if (!rpb) @@ -359,9 +359,9 @@ static HRESULT property_bag_create(MediaCatMoniker *mon, IPropertyBag **ppBag) }
-static inline MediaCatMoniker *impl_from_IMoniker(IMoniker *iface) +static inline struct moniker *impl_from_IMoniker(IMoniker *iface) { - return CONTAINING_RECORD(iface, MediaCatMoniker, IMoniker_iface); + return CONTAINING_RECORD(iface, struct moniker, IMoniker_iface); }
static HRESULT WINAPI moniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv) @@ -388,7 +388,7 @@ static HRESULT WINAPI moniker_QueryInterface(IMoniker *iface, REFIID riid, void
static ULONG WINAPI moniker_AddRef(IMoniker *iface) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); @@ -398,7 +398,7 @@ static ULONG WINAPI moniker_AddRef(IMoniker *iface)
static ULONG WINAPI moniker_Release(IMoniker *iface) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); @@ -413,7 +413,7 @@ static ULONG WINAPI moniker_Release(IMoniker *iface)
static HRESULT WINAPI moniker_GetClassID(IMoniker *iface, CLSID *pClassID) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface);
TRACE("(%p)->(%p)\n", This, pClassID);
@@ -458,7 +458,7 @@ static HRESULT WINAPI moniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSiz static HRESULT WINAPI moniker_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riidResult, void **ppvResult) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface); IUnknown * pObj = NULL; IPropertyBag * pProp = NULL; CLSID clsID; @@ -527,7 +527,7 @@ static HRESULT WINAPI moniker_BindToObject(IMoniker *iface, IBindCtx *pbc, static HRESULT WINAPI moniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, void **ppvObj) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface);
TRACE("(%p)->(%p, %p, %s, %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObj);
@@ -681,7 +681,7 @@ static HRESULT WINAPI moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther static HRESULT WINAPI moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName) { - MediaCatMoniker *This = impl_from_IMoniker(iface); + struct moniker *This = impl_from_IMoniker(iface); WCHAR *buffer;
TRACE("(%p)->(%p, %p, %p)\n", iface, pbc, pmkToLeft, ppszDisplayName); @@ -768,10 +768,11 @@ static const IMonikerVtbl IMoniker_Vtbl = moniker_IsSystemMoniker, };
-MediaCatMoniker *moniker_create(void) +struct moniker *moniker_create(void) { - MediaCatMoniker * pMoniker = NULL; - pMoniker = CoTaskMemAlloc(sizeof(MediaCatMoniker)); + struct moniker *pMoniker; + + pMoniker = CoTaskMemAlloc(sizeof(*pMoniker)); if (!pMoniker) return NULL;
@@ -844,9 +845,9 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); WCHAR buffer[MAX_PATH + 1]; + struct moniker *pMoniker; LONG res; ULONG fetched = 0; - MediaCatMoniker * pMoniker; CLSID clsid; HRESULT hr; HKEY hkey; diff --git a/dlls/devenum/parsedisplayname.c b/dlls/devenum/parsedisplayname.c index f472e4c1bec..ab0f7bf870d 100644 --- a/dlls/devenum/parsedisplayname.c +++ b/dlls/devenum/parsedisplayname.c @@ -70,7 +70,7 @@ static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface, { WCHAR buffer[MAX_PATH]; enum device_type type; - MediaCatMoniker *mon; + struct moniker *mon; CLSID class;
TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(name), eaten, ret);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/mediacatenum.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index fff40e4af34..860eef76032 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -405,7 +405,7 @@ static ULONG WINAPI moniker_Release(IMoniker *iface)
if (ref == 0) { CoTaskMemFree(This->name); - CoTaskMemFree(This); + free(This); DEVENUM_UnlockModule(); } return ref; @@ -770,20 +770,17 @@ static const IMonikerVtbl IMoniker_Vtbl =
struct moniker *moniker_create(void) { - struct moniker *pMoniker; + struct moniker *object;
- pMoniker = CoTaskMemAlloc(sizeof(*pMoniker)); - if (!pMoniker) + if (!(object = calloc(1, sizeof(*object)))) return NULL;
- pMoniker->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; - pMoniker->ref = 1; - pMoniker->has_class = FALSE; - pMoniker->name = NULL; + object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; + object->ref = 1;
DEVENUM_LockModule();
- return pMoniker; + return object; }
static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/devenum_private.h | 4 +- dlls/devenum/mediacatenum.c | 89 +++++++++++++++++++-------------- dlls/devenum/parsedisplayname.c | 41 +++++++-------- 3 files changed, 73 insertions(+), 61 deletions(-)
diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index bdb5fb7b011..cb274d6c11b 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -68,7 +68,9 @@ struct moniker }; };
-struct moniker *moniker_create(void) DECLSPEC_HIDDEN; +struct moniker *dmo_moniker_create(const GUID class, const GUID clsid) DECLSPEC_HIDDEN; +struct moniker *codec_moniker_create(const GUID *class, const WCHAR *name) DECLSPEC_HIDDEN; +struct moniker *filter_moniker_create(const GUID *class, const WCHAR *name) DECLSPEC_HIDDEN; HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HIDDEN;
extern ICreateDevEnum devenum_factory DECLSPEC_HIDDEN; diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 860eef76032..4a5ae45e8b4 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -768,7 +768,7 @@ static const IMonikerVtbl IMoniker_Vtbl = moniker_IsSystemMoniker, };
-struct moniker *moniker_create(void) +struct moniker *filter_moniker_create(const GUID *class, const WCHAR *name) { struct moniker *object;
@@ -777,6 +777,49 @@ struct moniker *moniker_create(void)
object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; object->ref = 1; + object->type = DEVICE_FILTER; + if (class) + object->class = *class; + object->has_class = !!class; + object->name = wcsdup(name); + + DEVENUM_LockModule(); + + return object; +} + +struct moniker *codec_moniker_create(const GUID *class, const WCHAR *name) +{ + struct moniker *object; + + if (!(object = calloc(1, sizeof(*object)))) + return NULL; + + object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; + object->ref = 1; + object->type = DEVICE_CODEC; + if (class) + object->class = *class; + object->has_class = !!class; + object->name = wcsdup(name); + + DEVENUM_LockModule(); + + return object; +} + +struct moniker *dmo_moniker_create(const GUID class, const GUID clsid) +{ + struct moniker *object; + + if (!(object = calloc(1, sizeof(*object)))) + return NULL; + + object->IMoniker_iface.lpVtbl = &IMoniker_Vtbl; + object->ref = 1; + object->type = DEVICE_DMO; + object->class = class; + object->clsid = clsid;
DEVENUM_LockModule();
@@ -842,11 +885,11 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike { EnumMonikerImpl *This = impl_from_IEnumMoniker(iface); WCHAR buffer[MAX_PATH + 1]; - struct moniker *pMoniker; + struct moniker *moniker; LONG res; ULONG fetched = 0; - CLSID clsid; HRESULT hr; + GUID clsid; HKEY hkey;
TRACE("(%p)->(%d, %p, %p)\n", iface, celt, rgelt, pceltFetched); @@ -858,14 +901,7 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike /* try DMOs */ if ((hr = IEnumDMO_Next(This->dmo_enum, 1, &clsid, NULL, NULL)) == S_OK) { - if (!(pMoniker = moniker_create())) - return E_OUTOFMEMORY; - - pMoniker->type = DEVICE_DMO; - pMoniker->clsid = clsid; - - StringFromGUID2(&clsid, buffer, CHARS_IN_GUID); - StringFromGUID2(&This->class, buffer + CHARS_IN_GUID - 1, CHARS_IN_GUID); + moniker = dmo_moniker_create(This->class, clsid); } /* try DirectShow filters */ else if (!(res = RegEnumKeyW(This->sw_key, This->sw_index, buffer, ARRAY_SIZE(buffer)))) @@ -874,17 +910,7 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike if ((res = RegOpenKeyExW(This->sw_key, buffer, 0, KEY_QUERY_VALUE, &hkey))) break;
- if (!(pMoniker = moniker_create())) - return E_OUTOFMEMORY; - - pMoniker->type = DEVICE_FILTER; - - if (!(pMoniker->name = CoTaskMemAlloc((lstrlenW(buffer) + 1) * sizeof(WCHAR)))) - { - IMoniker_Release(&pMoniker->IMoniker_iface); - return E_OUTOFMEMORY; - } - lstrcpyW(pMoniker->name, buffer); + moniker = filter_moniker_create(&This->class, buffer); } /* then try codecs */ else if (!(res = RegEnumKeyW(This->cm_key, This->cm_index, buffer, ARRAY_SIZE(buffer)))) @@ -894,26 +920,15 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike if ((res = RegOpenKeyExW(This->cm_key, buffer, 0, KEY_QUERY_VALUE, &hkey))) break;
- if (!(pMoniker = moniker_create())) - return E_OUTOFMEMORY; - - pMoniker->type = DEVICE_CODEC; - - if (!(pMoniker->name = CoTaskMemAlloc((lstrlenW(buffer) + 1) * sizeof(WCHAR)))) - { - IMoniker_Release(&pMoniker->IMoniker_iface); - return E_OUTOFMEMORY; - } - lstrcpyW(pMoniker->name, buffer); + moniker = codec_moniker_create(&This->class, buffer); } else break;
- pMoniker->has_class = TRUE; - pMoniker->class = This->class; + if (!moniker) + return E_OUTOFMEMORY;
- rgelt[fetched] = &pMoniker->IMoniker_iface; - fetched++; + rgelt[fetched++] = &moniker->IMoniker_iface; }
TRACE("-- fetched %d\n", fetched); diff --git a/dlls/devenum/parsedisplayname.c b/dlls/devenum/parsedisplayname.c index ab0f7bf870d..45a89f69932 100644 --- a/dlls/devenum/parsedisplayname.c +++ b/dlls/devenum/parsedisplayname.c @@ -68,10 +68,10 @@ static ULONG WINAPI devenum_parser_Release(IParseDisplayName *iface) static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface, IBindCtx *pbc, LPOLESTR name, ULONG *eaten, IMoniker **ret) { + struct moniker *moniker; WCHAR buffer[MAX_PATH]; enum device_type type; - struct moniker *mon; - CLSID class; + GUID class, clsid;
TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(name), eaten, ret);
@@ -102,47 +102,42 @@ static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface, return MK_E_SYNTAX; }
- if (!(mon = moniker_create())) - return E_OUTOFMEMORY; - if (type == DEVICE_DMO) { lstrcpynW(buffer, name, CHARS_IN_GUID); - if (FAILED(CLSIDFromString(buffer, &mon->clsid))) - { - IMoniker_Release(&mon->IMoniker_iface); + if (FAILED(CLSIDFromString(buffer, &clsid))) return MK_E_SYNTAX; - }
lstrcpynW(buffer, name + CHARS_IN_GUID - 1, CHARS_IN_GUID); - if (FAILED(CLSIDFromString(buffer, &mon->class))) - { - IMoniker_Release(&mon->IMoniker_iface); + if (FAILED(CLSIDFromString(buffer, &class))) return MK_E_SYNTAX; - } + + moniker = dmo_moniker_create(class, clsid); } else { lstrcpynW(buffer, name, CHARS_IN_GUID); if (CLSIDFromString(buffer, &class) == S_OK) { - mon->has_class = TRUE; - mon->class = class; name += CHARS_IN_GUID; + if (type == DEVICE_FILTER) + moniker = filter_moniker_create(&class, name); + else + moniker = codec_moniker_create(&class, name); } - - if (!(mon->name = CoTaskMemAlloc((lstrlenW(name) + 1) * sizeof(WCHAR)))) + else { - IMoniker_Release(&mon->IMoniker_iface); - return E_OUTOFMEMORY; + if (type == DEVICE_FILTER) + moniker = filter_moniker_create(NULL, name); + else + moniker = codec_moniker_create(NULL, name); } - lstrcpyW(mon->name, name); }
- mon->type = type; - - *ret = &mon->IMoniker_iface; + if (!moniker) + return E_OUTOFMEMORY;
+ *ret = &moniker->IMoniker_iface; return S_OK; }