Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/mediacatenum.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 9176d8470db..07dcb1438f7 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -789,7 +789,7 @@ static ULONG WINAPI enum_moniker_Release(IEnumMoniker *iface) IEnumDMO_Release(This->dmo_enum); RegCloseKey(This->sw_key); RegCloseKey(This->cm_key); - CoTaskMemFree(This); + free(This); DEVENUM_UnlockModule(); return 0; } @@ -922,41 +922,43 @@ static const IEnumMonikerVtbl IEnumMoniker_Vtbl = enum_moniker_Clone, };
-HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **ppEnumMoniker) +HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **out) { - EnumMonikerImpl * pEnumMoniker = CoTaskMemAlloc(sizeof(EnumMonikerImpl)); + EnumMonikerImpl *object; WCHAR buffer[78]; HRESULT hr;
- if (!pEnumMoniker) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
- pEnumMoniker->IEnumMoniker_iface.lpVtbl = &IEnumMoniker_Vtbl; - pEnumMoniker->ref = 1; - pEnumMoniker->sw_index = 0; - pEnumMoniker->cm_index = 0; - pEnumMoniker->class = *class; + object->IEnumMoniker_iface.lpVtbl = &IEnumMoniker_Vtbl; + object->ref = 1; + object->class = *class;
lstrcpyW(buffer, clsidW); lstrcatW(buffer, backslashW); StringFromGUID2(class, buffer + lstrlenW(buffer), CHARS_IN_GUID); lstrcatW(buffer, instanceW); - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &pEnumMoniker->sw_key)) - pEnumMoniker->sw_key = NULL; + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &object->sw_key)) + object->sw_key = NULL;
lstrcpyW(buffer, wszActiveMovieKey); StringFromGUID2(class, buffer + lstrlenW(buffer), CHARS_IN_GUID); - if (RegOpenKeyExW(HKEY_CURRENT_USER, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &pEnumMoniker->cm_key)) - pEnumMoniker->cm_key = NULL; + if (RegOpenKeyExW(HKEY_CURRENT_USER, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &object->cm_key)) + object->cm_key = NULL;
- hr = DMOEnum(class, 0, 0, NULL, 0, NULL, &pEnumMoniker->dmo_enum); + hr = DMOEnum(class, 0, 0, NULL, 0, NULL, &object->dmo_enum); if (FAILED(hr)) { - IEnumMoniker_Release(&pEnumMoniker->IEnumMoniker_iface); + if (object->cm_key) + RegCloseKey(object->cm_key); + if (object->sw_key) + RegCloseKey(object->sw_key); + free(object); return hr; }
- *ppEnumMoniker = &pEnumMoniker->IEnumMoniker_iface; + *out = &object->IEnumMoniker_iface;
DEVENUM_LockModule();
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/mediacatenum.c | 63 +++++++++++++++++++++++++----------- dlls/devenum/tests/devenum.c | 32 ++++++++++-------- 2 files changed, 62 insertions(+), 33 deletions(-)
diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 07dcb1438f7..6f0209f39b1 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -33,7 +33,7 @@ typedef struct IEnumMoniker IEnumMoniker_iface; CLSID class; LONG ref; - IEnumDMO *dmo_enum; + IEnumDMO *dmo_enum, *dmo_enum2; HKEY sw_key; DWORD sw_index; HKEY cm_key; @@ -786,7 +786,10 @@ static ULONG WINAPI enum_moniker_Release(IEnumMoniker *iface)
if (!ref) { - IEnumDMO_Release(This->dmo_enum); + if (This->dmo_enum) + IEnumDMO_Release(This->dmo_enum); + if (This->dmo_enum2) + IEnumDMO_Release(This->dmo_enum2); RegCloseKey(This->sw_key); RegCloseKey(This->cm_key); free(This); @@ -796,6 +799,26 @@ static ULONG WINAPI enum_moniker_Release(IEnumMoniker *iface) return ref; }
+static struct moniker *get_dmo_moniker(EnumMonikerImpl *enum_moniker) +{ + GUID clsid; + + if (IsEqualGUID(&enum_moniker->class, &CLSID_LegacyAmFilterCategory)) + { + if (enum_moniker->dmo_enum && IEnumDMO_Next(enum_moniker->dmo_enum, 1, &clsid, NULL, NULL) == S_OK) + return dmo_moniker_create(DMOCATEGORY_AUDIO_DECODER, clsid); + if (enum_moniker->dmo_enum2 && IEnumDMO_Next(enum_moniker->dmo_enum2, 1, &clsid, NULL, NULL) == S_OK) + return dmo_moniker_create(DMOCATEGORY_VIDEO_DECODER, clsid); + } + else + { + if (enum_moniker->dmo_enum && IEnumDMO_Next(enum_moniker->dmo_enum, 1, &clsid, NULL, NULL) == S_OK) + return dmo_moniker_create(enum_moniker->class, clsid); + } + + return NULL; +} + static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched) { @@ -804,8 +827,6 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike struct moniker *moniker; LONG res; ULONG fetched = 0; - HRESULT hr; - GUID clsid; HKEY hkey;
TRACE("(%p)->(%d, %p, %p)\n", iface, celt, rgelt, pceltFetched); @@ -815,10 +836,8 @@ static HRESULT WINAPI enum_moniker_Next(IEnumMoniker *iface, ULONG celt, IMonike /* FIXME: try PNP devices first */
/* try DMOs */ - if ((hr = IEnumDMO_Next(This->dmo_enum, 1, &clsid, NULL, NULL)) == S_OK) - { - moniker = dmo_moniker_create(This->class, clsid); - } + if ((moniker = get_dmo_moniker(This))) + ; /* try DirectShow filters */ else if (!(res = RegEnumKeyW(This->sw_key, This->sw_index, buffer, ARRAY_SIZE(buffer)))) { @@ -869,7 +888,9 @@ static HRESULT WINAPI enum_moniker_Skip(IEnumMoniker *iface, ULONG celt) /* FIXME: try PNP devices first */
/* try DMOs */ - if (IEnumDMO_Skip(This->dmo_enum, 1) == S_OK) + if (This->dmo_enum && IEnumDMO_Skip(This->dmo_enum, 1) == S_OK) + ; + else if (This->dmo_enum2 && IEnumDMO_Skip(This->dmo_enum2, 1) == S_OK) ; /* try DirectShow filters */ else if (RegEnumKeyW(This->sw_key, This->sw_index, NULL, 0) != ERROR_NO_MORE_ITEMS) @@ -894,7 +915,10 @@ static HRESULT WINAPI enum_moniker_Reset(IEnumMoniker *iface)
TRACE("(%p)->()\n", iface);
- IEnumDMO_Reset(This->dmo_enum); + if (This->dmo_enum) + IEnumDMO_Reset(This->dmo_enum); + if (This->dmo_enum2) + IEnumDMO_Reset(This->dmo_enum2); This->sw_index = 0; This->cm_index = 0;
@@ -926,7 +950,6 @@ HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **out) { EnumMonikerImpl *object; WCHAR buffer[78]; - HRESULT hr;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -947,15 +970,17 @@ HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **out) if (RegOpenKeyExW(HKEY_CURRENT_USER, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &object->cm_key)) object->cm_key = NULL;
- hr = DMOEnum(class, 0, 0, NULL, 0, NULL, &object->dmo_enum); - if (FAILED(hr)) + if (IsEqualGUID(class, &CLSID_LegacyAmFilterCategory)) { - if (object->cm_key) - RegCloseKey(object->cm_key); - if (object->sw_key) - RegCloseKey(object->sw_key); - free(object); - return hr; + if (FAILED(DMOEnum(&DMOCATEGORY_AUDIO_DECODER, 0, 0, NULL, 0, NULL, &object->dmo_enum))) + object->dmo_enum = NULL; + if (FAILED(DMOEnum(&DMOCATEGORY_VIDEO_DECODER, 0, 0, NULL, 0, NULL, &object->dmo_enum2))) + object->dmo_enum2 = NULL; + } + else + { + if (FAILED(DMOEnum(class, 0, 0, NULL, 0, NULL, &object->dmo_enum))) + object->dmo_enum = NULL; }
*out = &object->IEnumMoniker_iface; diff --git a/dlls/devenum/tests/devenum.c b/dlls/devenum/tests/devenum.c index 93692f75e62..3e0d6f57dc3 100644 --- a/dlls/devenum/tests/devenum.c +++ b/dlls/devenum/tests/devenum.c @@ -245,16 +245,18 @@ static BOOL find_moniker(const GUID *class, IMoniker *needle) BOOL found = FALSE;
CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, &IID_ICreateDevEnum, (void **)&devenum); - ICreateDevEnum_CreateClassEnumerator(devenum, class, &enum_mon, 0); - while (!found && IEnumMoniker_Next(enum_mon, 1, &mon, NULL) == S_OK) + if (ICreateDevEnum_CreateClassEnumerator(devenum, class, &enum_mon, 0) == S_OK) { - if (IMoniker_IsEqual(mon, needle) == S_OK) - found = TRUE; + while (!found && IEnumMoniker_Next(enum_mon, 1, &mon, NULL) == S_OK) + { + if (IMoniker_IsEqual(mon, needle) == S_OK) + found = TRUE;
- IMoniker_Release(mon); - } + IMoniker_Release(mon); + }
- IEnumMoniker_Release(enum_mon); + IEnumMoniker_Release(enum_mon); + } ICreateDevEnum_Release(devenum); return found; } @@ -594,7 +596,7 @@ static void test_codec(void) IParseDisplayName_Release(parser); }
-static void test_dmo(void) +static void test_dmo(const GUID *dmo_category, const GUID *enum_category) { IParseDisplayName *parser; IPropertyBag *prop_bag; @@ -613,10 +615,10 @@ static void test_dmo(void)
wcscpy(buffer, L"@device:dmo:"); StringFromGUID2(&CLSID_TestFilter, buffer + wcslen(buffer), CHARS_IN_GUID); - StringFromGUID2(&CLSID_AudioRendererCategory, buffer + wcslen(buffer), CHARS_IN_GUID); + StringFromGUID2(dmo_category, buffer + wcslen(buffer), CHARS_IN_GUID); mon = check_display_name(parser, buffer);
- ok(!find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should not be registered\n"); + ok(!find_moniker(enum_category, mon), "DMO should not be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag); ok(hr == S_OK, "got %#x\n", hr); @@ -630,12 +632,12 @@ static void test_dmo(void) hr = IPropertyBag_Write(prop_bag, L"FriendlyName", &var); ok(hr == E_ACCESSDENIED, "Write failed: %#x\n", hr);
- hr = DMORegister(L"devenum test", &CLSID_TestFilter, &CLSID_AudioRendererCategory, 0, 0, NULL, 0, NULL); + hr = DMORegister(L"devenum test", &CLSID_TestFilter, dmo_category, 0, 0, NULL, 0, NULL); if (hr != E_FAIL) { ok(hr == S_OK, "got %#x\n", hr);
- ok(find_moniker(&CLSID_AudioRendererCategory, mon), "DMO should be registered\n"); + ok(find_moniker(enum_category, mon), "DMO should be registered\n");
VariantClear(&var); hr = IPropertyBag_Read(prop_bag, L"FriendlyName", &var, NULL); @@ -652,7 +654,7 @@ static void test_dmo(void) hr = IPropertyBag_Read(prop_bag, L"CLSID", &var, NULL); ok(hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "got %#x\n", hr);
- hr = DMOUnregister(&CLSID_TestFilter, &CLSID_AudioRendererCategory); + hr = DMOUnregister(&CLSID_TestFilter, dmo_category); ok(hr == S_OK, "got %#x\n", hr); } IPropertyBag_Release(prop_bag); @@ -1168,7 +1170,9 @@ START_TEST(devenum) test_register_filter(); test_directshow_filter(); test_codec(); - test_dmo(); + test_dmo(&DMOCATEGORY_AUDIO_DECODER, &CLSID_LegacyAmFilterCategory); + test_dmo(&DMOCATEGORY_VIDEO_DECODER, &CLSID_LegacyAmFilterCategory); + test_dmo(&DMOCATEGORY_VIDEO_DECODER, &DMOCATEGORY_VIDEO_DECODER);
test_legacy_filter(); hr = DirectSoundEnumerateW(test_dsound, NULL);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 89 ++++++++++++--------------------- dlls/devenum/devenum_main.c | 28 ++++------- dlls/devenum/devenum_private.h | 16 ------ dlls/devenum/mediacatenum.c | 38 +++++++------- dlls/devenum/parsedisplayname.c | 8 +-- 5 files changed, 62 insertions(+), 117 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index 866b8d8a60d..a3b9447144a 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -40,17 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
-static const WCHAR wszFilterKeyName[] = {'F','i','l','t','e','r',0}; -static const WCHAR wszMeritName[] = {'M','e','r','i','t',0}; -static const WCHAR wszPins[] = {'P','i','n','s',0}; -static const WCHAR wszAllowedMany[] = {'A','l','l','o','w','e','d','M','a','n','y',0}; -static const WCHAR wszAllowedZero[] = {'A','l','l','o','w','e','d','Z','e','r','o',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 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 HRESULT WINAPI devenum_factory_QueryInterface(ICreateDevEnum *iface, REFIID riid, void **ppv) { TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); @@ -92,7 +81,6 @@ static ULONG WINAPI devenum_factory_Release(ICreateDevEnum *iface) static HRESULT register_codec(const GUID *class, const WCHAR *name, const GUID *clsid, const WCHAR *friendly_name, IPropertyBag **ret) { - static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':','c','m',':',0}; WCHAR guidstr[CHARS_IN_GUID]; IParseDisplayName *parser; IPropertyBag *propbag; @@ -106,17 +94,16 @@ static HRESULT register_codec(const GUID *class, const WCHAR *name, if (FAILED(hr)) return hr;
- buffer = heap_alloc((lstrlenW(deviceW) + CHARS_IN_GUID + lstrlenW(name) + 1) * sizeof(WCHAR)); - if (!buffer) + if (!(buffer = heap_alloc((wcslen(L"@device:cm:") + CHARS_IN_GUID + wcslen(name) + 1) * sizeof(WCHAR)))) { IParseDisplayName_Release(parser); return E_OUTOFMEMORY; }
- lstrcpyW(buffer, deviceW); - StringFromGUID2(class, buffer + lstrlenW(buffer), CHARS_IN_GUID); - lstrcatW(buffer, backslashW); - lstrcatW(buffer, name); + wcscpy(buffer, L"@device:cm:"); + StringFromGUID2(class, buffer + wcslen(buffer), CHARS_IN_GUID); + wcscat(buffer, L"\"); + wcscat(buffer, name);
IParseDisplayName_ParseDisplayName(parser, NULL, buffer, &eaten, &mon); IParseDisplayName_Release(parser); @@ -127,7 +114,7 @@ static HRESULT register_codec(const GUID *class, const WCHAR *name,
V_VT(&var) = VT_BSTR; V_BSTR(&var) = SysAllocString(friendly_name); - hr = IPropertyBag_Write(propbag, wszFriendlyName, &var); + hr = IPropertyBag_Write(propbag, L"FriendlyName", &var); VariantClear(&var); if (FAILED(hr)) { @@ -138,7 +125,7 @@ static HRESULT register_codec(const GUID *class, const WCHAR *name, V_VT(&var) = VT_BSTR; StringFromGUID2(clsid, guidstr, ARRAY_SIZE(guidstr)); V_BSTR(&var) = SysAllocString(guidstr); - hr = IPropertyBag_Write(propbag, clsidW, &var); + hr = IPropertyBag_Write(propbag, L"CLSID", &var); VariantClear(&var); if (FAILED(hr)) { @@ -157,7 +144,7 @@ static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS2 *rgPin) REGPINTYPES *lpMediaType = NULL; DWORD dwMediaTypeSize = 0;
- if (RegOpenKeyExW(hkeyPinKey, wszTypes, 0, KEY_READ, &hkeyTypes) != ERROR_SUCCESS) + if (RegOpenKeyExW(hkeyPinKey, L"Types", 0, KEY_READ, &hkeyTypes) != ERROR_SUCCESS) return ;
if (RegQueryInfoKeyW(hkeyTypes, NULL, NULL, NULL, &dwMajorTypes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) @@ -253,7 +240,7 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2) rgf2->u.s2.cPins2 = 0; rgf2->u.s2.rgPins2 = NULL;
- if (RegOpenKeyExW(hkeyFilterClass, wszPins, 0, KEY_READ, &hkeyPins) != ERROR_SUCCESS) + if (RegOpenKeyExW(hkeyFilterClass, L"Pins", 0, KEY_READ, &hkeyPins) != ERROR_SUCCESS) return ;
if (RegQueryInfoKeyW(hkeyPins, NULL, NULL, NULL, &dwPinsSubkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) @@ -289,21 +276,21 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2) if (RegOpenKeyExW(hkeyPins, wszPinName, 0, KEY_READ, &hkeyPinKey) != ERROR_SUCCESS) continue;
size = sizeof(DWORD); - lRet = RegQueryValueExW(hkeyPinKey, wszAllowedMany, NULL, &Type, (BYTE *)&value, &size); + lRet = RegQueryValueExW(hkeyPinKey, L"AllowedMany", NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; if (value) rgPin->dwFlags |= REG_PINFLAG_B_MANY;
size = sizeof(DWORD); - lRet = RegQueryValueExW(hkeyPinKey, wszAllowedZero, NULL, &Type, (BYTE *)&value, &size); + lRet = RegQueryValueExW(hkeyPinKey, L"AllowedZero", NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; if (value) rgPin->dwFlags |= REG_PINFLAG_B_ZERO;
size = sizeof(DWORD); - lRet = RegQueryValueExW(hkeyPinKey, wszDirection, NULL, &Type, (BYTE *)&value, &size); + lRet = RegQueryValueExW(hkeyPinKey, L"Direction", NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; if (value) @@ -311,7 +298,7 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2)
size = sizeof(DWORD); - lRet = RegQueryValueExW(hkeyPinKey, wszIsRendered, NULL, &Type, (BYTE *)&value, &size); + lRet = RegQueryValueExW(hkeyPinKey, L"IsRendered", NULL, &Type, (BYTE *)&value, &size); if (lRet != ERROR_SUCCESS || Type != REG_DWORD) goto error_cleanup; if (value) @@ -391,7 +378,7 @@ static void write_filter_data(IPropertyBag *prop_bag, REGFILTER2 *rgf) hr = SafeArrayUnaccessData(V_ARRAY(&var)); if (FAILED(hr)) goto cleanup;
- hr = IPropertyBag_Write(prop_bag, wszFilterData, &var); + hr = IPropertyBag_Write(prop_bag, L"FilterData", &var); if (FAILED(hr)) goto cleanup;
cleanup: @@ -407,7 +394,7 @@ static void register_legacy_filters(void) LONG lRet; HRESULT hr;
- lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszFilterKeyName, 0, KEY_READ, &hkeyFilter); + lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Filter", 0, KEY_READ, &hkeyFilter); hr = HRESULT_FROM_WIN32(lRet);
if (SUCCEEDED(hr)) @@ -437,10 +424,7 @@ static void register_legacy_filters(void) if (FAILED(hr)) continue;
- lstrcpyW(wszRegKey, clsidW); - lstrcatW(wszRegKey, backslashW); - lstrcatW(wszRegKey, wszFilterSubkeyName); - + swprintf(wszRegKey, ARRAY_SIZE(wszRegKey), L"CLSID\%s", wszFilterSubkeyName); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszRegKey, 0, KEY_READ, &classkey) != ERROR_SUCCESS) continue;
@@ -473,7 +457,7 @@ static void register_legacy_filters(void) rgf2.dwMerit = MERIT_NORMAL;
len = sizeof(rgf2.dwMerit); - RegQueryValueExW(classkey, wszMeritName, NULL, &Type, (BYTE *)&rgf2.dwMerit, &len); + RegQueryValueExW(classkey, L"Merit", NULL, &Type, (BYTE *)&rgf2.dwMerit, &len);
DEVENUM_ReadPins(classkey, &rgf2);
@@ -490,9 +474,7 @@ static void register_legacy_filters(void)
static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, const WCHAR *module, void *context) { - static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','D','i','r','e','c','t','S','o','u','n','d',' ','D','e','v','i','c','e',0}; - static const WCHAR directsoundW[] = {'D','i','r','e','c','t','S','o','u','n','d',':',' ',0}; - static const WCHAR dsguidW[] = {'D','S','G','u','i','d',0}; + static const WCHAR defaultW[] = L"Default DirectSound Device"; IPropertyBag *prop_bag = NULL; REGFILTERPINS2 rgpins = {0}; REGPINTYPES rgtypes = {0}; @@ -503,11 +485,11 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons
if (guid) { - WCHAR *name = heap_alloc(sizeof(defaultW) + lstrlenW(desc) * sizeof(WCHAR)); + WCHAR *name = heap_alloc(sizeof(defaultW) + wcslen(desc) * sizeof(WCHAR)); if (!name) return FALSE; - lstrcpyW(name, directsoundW); - lstrcatW(name, desc); + wcscpy(name, L"DirectSound: "); + wcscat(name, desc);
hr = register_codec(&CLSID_AudioRendererCategory, name, &CLSID_DSoundRender, name, &prop_bag); @@ -537,7 +519,7 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons V_VT(&var) = VT_BSTR; StringFromGUID2(guid ? guid : &GUID_NULL, clsid, CHARS_IN_GUID); if ((V_BSTR(&var) = SysAllocString(clsid))) - hr = IPropertyBag_Write(prop_bag, dsguidW, &var); + hr = IPropertyBag_Write(prop_bag, L"DSGuid", &var);
VariantClear(&var); IPropertyBag_Release(prop_bag); @@ -546,8 +528,6 @@ static BOOL CALLBACK register_dsound_devices(GUID *guid, const WCHAR *desc, cons
static void register_waveout_devices(void) { - static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','W','a','v','e','O','u','t',' ','D','e','v','i','c','e',0}; - static const WCHAR waveoutidW[] = {'W','a','v','e','O','u','t','I','d',0}; IPropertyBag *prop_bag = NULL; REGFILTERPINS2 rgpins = {0}; REGPINTYPES rgtypes = {0}; @@ -564,7 +544,7 @@ static void register_waveout_devices(void) { waveOutGetDevCapsW(i, &caps, sizeof(caps));
- name = (i == -1) ? defaultW : caps.szPname; + name = (i == -1) ? L"Default WaveOut Device" : caps.szPname;
hr = register_codec(&CLSID_AudioRendererCategory, name, &CLSID_AudioRender, name, &prop_bag); @@ -587,7 +567,7 @@ static void register_waveout_devices(void) /* write WaveOutId */ V_VT(&var) = VT_I4; V_I4(&var) = i; - IPropertyBag_Write(prop_bag, waveoutidW, &var); + IPropertyBag_Write(prop_bag, L"WaveOutId", &var);
VariantClear(&var); if (prop_bag) IPropertyBag_Release(prop_bag); @@ -596,7 +576,6 @@ static void register_waveout_devices(void)
static void register_wavein_devices(void) { - static const WCHAR waveinidW[] = {'W','a','v','e','I','n','I','d',0}; IPropertyBag *prop_bag = NULL; REGFILTER2 rgf = {0}; WAVEINCAPSW caps; @@ -624,7 +603,7 @@ static void register_wavein_devices(void) /* write WaveInId */ V_VT(&var) = VT_I4; V_I4(&var) = i; - IPropertyBag_Write(prop_bag, waveinidW, &var); + IPropertyBag_Write(prop_bag, L"WaveInId", &var);
VariantClear(&var); IPropertyBag_Release(prop_bag); @@ -633,8 +612,6 @@ static void register_wavein_devices(void)
static void register_midiout_devices(void) { - static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',' ','M','i','d','i','O','u','t',' ','D','e','v','i','c','e',0}; - static const WCHAR midioutidW[] = {'M','i','d','i','O','u','t','I','d',0}; IPropertyBag *prop_bag = NULL; REGFILTERPINS2 rgpins = {0}; REGPINTYPES rgtypes = {0}; @@ -651,7 +628,7 @@ static void register_midiout_devices(void) { midiOutGetDevCapsW(i, &caps, sizeof(caps));
- name = (i == -1) ? defaultW : caps.szPname; + name = (i == -1) ? L"Default MidiOut Device" : caps.szPname;
hr = register_codec(&CLSID_MidiRendererCategory, name, &CLSID_AVIMIDIRender, name, &prop_bag); @@ -674,7 +651,7 @@ static void register_midiout_devices(void) /* write MidiOutId */ V_VT(&var) = VT_I4; V_I4(&var) = i; - IPropertyBag_Write(prop_bag, midioutidW, &var); + IPropertyBag_Write(prop_bag, L"MidiOutId", &var);
VariantClear(&var); IPropertyBag_Release(prop_bag); @@ -683,7 +660,6 @@ static void register_midiout_devices(void)
static void register_vfw_codecs(void) { - static const WCHAR fcchandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0}; REGFILTERPINS2 rgpins[2] = {}; IPropertyBag *prop_bag = NULL; REGPINTYPES rgtypes[2]; @@ -732,7 +708,7 @@ static void register_vfw_codecs(void) /* write WaveInId */ V_VT(&var) = VT_BSTR; V_BSTR(&var) = SysAllocString(name); - IPropertyBag_Write(prop_bag, fcchandlerW, &var); + IPropertyBag_Write(prop_bag, L"FccHandler", &var);
VariantClear(&var); IPropertyBag_Release(prop_bag); @@ -741,13 +717,12 @@ static void register_vfw_codecs(void)
static void register_avicap_devices(void) { - static const WCHAR vfwindexW[] = {'V','F','W','I','n','d','e','x',0}; - WCHAR name[] = {'v','i','d','e','o','0',0}; WCHAR friendlyname[32], version[32]; IPropertyBag *prop_bag = NULL; REGFILTERPINS2 rgpins = {0}; REGPINTYPES rgtypes; REGFILTER2 rgf; + WCHAR name[6]; VARIANT var; HRESULT hr; int i = 0; @@ -758,7 +733,7 @@ static void register_avicap_devices(void) version, ARRAY_SIZE(version))) continue;
- name[5] = '0' + i; + swprintf(name, ARRAY_SIZE(name), L"video%d", i);
hr = register_codec(&CLSID_VideoInputDeviceCategory, name, &CLSID_VfwCapture, friendlyname, &prop_bag); @@ -780,7 +755,7 @@ static void register_avicap_devices(void) /* write VFWIndex */ V_VT(&var) = VT_I4; V_I4(&var) = i; - IPropertyBag_Write(prop_bag, vfwindexW, &var); + IPropertyBag_Write(prop_bag, L"VFWIndex", &var);
VariantClear(&var); IPropertyBag_Release(prop_bag); @@ -801,7 +776,7 @@ static HRESULT WINAPI devenum_factory_CreateClassEnumerator(ICreateDevEnum *ifac
*out = NULL;
- if (!RegOpenKeyW(HKEY_CURRENT_USER, wszActiveMovieKey, &key)) + if (!RegOpenKeyW(HKEY_CURRENT_USER, L"Software\Microsoft\ActiveMovie\devenum", &key)) { StringFromGUID2(class, guidstr, ARRAY_SIZE(guidstr)); RegDeleteTreeW(key, guidstr); diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c index d8b0f2cf692..01ddef4ef23 100644 --- a/dlls/devenum/devenum_main.c +++ b/dlls/devenum/devenum_main.c @@ -162,27 +162,17 @@ HRESULT WINAPI DllRegisterServer(void) &IID_IFilterMapper2, &mapvptr); if (SUCCEEDED(res)) { - static const WCHAR friendlyvidcap[] = {'V','i','d','e','o',' ','C','a','p','t','u','r','e',' ','S','o','u','r','c','e','s',0}; - static const WCHAR friendlydshow[] = {'D','i','r','e','c','t','S','h','o','w',' ','F','i','l','t','e','r','s',0}; - static const WCHAR friendlyvidcomp[] = {'V','i','d','e','o',' ','C','o','m','p','r','e','s','s','o','r','s',0}; - static const WCHAR friendlyaudcap[] = {'A','u','d','i','o',' ','C','a','p','t','u','r','e',' ','S','o','u','r','c','e','s',0}; - static const WCHAR friendlyaudcomp[] = {'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','o','r','s',0}; - static const WCHAR friendlyaudrend[] = {'A','u','d','i','o',' ','R','e','n','d','e','r','e','r','s',0}; - static const WCHAR friendlymidirend[] = {'M','i','d','i',' ','R','e','n','d','e','r','e','r','s',0}; - static const WCHAR friendlyextrend[] = {'E','x','t','e','r','n','a','l',' ','R','e','n','d','e','r','e','r','s',0}; - static const WCHAR friendlydevctrl[] = {'D','e','v','i','c','e',' ','C','o','n','t','r','o','l',' ','F','i','l','t','e','r','s',0}; - pMapper = mapvptr;
- IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoInputDeviceCategory, MERIT_DO_NOT_USE, friendlyvidcap); - IFilterMapper2_CreateCategory(pMapper, &CLSID_LegacyAmFilterCategory, MERIT_NORMAL, friendlydshow); - IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoCompressorCategory, MERIT_DO_NOT_USE, friendlyvidcomp); - IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioInputDeviceCategory, MERIT_DO_NOT_USE, friendlyaudcap); - IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioCompressorCategory, MERIT_DO_NOT_USE, friendlyaudcomp); - IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioRendererCategory, MERIT_NORMAL, friendlyaudrend); - IFilterMapper2_CreateCategory(pMapper, &CLSID_MidiRendererCategory, MERIT_NORMAL, friendlymidirend); - IFilterMapper2_CreateCategory(pMapper, &CLSID_TransmitCategory, MERIT_DO_NOT_USE, friendlyextrend); - IFilterMapper2_CreateCategory(pMapper, &CLSID_DeviceControlCategory, MERIT_DO_NOT_USE, friendlydevctrl); + IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioCompressorCategory, MERIT_DO_NOT_USE, L"Audio Compressors"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioInputDeviceCategory, MERIT_DO_NOT_USE, L"Audio Capture Sources"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_AudioRendererCategory, MERIT_NORMAL, L"Audio Renderers"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_DeviceControlCategory, MERIT_DO_NOT_USE, L"Device Control Filters"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_LegacyAmFilterCategory, MERIT_NORMAL, L"DirectShow Filters"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_MidiRendererCategory, MERIT_NORMAL, L"Midi Renderers"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_TransmitCategory, MERIT_DO_NOT_USE, L"External Renderers"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoInputDeviceCategory, MERIT_DO_NOT_USE, L"Video Capture Sources"); + IFilterMapper2_CreateCategory(pMapper, &CLSID_VideoCompressorCategory, MERIT_DO_NOT_USE, L"Video Compressors");
IFilterMapper2_Release(pMapper); } diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index 6bd3c7cac4f..bd018a42a01 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -61,19 +61,3 @@ HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **enum_mon) DECLSPEC_HI
extern ICreateDevEnum devenum_factory DECLSPEC_HIDDEN; extern IParseDisplayName devenum_parser DECLSPEC_HIDDEN; - -/********************************************************************** - * Global string constant declarations - */ - -static const WCHAR backslashW[] = {'\',0}; -static const WCHAR clsidW[] = {'C','L','S','I','D',0}; -static const WCHAR instanceW[] = {'\','I','n','s','t','a','n','c','e',0}; -static const WCHAR wszActiveMovieKey[] = {'S','o','f','t','w','a','r','e','\', - 'M','i','c','r','o','s','o','f','t','\', - 'A','c','t','i','v','e','M','o','v','i','e','\', - 'd','e','v','e','n','u','m','\',0}; -static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':',0}; -static const WCHAR dmoW[] = {'d','m','o',':',0}; -static const WCHAR swW[] = {'s','w',':',0}; -static const WCHAR cmW[] = {'c','m',':',0}; diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 6f0209f39b1..85634ead1ad 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -524,7 +524,7 @@ static HRESULT WINAPI moniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker if (SUCCEEDED(IMoniker_GetDisplayName(iface, bind, NULL, &this_name)) && SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker, bind, NULL, &other_name))) { - int result = lstrcmpiW(this_name, other_name); + int result = wcsicmp(this_name, other_name); CoTaskMemFree(this_name); CoTaskMemFree(other_name); if (!result) @@ -603,33 +603,30 @@ static HRESULT WINAPI moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
if (This->type == DEVICE_DMO) { - buffer = CoTaskMemAlloc((lstrlenW(deviceW) + lstrlenW(dmoW) - + 2 * CHARS_IN_GUID + 1) * sizeof(WCHAR)); + buffer = CoTaskMemAlloc((12 + 2 * CHARS_IN_GUID + 1) * sizeof(WCHAR)); if (!buffer) return E_OUTOFMEMORY;
- lstrcpyW(buffer, deviceW); - lstrcatW(buffer, dmoW); - StringFromGUID2(&This->clsid, buffer + lstrlenW(buffer), CHARS_IN_GUID); - StringFromGUID2(&This->class, buffer + lstrlenW(buffer), CHARS_IN_GUID); + wcscpy(buffer, L"@device:dmo:"); + StringFromGUID2(&This->clsid, buffer + wcslen(buffer), CHARS_IN_GUID); + StringFromGUID2(&This->class, buffer + wcslen(buffer), CHARS_IN_GUID); } else { - buffer = CoTaskMemAlloc((lstrlenW(deviceW) + 3 + (This->has_class ? CHARS_IN_GUID : 0) - + lstrlenW(This->name) + 1) * sizeof(WCHAR)); + buffer = CoTaskMemAlloc((11 + (This->has_class ? CHARS_IN_GUID : 0) + + wcslen(This->name) + 1) * sizeof(WCHAR)); if (!buffer) return E_OUTOFMEMORY;
- lstrcpyW(buffer, deviceW); if (This->type == DEVICE_FILTER) - lstrcatW(buffer, swW); + wcscpy(buffer, L"@device:sw:"); else if (This->type == DEVICE_CODEC) - lstrcatW(buffer, cmW); + wcscpy(buffer, L"@device:cm:");
if (This->has_class) { - StringFromGUID2(&This->class, buffer + lstrlenW(buffer), CHARS_IN_GUID); - lstrcatW(buffer, backslashW); + StringFromGUID2(&This->class, buffer + wcslen(buffer), CHARS_IN_GUID); + wcscat(buffer, L"\"); } - lstrcatW(buffer, This->name); + wcscat(buffer, This->name); }
*ppszDisplayName = buffer; @@ -958,15 +955,14 @@ HRESULT enum_moniker_create(REFCLSID class, IEnumMoniker **out) object->ref = 1; object->class = *class;
- lstrcpyW(buffer, clsidW); - lstrcatW(buffer, backslashW); - StringFromGUID2(class, buffer + lstrlenW(buffer), CHARS_IN_GUID); - lstrcatW(buffer, instanceW); + wcscpy(buffer, L"CLSID\"); + StringFromGUID2(class, buffer + wcslen(buffer), CHARS_IN_GUID); + wcscat(buffer, L"\Instance"); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &object->sw_key)) object->sw_key = NULL;
- lstrcpyW(buffer, wszActiveMovieKey); - StringFromGUID2(class, buffer + lstrlenW(buffer), CHARS_IN_GUID); + wcscpy(buffer, L"Software\Microsoft\ActiveMovie\devenum\"); + StringFromGUID2(class, buffer + wcslen(buffer), CHARS_IN_GUID); if (RegOpenKeyExW(HKEY_CURRENT_USER, buffer, 0, KEY_ENUMERATE_SUB_KEYS, &object->cm_key)) object->cm_key = NULL;
diff --git a/dlls/devenum/parsedisplayname.c b/dlls/devenum/parsedisplayname.c index 45a89f69932..f24b4329c80 100644 --- a/dlls/devenum/parsedisplayname.c +++ b/dlls/devenum/parsedisplayname.c @@ -77,21 +77,21 @@ static HRESULT WINAPI devenum_parser_ParseDisplayName(IParseDisplayName *iface,
*ret = NULL; if (eaten) - *eaten = lstrlenW(name); + *eaten = wcslen(name);
name = wcschr(name, ':') + 1;
- if (!wcsncmp(name, swW, 3)) + if (!wcsncmp(name, L"sw:", 3)) { type = DEVICE_FILTER; name += 3; } - else if (!wcsncmp(name, cmW, 3)) + else if (!wcsncmp(name, L"cm:", 3)) { type = DEVICE_CODEC; name += 3; } - else if (!wcsncmp(name, dmoW, 4)) + else if (!wcsncmp(name, L"dmo:", 4)) { type = DEVICE_DMO; name += 4;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/devenum/createdevenum.c | 48 ++++++++++-------- dlls/devenum/devenum_private.h | 1 + dlls/devenum/mediacatenum.c | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 22 deletions(-)
diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index a3b9447144a..c72bb683f96 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -351,40 +351,44 @@ static void free_regfilter2(REGFILTER2 *rgf) } }
-static void write_filter_data(IPropertyBag *prop_bag, REGFILTER2 *rgf) +HRESULT create_filter_data(VARIANT *var, REGFILTER2 *rgf) { - BYTE *data = NULL, *array; IAMFilterData *fildata; - SAFEARRAYBOUND sabound; - VARIANT var = {}; + BYTE *data = NULL; ULONG size; HRESULT hr;
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IAMFilterData, (void **)&fildata); - if (FAILED(hr)) goto cleanup; + if (FAILED(hr)) + return hr;
hr = IAMFilterData_CreateFilterData(fildata, rgf, &data, &size); - if (FAILED(hr)) goto cleanup; + IAMFilterData_Release(fildata); + if (FAILED(hr)) + return hr;
- V_VT(&var) = VT_ARRAY | VT_UI1; - sabound.lLbound = 0; - sabound.cElements = size; - if (!(V_ARRAY(&var) = SafeArrayCreate(VT_UI1, 1, &sabound))) - goto cleanup; - hr = SafeArrayAccessData(V_ARRAY(&var), (void *)&array); - if (FAILED(hr)) goto cleanup; + V_VT(var) = VT_ARRAY | VT_UI1; + if (!(V_ARRAY(var) = SafeArrayCreateVector(VT_UI1, 1, size))) + { + VariantClear(var); + CoTaskMemFree(data); + return E_OUTOFMEMORY; + }
- memcpy(array, data, size); - hr = SafeArrayUnaccessData(V_ARRAY(&var)); - if (FAILED(hr)) goto cleanup; + memcpy(V_ARRAY(var)->pvData, data, size); + CoTaskMemFree(data); + return S_OK; +}
- hr = IPropertyBag_Write(prop_bag, L"FilterData", &var); - if (FAILED(hr)) goto cleanup; +static void write_filter_data(IPropertyBag *prop_bag, REGFILTER2 *rgf) +{ + VARIANT var;
-cleanup: - VariantClear(&var); - CoTaskMemFree(data); - IAMFilterData_Release(fildata); + if (SUCCEEDED(create_filter_data(&var, rgf))) + { + IPropertyBag_Write(prop_bag, L"FilterData", &var); + VariantClear(&var); + } }
static void register_legacy_filters(void) diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index bd018a42a01..15c41afd570 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -54,6 +54,7 @@ struct moniker IPropertyBag IPropertyBag_iface; };
+HRESULT create_filter_data(VARIANT *var, REGFILTER2 *rgf) 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; diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 85634ead1ad..16b729ab1fd 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -28,6 +28,35 @@
WINE_DEFAULT_DEBUG_CHANNEL(devenum);
+BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size) +{ + unsigned int max_capacity, new_capacity; + void *new_elements; + + if (count <= *capacity) + return TRUE; + + max_capacity = ~0u / size; + if (count > max_capacity) + return FALSE; + + new_capacity = max(8, *capacity); + while (new_capacity < count && new_capacity <= max_capacity / 2) + new_capacity *= 2; + if (new_capacity < count) + new_capacity = count; + + if (!(new_elements = realloc(*elements, new_capacity * size))) + { + ERR("Failed to allocate memory.\n"); + return FALSE; + } + + *elements = new_elements; + *capacity = new_capacity; + return TRUE; +} + typedef struct { IEnumMoniker IEnumMoniker_iface; @@ -106,6 +135,70 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, } return hr; } + else if (!wcscmp(name, L"FilterData")) + { + REGFILTERPINS2 reg_pins[2] = {{0}}; + REGFILTER2 reg_filter = + { + .dwVersion = 2, + .dwMerit = MERIT_NORMAL + 0x800, + .cPins2 = 2, + .rgPins2 = reg_pins, + }; + + unsigned int count = 1, input_count, output_count, i; + DMO_PARTIAL_MEDIATYPE *types = NULL; + REGPINTYPES *reg_types; + HRESULT hr; + + if (!(types = malloc(2 * count * sizeof(*types)))) + return E_OUTOFMEMORY; + + while ((hr = DMOGetTypes(&moniker->clsid, count, &input_count, types, + count, &output_count, types + count)) == S_FALSE) + { + count *= 2; + if (!(types = realloc(types, count * sizeof(*types)))) + { + free(types); + return E_OUTOFMEMORY; + } + } + if (hr != S_OK) + { + free(types); + return hr; + } + + if (!(reg_types = malloc(2 * count * sizeof(*reg_types)))) + { + free(types); + return hr; + } + + for (i = 0; i < input_count; ++i) + { + reg_types[i].clsMajorType = &types[i].type; + reg_types[i].clsMinorType = &types[i].subtype; + } + for (i = 0; i < output_count; ++i) + { + reg_types[count + i].clsMajorType = &types[count + i].type; + reg_types[count + i].clsMinorType = &types[count + i].subtype; + } + reg_pins[0].cInstances = 1; + reg_pins[0].nMediaTypes = input_count; + reg_pins[0].lpMediaType = reg_types; + reg_pins[1].dwFlags = REG_PINFLAG_B_OUTPUT; + reg_pins[1].cInstances = 1; + reg_pins[1].nMediaTypes = output_count; + reg_pins[1].lpMediaType = reg_types + count; + + hr = create_filter_data(var, ®_filter); + free(reg_types); + free(types); + return hr; + } return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); }
Zebediah Figura z.figura12@gmail.com writes:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
dlls/devenum/createdevenum.c | 48 ++++++++++-------- dlls/devenum/devenum_private.h | 1 + dlls/devenum/mediacatenum.c | 93 ++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 22 deletions(-)
This breaks the tests:
../../../tools/runtest -q -P wine -T ../../.. -M quartz.dll -p quartz_test.exe filtermapper && touch filtermapper.ok wine: Unhandled page fault on read access to 00000000 at address 6F3C8683 (thread 0024), starting debugger... Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x6f3c8683). 00d0:fixme:dbghelp_dwarf:dwarf2_parse_const_type Unsupported children Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:6f3c8683 ESP:008dfb80 EBP:008dfbc8 EFLAGS:00010202( R- -- I - - - ) EAX:00000000 EBX:00000100 ECX:008dfb80 EDX:00000000 ESI:0121ec38 EDI:0121f178 Stack dump: 0x008dfb80: 0121f480 0121f120 00000018 6f4374d8 0x008dfb90: 0121ec38 0000000d 008dfd34 7eb1bc9f 0x008dfba0: 0121f120 0121d514 0121f158 0000000c 0x008dfbb0: 009a8398 008dfbd0 008dfcb8 0000000d 0x008dfbc0: 008dfc40 008dfc34 008dfcb8 6f3dd2a9 0x008dfbd0: 0121ec38 0000000d 008dfd34 008dfc38 Backtrace: =>0 0x6f3c8683 IEnumRegFiltersImpl_Construct+0xf3(pInRegFilters=<is not available>, size=<is not available>, ppEnum=<is not available>) [Z:\home\julliard\wine\wine\dlls\quartz....\include\winbase.h:2839] in quartz (0x008dfbc8) 1 0x6f3dd2a9 FilterMapper_EnumMatchingFilters+0x408(iface=<is not available>, ppEnum=<is not available>, dwMerit=<is not available>, bInputNeeded=<is not available>, bRender=<is not available>, bOutputNeeded=<is not available>) [Z:\home\julliard\wine\wine\dlls\quartz\filtermapper.c:1090] in quartz (0x008dfcb8) 2 0x0043d3fb func_filtermapper+0x73a() [Z:\home\julliard\wine\wine\dlls\quartz\tests......\include\strmif.h:4463] in quartz_test (0x008dfe18) 3 0x00495408 main+0x277(argc=<is not available>, argv=<is not available>) [Z:\home\julliard\wine\wine\dlls\quartz\tests......\include\wine\test.h:560] in quartz_test (0x008dfee8) 4 0x004941a6 mainCRTStartup+0x75() [Z:\home\julliard\wine\wine\dlls\msvcrt\crt_main.c:62] in quartz_test (0x008dff30) 5 0x7b449592 in kernel32 (+0x29591) (0x008dff48) 6 0x7b4499b0 in kernel32 (+0x299af) (0x008dffd8) 7 0x7b44959e in kernel32 (+0x2959d) (0x008dffec) 0x6f3c8683 IEnumRegFiltersImpl_Construct+0xf3 [Z:\home\julliard\wine\wine\dlls\quartz....\include\winbase.h:2839] in quartz: cmpw $0,0x0(%edx) 2839 while (*s) s++;