2 * IFilterMapper & IFilterMapper2 Implementations
4 * Copyright 2003 Robert Shearman
5 * Copyright 2004 Christian Costa
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define NONAMELESSUNION
23 #define NONAMELESSSTRUCT
32 #include "quartz_private.h"
37 #include "wine/unicode.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(quartz);
44 typedef struct FilterMapper2Impl
46 const IFilterMapper2Vtbl *lpVtbl;
47 const IFilterMapperVtbl *lpVtblFilterMapper;
51 static const IFilterMapper2Vtbl fm2vtbl;
52 static const IFilterMapperVtbl fmvtbl;
54 static inline FilterMapper2Impl *impl_from_IFilterMapper( IFilterMapper *iface )
56 return (FilterMapper2Impl *)((char*)iface - FIELD_OFFSET(FilterMapper2Impl, lpVtblFilterMapper));
59 static const WCHAR wszClsidSlash[] = {'C','L','S','I','D','\\',0};
60 static const WCHAR wszSlashInstance[] = {'\\','I','n','s','t','a','n','c','e','\\',0};
61 static const WCHAR wszSlash[] = {'\\',0};
63 /* CLSID property in media category Moniker */
64 static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
65 /* FriendlyName property in media category Moniker */
66 static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
67 /* Merit property in media category Moniker (CLSID_ActiveMovieCategories only) */
68 static const WCHAR wszMeritName[] = {'M','e','r','i','t',0};
69 /* FilterData property in media category Moniker (not CLSID_ActiveMovieCategories) */
70 static const WCHAR wszFilterDataName[] = {'F','i','l','t','e','r','D','a','t','a',0};
71 /* For filters registered with IFilterMapper */
72 static const WCHAR wszFilterSlash[] = {'F','i','l','t','e','r','\\',0};
73 static const WCHAR wszFilter[] = {'F','i','l','t','e','r',0};
74 /* For pins registered with IFilterMapper */
75 static const WCHAR wszPins[] = {'P','i','n','s',0};
76 static const WCHAR wszAllowedMany[] = {'A','l','l','o','w','e','d','M','a','n','y',0};
77 static const WCHAR wszAllowedZero[] = {'A','l','l','o','w','e','d','Z','e','r','o',0};
78 static const WCHAR wszDirection[] = {'D','i','r','e','c','t','i','o','n',0};
79 static const WCHAR wszIsRendered[] = {'I','s','R','e','n','d','e','r','e','d',0};
80 /* For types registered with IFilterMapper */
81 static const WCHAR wszTypes[] = {'T','y','p','e','s',0};
84 /* registry format for REGFILTER2 */
95 BYTE signature[4]; /* e.g. "0pi3" */
100 DWORD bCategory; /* is there a category clsid? */
101 /* optional: dwOffsetCategoryClsid */
106 BYTE signature[4]; /* e.g. "0ty3" */
121 int capacity; /* in bytes */
122 int current; /* pointer to next free byte */
125 /* returns the position it was added at */
126 static int add_data(struct Vector * v, const BYTE * pData, int size)
128 int index = v->current;
129 if (v->current + size > v->capacity)
131 LPBYTE pOldData = v->pData;
132 v->capacity = (v->capacity + size) * 2;
133 v->pData = CoTaskMemAlloc(v->capacity);
134 memcpy(v->pData, pOldData, v->current);
135 CoTaskMemFree(pOldData);
137 memcpy(v->pData + v->current, pData, size);
142 static int find_data(struct Vector * v, const BYTE * pData, int size)
145 for (index = 0; index < v->current; index++)
146 if (!memcmp(v->pData + index, pData, size))
152 static void delete_vector(struct Vector * v)
154 CoTaskMemFree(v->pData);
159 HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj)
161 FilterMapper2Impl * pFM2impl;
163 TRACE("(%p, %p)\n", pUnkOuter, ppObj);
166 return CLASS_E_NOAGGREGATION;
168 pFM2impl = CoTaskMemAlloc(sizeof(*pFM2impl));
170 return E_OUTOFMEMORY;
172 pFM2impl->lpVtbl = &fm2vtbl;
173 pFM2impl->lpVtblFilterMapper = &fmvtbl;
174 pFM2impl->refCount = 1;
178 TRACE("-- created at %p\n", pFM2impl);
183 HRESULT FilterMapper_create(IUnknown *pUnkOuter, LPVOID *ppObj)
185 FilterMapper2Impl *pFM2impl;
188 TRACE("(%p, %p)\n", pUnkOuter, ppObj);
190 hr = FilterMapper2_create(pUnkOuter, (LPVOID*)&pFM2impl);
194 *ppObj = &pFM2impl->lpVtblFilterMapper;
199 /*** IUnknown methods ***/
201 static HRESULT WINAPI FilterMapper2_QueryInterface(IFilterMapper2 * iface, REFIID riid, LPVOID *ppv)
203 FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
205 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
209 if (IsEqualIID(riid, &IID_IUnknown))
211 else if (IsEqualIID(riid, &IID_IFilterMapper2))
213 else if (IsEqualIID(riid, &IID_IFilterMapper))
214 *ppv = &This->lpVtblFilterMapper;
218 IUnknown_AddRef((IUnknown *)*ppv);
222 FIXME("No interface for %s\n", debugstr_guid(riid));
223 return E_NOINTERFACE;
226 static ULONG WINAPI FilterMapper2_AddRef(IFilterMapper2 * iface)
228 FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
229 ULONG refCount = InterlockedIncrement(&This->refCount);
231 TRACE("(%p)->() AddRef from %d\n", This, refCount - 1);
236 static ULONG WINAPI FilterMapper2_Release(IFilterMapper2 * iface)
238 FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
239 ULONG refCount = InterlockedDecrement(&This->refCount);
241 TRACE("(%p)->() Release from %d\n", This, refCount + 1);
251 /*** IFilterMapper2 methods ***/
253 static HRESULT WINAPI FilterMapper2_CreateCategory(
254 IFilterMapper2 * iface,
255 REFCLSID clsidCategory,
256 DWORD dwCategoryMerit,
257 LPCWSTR szDescription)
259 LPWSTR wClsidAMCat = NULL;
260 LPWSTR wClsidCategory = NULL;
261 WCHAR wszKeyName[strlenW(wszClsidSlash) + strlenW(wszSlashInstance) + (CHARS_IN_GUID-1) * 2 + 1];
266 TRACE("(%s, %x, %s)\n", debugstr_guid(clsidCategory), dwCategoryMerit, debugstr_w(szDescription));
268 hr = StringFromCLSID(&CLSID_ActiveMovieCategories, &wClsidAMCat);
272 hr = StringFromCLSID(clsidCategory, &wClsidCategory);
277 strcpyW(wszKeyName, wszClsidSlash);
278 strcatW(wszKeyName, wClsidAMCat);
279 strcatW(wszKeyName, wszSlashInstance);
280 strcatW(wszKeyName, wClsidCategory);
282 lRet = RegCreateKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
283 hr = HRESULT_FROM_WIN32(lRet);
288 lRet = RegSetValueExW(hKey, wszFriendlyName, 0, REG_SZ, (const BYTE*)szDescription, (strlenW(szDescription) + 1) * sizeof(WCHAR));
289 hr = HRESULT_FROM_WIN32(lRet);
294 lRet = RegSetValueExW(hKey, wszClsidName, 0, REG_SZ, (LPBYTE)wClsidCategory, (strlenW(wClsidCategory) + 1) * sizeof(WCHAR));
295 hr = HRESULT_FROM_WIN32(lRet);
300 lRet = RegSetValueExW(hKey, wszMeritName, 0, REG_DWORD, (LPBYTE)&dwCategoryMerit, sizeof(dwCategoryMerit));
301 hr = HRESULT_FROM_WIN32(lRet);
305 CoTaskMemFree(wClsidCategory);
306 CoTaskMemFree(wClsidAMCat);
311 static HRESULT WINAPI FilterMapper2_UnregisterFilter(
312 IFilterMapper2 * iface,
313 const CLSID *pclsidCategory,
314 const OLECHAR *szInstance,
317 WCHAR wszKeyName[MAX_PATH];
318 LPWSTR wClsidCategory = NULL;
319 LPWSTR wFilter = NULL;
322 TRACE("(%p, %s, %s)\n", pclsidCategory, debugstr_w(szInstance), debugstr_guid(Filter));
325 pclsidCategory = &CLSID_LegacyAmFilterCategory;
327 hr = StringFromCLSID(pclsidCategory, &wClsidCategory);
331 strcpyW(wszKeyName, wszClsidSlash);
332 strcatW(wszKeyName, wClsidCategory);
333 strcatW(wszKeyName, wszSlashInstance);
335 strcatW(wszKeyName, szInstance);
338 hr = StringFromCLSID(Filter, &wFilter);
340 strcatW(wszKeyName, wFilter);
346 LONG lRet = RegDeleteKeyW(HKEY_CLASSES_ROOT, wszKeyName);
347 hr = HRESULT_FROM_WIN32(lRet);
350 CoTaskMemFree(wClsidCategory);
351 CoTaskMemFree(wFilter);
356 static HRESULT FM2_WriteFriendlyName(IPropertyBag * pPropBag, LPCWSTR szName)
360 V_VT(&var) = VT_BSTR;
361 V_UNION(&var, bstrVal) = (BSTR)szName;
363 return IPropertyBag_Write(pPropBag, wszFriendlyName, &var);
366 static HRESULT FM2_WriteClsid(IPropertyBag * pPropBag, REFCLSID clsid)
368 LPWSTR wszClsid = NULL;
372 hr = StringFromCLSID(clsid, &wszClsid);
376 V_VT(&var) = VT_BSTR;
377 V_UNION(&var, bstrVal) = wszClsid;
378 hr = IPropertyBag_Write(pPropBag, wszClsidName, &var);
380 CoTaskMemFree(wszClsid);
384 static HRESULT FM2_WriteFilterData(IPropertyBag * pPropBag, const REGFILTER2 * prf2)
387 int size = sizeof(struct REG_RF);
389 struct Vector mainStore = {NULL, 0, 0};
390 struct Vector clsidStore = {NULL, 0, 0};
393 SAFEARRAYBOUND saBound;
396 rrf.dwVersion = prf2->dwVersion;
397 rrf.dwMerit = prf2->dwMerit;
398 rrf.dwPins = prf2->u.s1.cPins2;
401 add_data(&mainStore, (LPBYTE)&rrf, sizeof(rrf));
403 for (i = 0; i < prf2->u.s1.cPins2; i++)
405 size += sizeof(struct REG_RFP);
406 if (prf2->u.s1.rgPins2[i].clsPinCategory)
407 size += sizeof(DWORD);
408 size += prf2->u.s1.rgPins2[i].nMediaTypes * sizeof(struct REG_TYPE);
409 size += prf2->u.s1.rgPins2[i].nMediums * sizeof(DWORD);
412 for (i = 0; i < prf2->u.s1.cPins2; i++)
415 REGFILTERPINS2 rgPin2 = prf2->u.s1.rgPins2[i];
418 rrfp.signature[0] = '0';
419 rrfp.signature[1] = 'p';
420 rrfp.signature[2] = 'i';
421 rrfp.signature[3] = '3';
422 rrfp.signature[0] += i;
423 rrfp.dwFlags = rgPin2.dwFlags;
424 rrfp.dwInstances = rgPin2.cInstances;
425 rrfp.dwMediaTypes = rgPin2.nMediaTypes;
426 rrfp.dwMediums = rgPin2.nMediums;
427 rrfp.bCategory = rgPin2.clsPinCategory ? 1 : 0;
429 add_data(&mainStore, (LPBYTE)&rrfp, sizeof(rrfp));
432 DWORD index = find_data(&clsidStore, (const BYTE*)rgPin2.clsPinCategory, sizeof(CLSID));
434 index = add_data(&clsidStore, (const BYTE*)rgPin2.clsPinCategory, sizeof(CLSID));
437 add_data(&mainStore, (LPBYTE)&index, sizeof(index));
440 for (j = 0; j < rgPin2.nMediaTypes; j++)
443 rt.signature[0] = '0';
444 rt.signature[1] = 't';
445 rt.signature[2] = 'y';
446 rt.signature[3] = '3';
447 rt.signature[0] += j;
450 rt.dwOffsetMajor = find_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID));
451 if (rt.dwOffsetMajor == -1)
452 rt.dwOffsetMajor = add_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMajorType, sizeof(CLSID));
453 rt.dwOffsetMajor += size;
454 rt.dwOffsetMinor = find_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID));
455 if (rt.dwOffsetMinor == -1)
456 rt.dwOffsetMinor = add_data(&clsidStore, (const BYTE*)rgPin2.lpMediaType[j].clsMinorType, sizeof(CLSID));
457 rt.dwOffsetMinor += size;
459 add_data(&mainStore, (LPBYTE)&rt, sizeof(rt));
462 for (j = 0; j < rgPin2.nMediums; j++)
464 DWORD index = find_data(&clsidStore, (const BYTE*)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM));
466 index = add_data(&clsidStore, (const BYTE*)(rgPin2.lpMedium + j), sizeof(REGPINMEDIUM));
469 add_data(&mainStore, (LPBYTE)&index, sizeof(index));
474 saBound.cElements = mainStore.current + clsidStore.current;
475 psa = SafeArrayCreate(VT_UI1, 1, &saBound);
478 ERR("Couldn't create SAFEARRAY\n");
485 hr = SafeArrayAccessData(psa, (LPVOID *)&pbSAData);
488 memcpy(pbSAData, mainStore.pData, mainStore.current);
489 memcpy(pbSAData + mainStore.current, clsidStore.pData, clsidStore.current);
490 hr = SafeArrayUnaccessData(psa);
494 V_VT(&var) = VT_ARRAY | VT_UI1;
495 V_UNION(&var, parray) = psa;
498 hr = IPropertyBag_Write(pPropBag, wszFilterDataName, &var);
501 SafeArrayDestroy(psa);
503 delete_vector(&mainStore);
504 delete_vector(&clsidStore);
508 static HRESULT FM2_ReadFilterData(IPropertyBag * pPropBag, REGFILTER2 * prf2)
513 struct REG_RF * prrf;
516 REGFILTERPINS2 * rgPins2;
519 V_VT(&var) = VT_ARRAY | VT_UI1;
521 hr = IPropertyBag_Read(pPropBag, wszFilterDataName, &var, NULL);
524 hr = SafeArrayAccessData(V_UNION(&var, parray), (LPVOID*)&pData);
528 prrf = (struct REG_RF *)pData;
531 if (prrf->dwVersion != 2)
533 FIXME("Filter registry version %d not supported\n", prrf->dwVersion);
534 ZeroMemory(prf2, sizeof(*prf2));
541 TRACE("version = %d, merit = %x, #pins = %d, unused = %x\n",
542 prrf->dwVersion, prrf->dwMerit, prrf->dwPins, prrf->dwUnused);
544 prf2->dwVersion = prrf->dwVersion;
545 prf2->dwMerit = prrf->dwMerit;
546 prf2->u.s1.cPins2 = prrf->dwPins;
547 rgPins2 = CoTaskMemAlloc(prrf->dwPins * sizeof(*rgPins2));
548 prf2->u.s1.rgPins2 = rgPins2;
549 pCurrent += sizeof(struct REG_RF);
551 for (i = 0; i < prrf->dwPins; i++)
553 struct REG_RFP * prrfp = (struct REG_RFP *)pCurrent;
554 REGPINTYPES * lpMediaType;
555 REGPINMEDIUM * lpMedium;
558 /* FIXME: check signature */
560 TRACE("\tsignature = %s\n", debugstr_an((const char*)prrfp->signature, 4));
562 TRACE("\tpin[%d]: flags = %x, instances = %d, media types = %d, mediums = %d\n",
563 i, prrfp->dwFlags, prrfp->dwInstances, prrfp->dwMediaTypes, prrfp->dwMediums);
565 rgPins2[i].dwFlags = prrfp->dwFlags;
566 rgPins2[i].cInstances = prrfp->dwInstances;
567 rgPins2[i].nMediaTypes = prrfp->dwMediaTypes;
568 rgPins2[i].nMediums = prrfp->dwMediums;
569 pCurrent += sizeof(struct REG_RFP);
570 if (prrfp->bCategory)
572 CLSID * clsCat = CoTaskMemAlloc(sizeof(CLSID));
573 memcpy(clsCat, pData + *(DWORD*)(pCurrent), sizeof(CLSID));
574 pCurrent += sizeof(DWORD);
575 rgPins2[i].clsPinCategory = clsCat;
578 rgPins2[i].clsPinCategory = NULL;
580 if (rgPins2[i].nMediaTypes > 0)
581 lpMediaType = CoTaskMemAlloc(rgPins2[i].nMediaTypes * sizeof(*lpMediaType));
585 rgPins2[i].lpMediaType = lpMediaType;
587 for (j = 0; j < rgPins2[i].nMediaTypes; j++)
589 struct REG_TYPE * prt = (struct REG_TYPE *)pCurrent;
590 CLSID * clsMajor = CoTaskMemAlloc(sizeof(CLSID));
591 CLSID * clsMinor = CoTaskMemAlloc(sizeof(CLSID));
593 /* FIXME: check signature */
594 TRACE("\t\tsignature = %s\n", debugstr_an((const char*)prt->signature, 4));
596 memcpy(clsMajor, pData + prt->dwOffsetMajor, sizeof(CLSID));
597 memcpy(clsMinor, pData + prt->dwOffsetMinor, sizeof(CLSID));
599 lpMediaType[j].clsMajorType = clsMajor;
600 lpMediaType[j].clsMinorType = clsMinor;
602 pCurrent += sizeof(*prt);
605 if (rgPins2[i].nMediums > 0)
606 lpMedium = CoTaskMemAlloc(rgPins2[i].nMediums * sizeof(*lpMedium));
610 rgPins2[i].lpMedium = lpMedium;
612 for (j = 0; j < rgPins2[i].nMediums; j++)
614 DWORD dwOffset = *(DWORD *)pCurrent;
616 memcpy(lpMedium + j, pData + dwOffset, sizeof(REGPINMEDIUM));
618 pCurrent += sizeof(dwOffset);
625 SafeArrayUnaccessData(V_UNION(&var, parray));
632 static void FM2_DeleteRegFilter(REGFILTER2 * prf2)
635 for (i = 0; i < prf2->u.s1.cPins2; i++)
638 if (prf2->u.s1.rgPins2[i].clsPinCategory)
639 CoTaskMemFree((LPVOID)prf2->u.s1.rgPins2[i].clsPinCategory);
641 for (j = 0; j < prf2->u.s1.rgPins2[i].nMediaTypes; j++)
643 CoTaskMemFree((LPVOID)prf2->u.s1.rgPins2[i].lpMediaType[j].clsMajorType);
644 CoTaskMemFree((LPVOID)prf2->u.s1.rgPins2[i].lpMediaType[j].clsMinorType);
646 CoTaskMemFree((LPVOID)prf2->u.s1.rgPins2[i].lpMedium);
650 static HRESULT WINAPI FilterMapper2_RegisterFilter(
651 IFilterMapper2 * iface,
652 REFCLSID clsidFilter,
654 IMoniker **ppMoniker,
655 const CLSID *pclsidCategory,
656 const OLECHAR *szInstance,
657 const REGFILTER2 *prf2)
659 IParseDisplayName * pParser = NULL;
660 IBindCtx * pBindCtx = NULL;
661 IMoniker * pMoniker = NULL;
662 IPropertyBag * pPropBag = NULL;
664 LPWSTR pwszParseName = NULL;
666 static const WCHAR wszDevice[] = {'@','d','e','v','i','c','e',':','s','w',':',0};
669 LPWSTR szClsidTemp = NULL;
670 REGFILTER2 regfilter2;
671 REGFILTERPINS2* pregfp2 = NULL;
673 TRACE("(%s, %s, %p, %s, %s, %p)\n",
674 debugstr_guid(clsidFilter),
677 debugstr_guid(pclsidCategory),
678 debugstr_w(szInstance),
681 if (prf2->dwVersion == 2)
685 else if (prf2->dwVersion == 1)
689 /* REGFILTER2 structure is converted from version 1 to 2. Tested on Win2k. */
690 regfilter2.dwVersion = 2;
691 regfilter2.dwMerit = prf2->dwMerit;
692 regfilter2.u.s1.cPins2 = prf2->u.s.cPins;
693 pregfp2 = (REGFILTERPINS2*) CoTaskMemAlloc(prf2->u.s.cPins * sizeof(REGFILTERPINS2));
694 regfilter2.u.s1.rgPins2 = pregfp2;
695 for (i = 0; i < prf2->u.s.cPins; i++)
698 if (prf2->u.s.rgPins[i].bRendered)
699 flags |= REG_PINFLAG_B_RENDERER;
700 if (prf2->u.s.rgPins[i].bOutput)
701 flags |= REG_PINFLAG_B_OUTPUT;
702 if (prf2->u.s.rgPins[i].bZero)
703 flags |= REG_PINFLAG_B_ZERO;
704 if (prf2->u.s.rgPins[i].bMany)
705 flags |= REG_PINFLAG_B_MANY;
706 pregfp2[i].dwFlags = flags;
707 pregfp2[i].cInstances = 1;
708 pregfp2[i].nMediaTypes = prf2->u.s.rgPins[i].nMediaTypes;
709 pregfp2[i].lpMediaType = prf2->u.s.rgPins[i].lpMediaType;
710 pregfp2[i].nMediums = 0;
711 pregfp2[i].lpMedium = NULL;
712 pregfp2[i].clsPinCategory = NULL;
717 FIXME("dwVersion other that 1 or 2 not supported at the moment\n");
725 /* MSDN mentions the inexistent CLSID_ActiveMovieFilters GUID.
726 * In fact this is the CLSID_LegacyAmFilterCategory one */
727 pclsidCategory = &CLSID_LegacyAmFilterCategory;
729 /* sizeof... will include the null terminator and
730 * the + 1 is for the separator ('\\'). The -1 is
731 * because CHARS_IN_GUID includes the null terminator
733 nameLen = sizeof(wszDevice)/sizeof(wszDevice[0]) + CHARS_IN_GUID - 1 + 1;
736 nameLen += strlenW(szInstance);
738 nameLen += CHARS_IN_GUID - 1; /* CHARS_IN_GUID includes null terminator */
740 pCurrent = pwszParseName = CoTaskMemAlloc(nameLen*sizeof(WCHAR));
742 return E_OUTOFMEMORY;
744 strcpyW(pwszParseName, wszDevice);
745 pCurrent += strlenW(wszDevice);
747 hr = StringFromCLSID(pclsidCategory, &szClsidTemp);
751 memcpy(pCurrent, szClsidTemp, CHARS_IN_GUID * sizeof(WCHAR));
752 pCurrent += CHARS_IN_GUID - 1;
756 strcpyW(pCurrent+1, szInstance);
759 CoTaskMemFree(szClsidTemp);
762 hr = StringFromCLSID(clsidFilter, &szClsidTemp);
764 strcpyW(pCurrent+1, szClsidTemp);
769 hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (LPVOID *)&pParser);
772 hr = CreateBindCtx(0, &pBindCtx);
775 hr = IParseDisplayName_ParseDisplayName(pParser, pBindCtx, pwszParseName, &ulEaten, &pMoniker);
778 IBindCtx_Release(pBindCtx);
780 IParseDisplayName_Release(pParser);
783 hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID)&pPropBag);
786 hr = FM2_WriteFriendlyName(pPropBag, szName);
789 hr = FM2_WriteClsid(pPropBag, clsidFilter);
792 hr = FM2_WriteFilterData(pPropBag, ®filter2);
795 IPropertyBag_Release(pPropBag);
796 CoTaskMemFree(szClsidTemp);
798 if (SUCCEEDED(hr) && ppMoniker)
799 *ppMoniker = pMoniker;
801 IMoniker_Release(pMoniker);
803 CoTaskMemFree(pregfp2);
805 TRACE("-- returning %x\n", hr);
810 /* internal helper function */
811 static BOOL MatchTypes(
814 const REGPINTYPES * pPinTypes,
816 const GUID * pMatchTypes)
821 if ((nMatchTypes == 0) && (nPinTypes > 0))
824 for (j = 0; j < nPinTypes; j++)
827 for (i = 0; i < nMatchTypes*2; i+=2)
829 if (((!bExactMatch && IsEqualGUID(pPinTypes[j].clsMajorType, &GUID_NULL)) || IsEqualGUID(&pMatchTypes[i], &GUID_NULL) || IsEqualGUID(pPinTypes[j].clsMajorType, &pMatchTypes[i])) &&
830 ((!bExactMatch && IsEqualGUID(pPinTypes[j].clsMinorType, &GUID_NULL)) || IsEqualGUID(&pMatchTypes[i+1], &GUID_NULL) || IsEqualGUID(pPinTypes[j].clsMinorType, &pMatchTypes[i+1])))
840 /* internal helper function for qsort of MONIKER_MERIT array */
841 static int mm_compare(const void * left, const void * right)
843 const struct MONIKER_MERIT * mmLeft = (const struct MONIKER_MERIT *)left;
844 const struct MONIKER_MERIT * mmRight = (const struct MONIKER_MERIT *)right;
846 if (mmLeft->dwMerit == mmRight->dwMerit)
848 if (mmLeft->dwMerit > mmRight->dwMerit)
854 * Exact match means whether or not to treat GUID_NULL's in filter data as wild cards
855 * (GUID_NULL's in input to function automatically treated as wild cards)
856 * Input/Output needed means match only on criteria if TRUE (with zero input types
857 * meaning match any input/output pin as long as one exists), otherwise match any
858 * filter that meets the rest of the requirements.
860 static HRESULT WINAPI FilterMapper2_EnumMatchingFilters(
861 IFilterMapper2 * iface,
862 IEnumMoniker **ppEnum,
868 const GUID *pInputTypes,
869 const REGPINMEDIUM *pMedIn,
870 const CLSID *pPinCategoryIn,
874 const GUID *pOutputTypes,
875 const REGPINMEDIUM *pMedOut,
876 const CLSID *pPinCategoryOut)
878 ICreateDevEnum * pCreateDevEnum;
879 IMoniker * pMonikerCat;
880 IEnumMoniker * pEnumCat;
882 struct Vector monikers = {NULL, 0, 0};
884 TRACE("(%p, %x, %s, %x, %s, %d, %p, %p, %p, %s, %s, %p, %p, %p)\n",
887 bExactMatch ? "true" : "false",
889 bInputNeeded ? "true" : "false",
894 bRender ? "true" : "false",
895 bOutputNeeded ? "true" : "false",
902 FIXME("dwFlags = %x not implemented\n", dwFlags);
907 hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC, &IID_ICreateDevEnum, (LPVOID*)&pCreateDevEnum);
910 hr = ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum, &CLSID_ActiveMovieCategories, &pEnumCat, 0);
912 while (IEnumMoniker_Next(pEnumCat, 1, &pMonikerCat, NULL) == S_OK)
914 IPropertyBag * pPropBagCat = NULL;
916 HRESULT hrSub; /* this is so that one buggy filter
917 doesn't make the whole lot fail */
921 hrSub = IMoniker_BindToStorage(pMonikerCat, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
923 if (SUCCEEDED(hrSub))
924 hrSub = IPropertyBag_Read(pPropBagCat, wszMeritName, &var, NULL);
926 if (SUCCEEDED(hrSub) && (V_UNION(&var, ulVal) >= dwMerit))
929 IEnumMoniker * pEnum;
934 if (TRACE_ON(quartz))
937 V_VT(&temp) = VT_EMPTY;
938 IPropertyBag_Read(pPropBagCat, wszFriendlyName, &temp, NULL);
939 TRACE("Considering category %s\n", debugstr_w(V_UNION(&temp, bstrVal)));
943 hrSub = IPropertyBag_Read(pPropBagCat, wszClsidName, &var, NULL);
945 if (SUCCEEDED(hrSub))
946 hrSub = CLSIDFromString(V_UNION(&var, bstrVal), &clsidCat);
948 if (SUCCEEDED(hrSub))
949 hrSub = ICreateDevEnum_CreateClassEnumerator(pCreateDevEnum, &clsidCat, &pEnum, 0);
953 while (IEnumMoniker_Next(pEnum, 1, &pMoniker, NULL) == S_OK)
955 IPropertyBag * pPropBag = NULL;
958 BOOL bInputMatch = !bInputNeeded;
959 BOOL bOutputMatch = !bOutputNeeded;
961 ZeroMemory(&rf2, sizeof(rf2));
963 hrSub = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBag);
965 if (TRACE_ON(quartz))
968 V_VT(&temp) = VT_EMPTY;
969 IPropertyBag_Read(pPropBag, wszFriendlyName, &temp, NULL);
970 TRACE("Considering filter %s\n", debugstr_w(V_UNION(&temp, bstrVal)));
974 if (SUCCEEDED(hrSub))
975 hrSub = FM2_ReadFilterData(pPropBag, &rf2);
977 /* Logic used for bInputMatch expression:
978 * There exists some pin such that bInputNeeded implies (pin is an input and
979 * (bRender implies pin has render flag) and major/minor types members of
981 * bOutputMatch is similar, but without the "bRender implies ..." part
982 * and substituting variables names containing input for output
985 /* determine whether filter meets requirements */
986 if (SUCCEEDED(hrSub) && (rf2.dwMerit >= dwMerit))
988 for (i = 0; (i < rf2.u.s1.cPins2) && (!bInputMatch || !bOutputMatch); i++)
990 const REGFILTERPINS2 * rfp2 = rf2.u.s1.rgPins2 + i;
992 bInputMatch = bInputMatch || (!(rfp2->dwFlags & REG_PINFLAG_B_OUTPUT) &&
993 (!bRender || (rfp2->dwFlags & REG_PINFLAG_B_RENDERER)) &&
994 MatchTypes(bExactMatch, rfp2->nMediaTypes, rfp2->lpMediaType, cInputTypes, pInputTypes));
995 bOutputMatch = bOutputMatch || ((rfp2->dwFlags & REG_PINFLAG_B_OUTPUT) &&
996 MatchTypes(bExactMatch, rfp2->nMediaTypes, rfp2->lpMediaType, cOutputTypes, pOutputTypes));
999 if (bInputMatch && bOutputMatch)
1001 struct MONIKER_MERIT mm = {pMoniker, rf2.dwMerit};
1002 IMoniker_AddRef(pMoniker);
1003 add_data(&monikers, (LPBYTE)&mm, sizeof(mm));
1007 FM2_DeleteRegFilter(&rf2);
1009 IPropertyBag_Release(pPropBag);
1010 IMoniker_Release(pMoniker);
1012 IEnumMoniker_Release(pEnum);
1018 IPropertyBag_Release(pPropBagCat);
1019 IMoniker_Release(pMonikerCat);
1024 IMoniker ** ppMoniker;
1026 ULONG nMonikerCount = monikers.current / sizeof(struct MONIKER_MERIT);
1028 /* sort the monikers in descending merit order */
1029 qsort(monikers.pData, nMonikerCount,
1030 sizeof(struct MONIKER_MERIT),
1033 /* construct an IEnumMoniker interface */
1034 ppMoniker = CoTaskMemAlloc(nMonikerCount * sizeof(IMoniker *));
1035 for (i = 0; i < nMonikerCount; i++)
1037 /* no need to AddRef here as already AddRef'd above */
1038 ppMoniker[i] = ((struct MONIKER_MERIT *)monikers.pData)[i].pMoniker;
1040 hr = EnumMonikerImpl_Create(ppMoniker, nMonikerCount, ppEnum);
1041 CoTaskMemFree(ppMoniker);
1044 delete_vector(&monikers);
1045 IEnumMoniker_Release(pEnumCat);
1046 ICreateDevEnum_Release(pCreateDevEnum);
1051 static const IFilterMapper2Vtbl fm2vtbl =
1054 FilterMapper2_QueryInterface,
1055 FilterMapper2_AddRef,
1056 FilterMapper2_Release,
1058 FilterMapper2_CreateCategory,
1059 FilterMapper2_UnregisterFilter,
1060 FilterMapper2_RegisterFilter,
1061 FilterMapper2_EnumMatchingFilters
1064 /*** IUnknown methods ***/
1066 static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID riid, LPVOID *ppv)
1068 FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
1070 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
1072 return FilterMapper2_QueryInterface((IFilterMapper2*)&This->lpVtbl, riid, ppv);
1075 static ULONG WINAPI FilterMapper_AddRef(IFilterMapper * iface)
1077 FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
1079 return FilterMapper2_AddRef((IFilterMapper2*)This);
1082 static ULONG WINAPI FilterMapper_Release(IFilterMapper * iface)
1084 FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
1086 return FilterMapper2_Release((IFilterMapper2*)This);
1089 /*** IFilterMapper methods ***/
1091 static HRESULT WINAPI FilterMapper_EnumMatchingFilters(
1092 IFilterMapper * iface,
1093 IEnumRegFilters **ppEnum,
1103 FilterMapper2Impl *This = impl_from_IFilterMapper(iface);
1106 IEnumMoniker* ppEnumMoniker;
1109 ULONG idx = 0, nb_mon = 0;
1110 REGFILTER* regfilters;
1113 TRACE("(%p/%p)->(%p, %x, %s, %s, %s, %s, %s, %s, %s) stub!\n",
1117 bInputNeeded ? "true" : "false",
1118 debugstr_guid(&clsInMaj),
1119 debugstr_guid(&clsInSub),
1120 bRender ? "true" : "false",
1121 bOutputNeeded ? "true" : "false",
1122 debugstr_guid(&clsOutMaj),
1123 debugstr_guid(&clsOutSub));
1125 InputType[0] = clsInMaj;
1126 InputType[1] = clsInSub;
1127 OutputType[0] = clsOutMaj;
1128 OutputType[1] = clsOutSub;
1130 hr = IFilterMapper2_EnumMatchingFilters((IFilterMapper2*)This,
1150 while(IEnumMoniker_Next(ppEnumMoniker, 1, &IMon, &nb) == S_OK)
1152 IMoniker_Release(IMon);
1159 IEnumMoniker_Release(ppEnumMoniker);
1160 return IEnumRegFiltersImpl_Construct(NULL, 0, ppEnum);
1163 regfilters = CoTaskMemAlloc(nb_mon * sizeof(REGFILTER));
1166 IEnumMoniker_Release(ppEnumMoniker);
1167 return E_OUTOFMEMORY;
1170 IEnumMoniker_Reset(ppEnumMoniker);
1171 while(IEnumMoniker_Next(ppEnumMoniker, 1, &IMon, &nb) == S_OK)
1173 IPropertyBag * pPropBagCat = NULL;
1180 V_VT(&var) = VT_BSTR;
1182 hrSub = IMoniker_BindToStorage(IMon, NULL, NULL, &IID_IPropertyBag, (LPVOID*)&pPropBagCat);
1184 if (SUCCEEDED(hrSub))
1185 hrSub = IPropertyBag_Read(pPropBagCat, wszClsidName, &var, NULL);
1187 if (SUCCEEDED(hrSub))
1188 hrSub = CLSIDFromString(V_UNION(&var, bstrVal), &clsid);
1190 if (SUCCEEDED(hrSub))
1191 hrSub = IPropertyBag_Read(pPropBagCat, wszFriendlyName, &var, NULL);
1193 if (SUCCEEDED(hrSub))
1195 len = (strlenW((WCHAR*)&V_UNION(&var, bstrVal))+1) * sizeof(WCHAR);
1196 if (!(regfilters[idx].Name = CoTaskMemAlloc(len*2)))
1200 if (SUCCEEDED(hrSub))
1202 memcpy(regfilters[idx].Name, &V_UNION(&var, bstrVal), len);
1203 regfilters[idx].Clsid = clsid;
1208 IPropertyBag_Release(pPropBagCat);
1209 IMoniker_Release(IMon);
1212 /* In case of release all resources */
1215 for (idx = 0; idx < nb_mon; idx++)
1216 CoTaskMemFree(regfilters[idx].Name);
1217 CoTaskMemFree(regfilters);
1218 IEnumMoniker_Release(ppEnumMoniker);
1222 hr = IEnumRegFiltersImpl_Construct(regfilters, nb_mon, ppEnum);
1223 CoTaskMemFree(regfilters);
1224 IEnumMoniker_Release(ppEnumMoniker);
1230 static HRESULT WINAPI FilterMapper_RegisterFilter(IFilterMapper * iface, CLSID clsid, LPCWSTR szName, DWORD dwMerit)
1233 LPWSTR wszClsid = NULL;
1236 WCHAR wszKeyName[strlenW(wszFilterSlash) + (CHARS_IN_GUID-1) + 1];
1238 TRACE("(%p)->(%s, %s, %x)\n", iface, debugstr_guid(&clsid), debugstr_w(szName), dwMerit);
1240 hr = StringFromCLSID(&clsid, &wszClsid);
1244 strcpyW(wszKeyName, wszFilterSlash);
1245 strcatW(wszKeyName, wszClsid);
1247 lRet = RegCreateKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
1248 hr = HRESULT_FROM_WIN32(lRet);
1253 lRet = RegSetValueExW(hKey, NULL, 0, REG_SZ, (const BYTE*)szName, strlenW(szName) + 1);
1254 hr = HRESULT_FROM_WIN32(lRet);
1260 strcpyW(wszKeyName, wszClsidSlash);
1261 strcatW(wszKeyName, wszClsid);
1263 lRet = RegCreateKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
1264 hr = HRESULT_FROM_WIN32(lRet);
1269 lRet = RegSetValueExW(hKey, wszMeritName, 0, REG_DWORD, (LPBYTE)&dwMerit, sizeof(dwMerit));
1270 hr = HRESULT_FROM_WIN32(lRet);
1277 static HRESULT WINAPI FilterMapper_RegisterFilterInstance(IFilterMapper * iface, CLSID clsid, LPCWSTR szName, CLSID *MRId)
1279 TRACE("(%p)->(%s, %s, %p)\n", iface, debugstr_guid(&clsid), debugstr_w(szName), MRId);
1281 /* Not implemented in Windows (tested on Win2k) */
1286 static HRESULT WINAPI FilterMapper_RegisterPin(
1287 IFilterMapper * iface,
1294 CLSID ConnectsToFilter,
1295 LPCWSTR ConnectsToPin)
1299 LPWSTR wszClsid = NULL;
1301 HKEY hPinsKey = NULL;
1302 WCHAR * wszPinsKeyName;
1303 WCHAR wszKeyName[strlenW(wszClsidSlash) + (CHARS_IN_GUID-1) + 1];
1305 TRACE("(%p)->(%s, %s, %d, %d, %d, %d, %s, %s)\n", iface, debugstr_guid(&Filter), debugstr_w(szName), bRendered,
1306 bOutput, bZero, bMany, debugstr_guid(&ConnectsToFilter), debugstr_w(ConnectsToPin));
1308 hr = StringFromCLSID(&Filter, &wszClsid);
1312 strcpyW(wszKeyName, wszClsidSlash);
1313 strcatW(wszKeyName, wszClsid);
1315 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, KEY_WRITE, &hKey);
1316 hr = HRESULT_FROM_WIN32(lRet);
1321 wszPinsKeyName = CoTaskMemAlloc((strlenW(wszPins) + 1 + strlenW(szName) + 1) * 2);
1322 if (!wszPinsKeyName)
1328 strcpyW(wszPinsKeyName, wszPins);
1329 strcatW(wszPinsKeyName, wszSlash);
1330 strcatW(wszPinsKeyName, szName);
1332 lRet = RegCreateKeyExW(hKey, wszPinsKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hPinsKey, NULL);
1333 hr = HRESULT_FROM_WIN32(lRet);
1334 CoTaskMemFree(wszPinsKeyName);
1339 lRet = RegSetValueExW(hPinsKey, wszAllowedMany, 0, REG_DWORD, (LPBYTE)&bMany, sizeof(bMany));
1340 hr = HRESULT_FROM_WIN32(lRet);
1345 lRet = RegSetValueExW(hPinsKey, wszAllowedZero, 0, REG_DWORD, (LPBYTE)&bZero, sizeof(bZero));
1346 hr = HRESULT_FROM_WIN32(lRet);
1351 lRet = RegSetValueExW(hPinsKey, wszDirection, 0, REG_DWORD, (LPBYTE)&bOutput, sizeof(bOutput));
1352 hr = HRESULT_FROM_WIN32(lRet);
1357 lRet = RegSetValueExW(hPinsKey, wszIsRendered, 0, REG_DWORD, (LPBYTE)&bRendered, sizeof(bRendered));
1358 hr = HRESULT_FROM_WIN32(lRet);
1363 lRet = RegCreateKeyExW(hPinsKey, wszTypes, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, NULL, NULL);
1364 hr = HRESULT_FROM_WIN32(lRet);
1367 CoTaskMemFree(wszClsid);
1371 CloseHandle(hPinsKey);
1377 static HRESULT WINAPI FilterMapper_RegisterPinType(
1378 IFilterMapper * iface,
1386 LPWSTR wszClsid = NULL;
1387 LPWSTR wszClsidMajorType = NULL;
1388 LPWSTR wszClsidSubType = NULL;
1390 WCHAR * wszTypesKey;
1391 WCHAR wszKeyName[strlenW(wszClsidSlash) + (CHARS_IN_GUID-1) + 1];
1393 TRACE("(%p)->(%s, %s, %s, %s)\n", iface, debugstr_guid(&clsFilter), debugstr_w(szName),
1394 debugstr_guid(&clsMajorType), debugstr_guid(&clsSubType));
1396 hr = StringFromCLSID(&clsFilter, &wszClsid);
1400 hr = StringFromCLSID(&clsMajorType, &wszClsidMajorType);
1405 hr = StringFromCLSID(&clsSubType, &wszClsidSubType);
1410 wszTypesKey = CoTaskMemAlloc((strlenW(wszClsidSlash) + strlenW(wszClsid) + strlenW(wszPins) +
1411 strlenW(szName) + strlenW(wszTypes) + 3 + 1) * 2);
1418 strcpyW(wszTypesKey, wszClsidSlash);
1419 strcatW(wszTypesKey, wszClsid);
1420 strcatW(wszTypesKey, wszSlash);
1421 strcatW(wszTypesKey, wszPins);
1422 strcatW(wszTypesKey, wszSlash);
1423 strcatW(wszTypesKey, szName);
1424 strcatW(wszTypesKey, wszSlash);
1425 strcatW(wszTypesKey, wszTypes);
1427 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszTypesKey, 0, KEY_WRITE, &hKey);
1428 hr = HRESULT_FROM_WIN32(lRet);
1429 CoTaskMemFree(wszTypesKey);
1434 strcpyW(wszKeyName, wszClsidMajorType);
1435 strcatW(wszKeyName, wszSlash);
1436 strcatW(wszKeyName, wszClsidSubType);
1438 lRet = RegCreateKeyExW(hKey, wszKeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, NULL, NULL);
1439 hr = HRESULT_FROM_WIN32(lRet);
1443 CoTaskMemFree(wszClsid);
1444 CoTaskMemFree(wszClsidMajorType);
1445 CoTaskMemFree(wszClsidSubType);
1450 static HRESULT WINAPI FilterMapper_UnregisterFilter(IFilterMapper * iface, CLSID Filter)
1454 LPWSTR wszClsid = NULL;
1456 WCHAR wszKeyName[strlenW(wszClsidSlash) + (CHARS_IN_GUID-1) + 1];
1458 TRACE("(%p)->(%s)\n", iface, debugstr_guid(&Filter));
1460 hr = StringFromCLSID(&Filter, &wszClsid);
1464 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszFilter, 0, KEY_WRITE, &hKey);
1465 hr = HRESULT_FROM_WIN32(lRet);
1470 lRet = RegDeleteKeyW(hKey, wszClsid);
1471 hr = HRESULT_FROM_WIN32(lRet);
1477 strcpyW(wszKeyName, wszClsidSlash);
1478 strcatW(wszKeyName, wszClsid);
1480 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, KEY_WRITE, &hKey);
1481 hr = HRESULT_FROM_WIN32(lRet);
1486 lRet = RegDeleteKeyW(hKey, wszMeritName);
1487 hr = HRESULT_FROM_WIN32(lRet);
1491 CoTaskMemFree(wszClsid);
1496 static HRESULT WINAPI FilterMapper_UnregisterFilterInstance(IFilterMapper * iface, CLSID MRId)
1498 TRACE("(%p)->(%s)\n", iface, debugstr_guid(&MRId));
1500 /* Not implemented in Windows (tested on Win2k) */
1505 static HRESULT WINAPI FilterMapper_UnregisterPin(IFilterMapper * iface, CLSID Filter, LPCWSTR Name)
1509 LPWSTR wszClsid = NULL;
1511 WCHAR * wszPinNameKey;
1512 WCHAR wszKeyName[strlenW(wszClsidSlash) + (CHARS_IN_GUID-1) + 1];
1514 TRACE("(%p)->(%s, %s)\n", iface, debugstr_guid(&Filter), debugstr_w(Name));
1517 return E_INVALIDARG;
1519 hr = StringFromCLSID(&Filter, &wszClsid);
1523 strcpyW(wszKeyName, wszClsidSlash);
1524 strcatW(wszKeyName, wszClsid);
1526 lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszKeyName, 0, KEY_WRITE, &hKey);
1527 hr = HRESULT_FROM_WIN32(lRet);
1532 wszPinNameKey = CoTaskMemAlloc((strlenW(wszPins) + 1 + strlenW(Name) + 1) * 2);
1539 strcpyW(wszPinNameKey, wszPins);
1540 strcatW(wszPinNameKey, wszSlash);
1541 strcatW(wszPinNameKey, Name);
1543 lRet = RegDeleteKeyW(hKey, wszPinNameKey);
1544 hr = HRESULT_FROM_WIN32(lRet);
1545 CoTaskMemFree(wszPinNameKey);
1548 CoTaskMemFree(wszClsid);
1555 static const IFilterMapperVtbl fmvtbl =
1558 FilterMapper_QueryInterface,
1559 FilterMapper_AddRef,
1560 FilterMapper_Release,
1562 FilterMapper_RegisterFilter,
1563 FilterMapper_RegisterFilterInstance,
1564 FilterMapper_RegisterPin,
1565 FilterMapper_RegisterPinType,
1566 FilterMapper_UnregisterFilter,
1567 FilterMapper_UnregisterFilterInstance,
1568 FilterMapper_UnregisterPin,
1569 FilterMapper_EnumMatchingFilters