27#include "wine/winternl.h"
31DEFINE_GUID(
GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
40 static const WCHAR wszFriendlyName[] = {
'F',
'r',
'i',
'e',
'n',
'd',
'l',
'y',
'N',
'a',
'm',
'e',0};
43 while(!found && IEnumMoniker_Next(pEnum, 1, &pMoniker, &nb) ==
S_OK)
59 IPropertyBag_Release(pPropBagCat);
60 IMoniker_Release(pMoniker);
71 IFilterMapper *mapper;
76 static const WCHAR wszFilterName1[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'1', 0 };
77 static const WCHAR wszFilterName2[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'2', 0 };
88 &IID_IFilterMapper2, (
LPVOID*)&pMapper);
89 ok(
hr ==
S_OK,
"CoCreateInstance failed with %x\n",
hr);
93 ok(
hr ==
S_OK,
"CoCreateGuid failed with %x\n",
hr);
95 ok(
hr ==
S_OK,
"CoCreateGuid failed with %x\n",
hr);
100 S2(
U(rgf2)).cPins2 = 1;
101 S2(
U(rgf2)).rgPins2 = rgPins2;
114 hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1,
NULL,
115 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
119 skip(
"Not authorized to register filters\n");
123 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
135 S2(
U(rgf2)).cPins2 = 2;
137 hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2,
NULL,
138 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
139 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
141 hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
143 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed with %x\n",
hr);
147 ok(found,
"EnumMatchingFilters failed to return the test filter 1\n");
150 if (pEnum) IEnumMoniker_Release(pEnum);
153 hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
155 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed with %x\n",
hr);
159 ok(found,
"EnumMatchingFilters failed to return the test filter 2\n");
162 if (pEnum) IEnumMoniker_Release(pEnum);
167 hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
169 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed with %x\n",
hr);
174 ok(found,
"EnumMatchingFilters failed to return the test filter 1\n");
177 hr = IFilterMapper2_QueryInterface(pMapper, &IID_IFilterMapper, (
void **)&mapper);
178 ok(
hr ==
S_OK,
"QueryInterface(IFilterMapper) failed: %#x\n",
hr);
181 hr = IFilterMapper_EnumMatchingFilters(mapper, &enum_reg, MERIT_UNLIKELY,
183 ok(
hr ==
S_OK,
"IFilterMapper_EnumMatchingFilters failed: %#x\n",
hr);
184 while (!found && IEnumRegFilters_Next(enum_reg, 1, ®filter, &
count) ==
S_OK)
189 IEnumRegFilters_Release(enum_reg);
190 ok(found,
"IFilterMapper didn't find filter\n");
193 if (pEnum) IEnumMoniker_Release(pEnum);
196 hr = IFilterMapper2_EnumMatchingFilters(pMapper, &pEnum, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
198 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed with %x\n",
hr);
203 ok(!found,
"EnumMatchingFilters should not return the test filter 2\n");
208 hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory,
NULL,
210 ok(
SUCCEEDED(
hr),
"IFilterMapper2_UnregisterFilter failed with %x\n",
hr);
212 hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory,
NULL,
214 ok(
SUCCEEDED(
hr),
"IFilterMapper2_UnregisterFilter failed with %x\n",
hr);
219 if (pEnum) IEnumMoniker_Release(pEnum);
220 if (pMapper) IFilterMapper2_Release(pMapper);
225 static const WCHAR testfilterW[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',0};
226 static const WCHAR clsidW[] = {
'C',
'L',
'S',
'I',
'D',
'\\',0};
227 static const WCHAR pinW[] = {
'P',
'i',
'n',
'1',0};
231 IFilterMapper *mapper;
233 WCHAR clsidstring[40];
251 skip(
"Not authorized to register filters\n");
258 hr =
CoCreateInstance(&CLSID_FilterMapper2,
NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper2, (
void **)&mapper2);
259 ok(
hr ==
S_OK,
"CoCreateInstance failed with %x\n",
hr);
261 hr = IFilterMapper2_QueryInterface(mapper2, &IID_IFilterMapper, (
void **)&mapper);
262 ok(
hr ==
S_OK,
"IFilterMapper2_QueryInterface failed with %x\n",
hr);
268 hr = IFilterMapper_RegisterFilter(mapper,
clsid, testfilterW, MERIT_UNLIKELY);
269 ok(
hr ==
S_OK,
"RegisterFilter failed: %#x\n",
hr);
272 ok(
hr ==
S_OK,
"RegisterPin failed: %#x\n",
hr);
275 ok(
hr ==
S_OK,
"RegisterPinType failed: %#x\n",
hr);
277 hr = IFilterMapper2_EnumMatchingFilters(mapper2, &enum_mon, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
279 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed: %x\n",
hr);
281 IEnumMoniker_Release(enum_mon);
286 ok(
hr ==
S_OK,
"IFilterMapper_EnumMatchingFilters failed with %x\n",
hr);
287 while(!found && IEnumRegFilters_Next(enum_reg, 1, ®filter, &
count) ==
S_OK)
292 IEnumRegFilters_Release(enum_reg);
293 ok(found,
"IFilterMapper didn't find filter\n");
295 hr = IFilterMapper_UnregisterFilter(mapper,
clsid);
296 ok(
hr ==
S_OK,
"FilterMapper_UnregisterFilter failed with %x\n",
hr);
298 hr = IFilterMapper2_EnumMatchingFilters(mapper2, &enum_mon, 0,
TRUE, MERIT_UNLIKELY,
TRUE,
300 ok(
hr ==
S_OK,
"IFilterMapper2_EnumMatchingFilters failed: %x\n",
hr);
301 ok(!
enum_find_filter(testfilterW, enum_mon),
"IFilterMapper2 shouldn't find filter\n");
302 IEnumMoniker_Release(enum_mon);
307 ok(
hr ==
S_OK,
"IFilterMapper_EnumMatchingFilters failed with %x\n",
hr);
308 while(!found && IEnumRegFilters_Next(enum_reg, 1, ®filter, &
count) ==
S_OK)
313 IEnumRegFilters_Release(enum_reg);
314 ok(!found,
"IFilterMapper shouldn't find filter\n");
317 ok(!
ret,
"RegDeleteKeyA failed: %lu\n",
ret);
319 hr = IFilterMapper_RegisterFilter(mapper,
clsid, testfilterW, MERIT_UNLIKELY);
320 ok(
hr ==
S_OK,
"RegisterFilter failed: %#x\n",
hr);
322 hr = IFilterMapper_UnregisterFilter(mapper,
clsid);
323 ok(
hr ==
S_OK,
"FilterMapper_UnregisterFilter failed with %x\n",
hr);
325 IFilterMapper_Release(mapper);
326 IFilterMapper2_Release(mapper2);
331 IUnknown_AddRef(iface);
332 return IUnknown_Release(iface);
344 ok(
hr ==
S_OK,
"CoCreateInstance failed with %08x\n",
hr);
345 if (!pgraph2)
goto out;
347 hr = IFilterGraph2_QueryInterface(pgraph2, &IID_IFilterMapper2, (
LPVOID*)&pMapper2);
348 ok(
hr ==
S_OK,
"IFilterGraph2_QueryInterface failed with %08x\n",
hr);
349 if (!pMapper2)
goto out;
352 ok(refcount == 2,
"unexpected reference count: %u\n", refcount);
354 ok(refcount == 2,
"unexpected reference count: %u\n", refcount);
356 IFilterMapper2_AddRef(pMapper2);
358 ok(refcount == 3,
"unexpected reference count: %u\n", refcount);
360 ok(refcount == 3,
"unexpected reference count: %u\n", refcount);
361 IFilterMapper2_Release(pMapper2);
363 hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (
LPVOID*)&filtergraph);
364 ok(
hr ==
S_OK,
"IFilterMapper2_QueryInterface failed with %08x\n",
hr);
365 if (!filtergraph)
goto out;
367 IFilterMapper2_Release(pMapper2);
369 IFilterGraph_Release(filtergraph);
373 ok(
hr ==
S_OK,
"CoCreateInstance failed with %08x\n",
hr);
374 if (!pMapper2)
goto out;
376 hr = IFilterMapper2_QueryInterface(pMapper2, &IID_IFilterGraph, (
LPVOID*)&filtergraph);
381 if (pMapper2) IFilterMapper2_Release(pMapper2);
382 if (filtergraph) IFilterGraph_Release(filtergraph);
383 if (pgraph2) IFilterGraph2_Release(pgraph2);
394 static WCHAR wszPinName[] = {
'P',
'i',
'n', 0 };
395 static const WCHAR wszFilterName1[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'1', 0 };
396 static const WCHAR wszFilterName2[] = {
'T',
'e',
's',
't',
'f',
'i',
'l',
't',
'e',
'r',
'2', 0 };
401 &IID_IFilterMapper2, (
LPVOID*)&pMapper);
402 ok(
hr ==
S_OK,
"CoCreateInstance failed with %x\n",
hr);
406 ok(
hr ==
S_OK,
"CoCreateGuid failed with %x\n",
hr);
408 ok(
hr ==
S_OK,
"CoCreateGuid failed with %x\n",
hr);
412 rgPinType.clsMinorType =
NULL;
418 S1(
U(rgf2)).cPins = 1;
419 S1(
U(rgf2)).rgPins = &rgPins;
431 hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter1, wszFilterName1,
NULL,
432 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
435 skip(
"Not authorized to register filters\n");
438 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
440 hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory,
NULL, &clsidFilter1);
441 ok(
hr ==
S_OK,
"FilterMapper_UnregisterFilter failed with %x\n",
hr);
447 S2(
U(rgf2)).cPins2 = 1;
448 S2(
U(rgf2)).rgPins2 = &rgPins2;
458 hr = IFilterMapper2_RegisterFilter(pMapper, &clsidFilter2, wszFilterName2,
NULL,
459 &CLSID_LegacyAmFilterCategory,
NULL, &rgf2);
460 ok(
hr ==
S_OK,
"IFilterMapper2_RegisterFilter failed with %x\n",
hr);
462 hr = IFilterMapper2_UnregisterFilter(pMapper, &CLSID_LegacyAmFilterCategory,
NULL, &clsidFilter2);
463 ok(
hr ==
S_OK,
"FilterMapper_UnregisterFilter failed with %x\n",
hr);
467 if (pMapper) IFilterMapper2_Release(pMapper);
473 0x02,0x00,0x00,0x00,0xff,0xff,0x5f,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x70,0x69,0x33,
474 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
475 0x30,0x74,0x79,0x33,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x31,0x70,0x69,0x33,
476 0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
477 0x30,0x74,0x79,0x33,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x76,0x69,0x64,0x73,
478 0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
479 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
492 &IID_IFilterMapper2, (
LPVOID*)&pMapper);
496 hr = IFilterMapper2_QueryInterface(pMapper, &IID_IAMFilterData, (
LPVOID*)&
pData);
503 ok(
psa !=
NULL,
"Unable to create safe array\n");
506 ok(
hr ==
S_OK,
"Unable to access array data\n");
510 hr = IAMFilterData_ParseFilterData(
pData, pbSAData,
sizeof(
data_block), &prgbRegFilter2);
514 pRegFilter =((
REGFILTER2**)prgbRegFilter2)[0];
515 ok (
hr==
S_OK,
"Failed to Parse filter Data\n");
519 ok(pRegFilter->
dwMerit == 0x5fffff,
"Incorrect merit returned\n");
529 IAMFilterData_Release(
pData);
531 IFilterMapper2_Release(pMapper);
555 This->AddRef_called++;
562 This->Release_called++;
582 ok(
hr ==
S_OK,
"CoCreateInstance returned %x\n",
hr);
585 hr = IUnknown_QueryInterface(pmapper, &
IID_IUnknown, (
void **)&punk);
586 ok(
hr ==
S_OK,
"IUnknown_QueryInterface returned %x\n",
hr);
588 IUnknown_Release(punk);
595 hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper, (
void **)&punk);
596 ok(
hr ==
S_OK,
"IUnknown_QueryInterface returned %x\n",
hr);
598 IUnknown_Release(punk);
605 hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper2, (
void **)&punk);
606 ok(
hr ==
S_OK,
"IUnknown_QueryInterface returned %x\n",
hr);
608 IUnknown_Release(punk);
615 hr = IUnknown_QueryInterface(pmapper, &IID_IFilterMapper3, (
void **)&punk);
616 ok(
hr ==
S_OK,
"IUnknown_QueryInterface returned %x\n",
hr);
618 IUnknown_Release(punk);
623 IUnknown_Release(pmapper);
#define RegCloseKey(hKey)
static const WCHAR clsidW[]
static const WCHAR wszFriendlyName[]
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
#define ERROR_ACCESS_DENIED
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI CoCreateGuid(GUID *pguid)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
GLuint GLuint GLsizei count
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
#define memcpy(s1, s2, n)
static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum)
static void test_register_filter_with_null_clsMinorType(void)
static ULONG WINAPI IUnknownImpl_AddRef(IUnknown *iface)
static void test_aggregate_filter_mapper(void)
static void test_legacy_filter_registration(void)
static ULONG getRefcount(IUnknown *iface)
static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppv)
static void test_ifiltermapper_from_filtergraph(void)
static void test_parse_filter_data(void)
static CONST_VTBL IUnknownVtbl IUnknownImpl_Vtbl
struct IUnknownImpl IUnknownImpl
static ULONG WINAPI IUnknownImpl_Release(IUnknown *iface)
static void test_fm2_enummatchingfilters(void)
static IUnknownImpl * IUnknownImpl_from_iface(IUnknown *iface)
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
const GUID IID_IPropertyBag
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
#define disable_success_count
const CLSID * clsPinCategory
const REGPINMEDIUM * lpMedium
const REGPINTYPES * lpMediaType
const CLSID * clsConnectsToFilter
const REGPINTYPES * lpMediaType
const WCHAR * strConnectsToPin
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
#define CONTAINING_RECORD(address, type, field)
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
void WINAPI VariantInit(VARIANTARG *pVarg)
#define HKEY_CLASSES_ROOT