Commit 5b4a1828 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

devenum: Register legacy AM filters as devenum codecs, not through FilterMapper2.

parent de8a1603
......@@ -9,6 +9,8 @@ C_SRCS = \
mediacatenum.c \
parsedisplayname.c
IDL_SRCS = devenum_classes.idl
IDL_SRCS = \
devenum_classes.idl \
fil_data.idl
RC_SRCS = devenum.rc
/*
* Copyright (C) 2009 Vitaliy Margolen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep header
import "objidl.idl";
import "strmif.idl";
import "unknwn.idl";
/*****************************************************************************
* IAMFilterData interface
*/
[
object,
uuid(97f7c4d4-547b-4a5f-8332-536430ad2e4d),
pointer_default(unique)
]
interface IAMFilterData : IUnknown
{
typedef [unique] IAMFilterData *LPIAMFILTERDATA;
HRESULT ParseFilterData(
[in] BYTE * rgbFilterData,
[in] ULONG cb,
[out] BYTE ** prgbRegFilter2);
HRESULT CreateFilterData(
[in] REGFILTER2 * prf2,
[out] BYTE ** prgbFilterData,
[out] ULONG * pcb);
}
......@@ -27,11 +27,16 @@
#include "ole2.h"
#include "strmif.h"
#include "uuids.h"
#include "vfwmsgs.h"
static const WCHAR friendly_name[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
static const WCHAR fcc_handlerW[] = {'F','c','c','H','a','n','d','l','e','r',0};
static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':',0};
static const WCHAR clsidW[] = {'C','L','S','I','D',0};
static const WCHAR mrleW[] = {'m','r','l','e',0};
static const WCHAR swW[] = {'s','w',':',0};
static const WCHAR cmW[] = {'c','m',':',0};
static const WCHAR backslashW[] = {'\\',0};
static void test_devenum(IBindCtx *bind_ctx)
{
......@@ -304,7 +309,6 @@ static IMoniker *check_display_name_(int line, IParseDisplayName *parser, WCHAR
static void test_directshow_filter(void)
{
static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':','s','w',':',0};
static const WCHAR instanceW[] = {'\\','I','n','s','t','a','n','c','e',0};
static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
static WCHAR testW[] = {'\\','t','e','s','t',0};
......@@ -321,6 +325,7 @@ static void test_directshow_filter(void)
ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
lstrcpyW(buffer, deviceW);
lstrcatW(buffer, swW);
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
lstrcatW(buffer, testW);
mon = check_display_name(parser, buffer);
......@@ -367,6 +372,7 @@ static void test_directshow_filter(void)
/* name can be anything */
lstrcpyW(buffer, deviceW);
lstrcatW(buffer, swW);
lstrcatW(buffer, testW+1);
mon = check_display_name(parser, buffer);
......@@ -405,7 +411,6 @@ static void test_directshow_filter(void)
static void test_codec(void)
{
static const WCHAR deviceW[] = {'@','d','e','v','i','c','e',':','c','m',':',0};
static WCHAR testW[] = {'\\','t','e','s','t',0};
IParseDisplayName *parser;
IPropertyBag *prop_bag;
......@@ -419,6 +424,7 @@ static void test_codec(void)
ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
lstrcpyW(buffer, deviceW);
lstrcatW(buffer, cmW);
StringFromGUID2(&CLSID_AudioRendererCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
lstrcatW(buffer, testW);
mon = check_display_name(parser, buffer);
......@@ -456,6 +462,70 @@ static void test_codec(void)
IParseDisplayName_Release(parser);
}
static void test_legacy_filter(void)
{
static const WCHAR nameW[] = {'t','e','s','t',0};
IParseDisplayName *parser;
IPropertyBag *prop_bag;
IFilterMapper *mapper;
IMoniker *mon;
WCHAR buffer[200];
VARIANT var;
HRESULT hr;
hr = CoCreateInstance(&CLSID_CDeviceMoniker, NULL, CLSCTX_INPROC, &IID_IParseDisplayName, (void **)&parser);
ok(hr == S_OK, "Failed to create ParseDisplayName: %#x\n", hr);
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IFilterMapper, (void **)&mapper);
ok(hr == S_OK, "Failed to create FilterMapper: %#x\n", hr);
hr = IFilterMapper_RegisterFilter(mapper, CLSID_TestFilter, nameW, 0xdeadbeef);
if (hr == VFW_E_BAD_KEY)
{
win_skip("not enough permissions to register filters\n");
goto end;
}
ok(hr == S_OK, "RegisterFilter failed: %#x\n", hr);
lstrcpyW(buffer, deviceW);
lstrcatW(buffer, cmW);
StringFromGUID2(&CLSID_LegacyAmFilterCategory, buffer + lstrlenW(buffer), CHARS_IN_GUID);
lstrcatW(buffer, backslashW);
StringFromGUID2(&CLSID_TestFilter, buffer + lstrlenW(buffer), CHARS_IN_GUID);
mon = check_display_name(parser, buffer);
ok(find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should be registered\n");
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&prop_bag);
ok(hr == S_OK, "BindToStorage failed: %#x\n", hr);
VariantInit(&var);
hr = IPropertyBag_Read(prop_bag, friendly_name, &var, NULL);
ok(hr == S_OK, "Read failed: %#x\n", hr);
StringFromGUID2(&CLSID_TestFilter, buffer, CHARS_IN_GUID);
ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(buffer), wine_dbgstr_w(V_BSTR(&var)));
VariantClear(&var);
hr = IPropertyBag_Read(prop_bag, clsidW, &var, NULL);
ok(hr == S_OK, "Read failed: %#x\n", hr);
ok(!lstrcmpW(buffer, V_BSTR(&var)), "expected %s, got %s\n",
wine_dbgstr_w(buffer), wine_dbgstr_w(V_BSTR(&var)));
IPropertyBag_Release(prop_bag);
hr = IFilterMapper_UnregisterFilter(mapper, CLSID_TestFilter);
ok(hr == S_OK, "UnregisterFilter failed: %#x\n", hr);
ok(!find_moniker(&CLSID_LegacyAmFilterCategory, mon), "filter should not be registered\n");
IMoniker_Release(mon);
end:
IFilterMapper_Release(mapper);
IParseDisplayName_Release(parser);
}
START_TEST(devenum)
{
IBindCtx *bind_ctx = NULL;
......@@ -478,5 +548,7 @@ START_TEST(devenum)
test_directshow_filter();
test_codec();
test_legacy_filter();
CoUninitialize();
}
......@@ -294,6 +294,24 @@ static void test_legacy_filter_registration(void)
hr = IFilterMapper_UnregisterFilter(mapper, clsid);
ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr);
hr = IFilterMapper2_EnumMatchingFilters(mapper2, &enum_mon, 0, TRUE, MERIT_UNLIKELY, TRUE,
0, NULL, NULL, &GUID_NULL, FALSE, FALSE, 0, NULL, NULL, &GUID_NULL);
ok(hr == S_OK, "IFilterMapper2_EnumMatchingFilters failed: %x\n", hr);
ok(!enum_find_filter(testfilterW, enum_mon), "IFilterMapper2 shouldn't find filter\n");
IEnumMoniker_Release(enum_mon);
found = FALSE;
hr = IFilterMapper_EnumMatchingFilters(mapper, &enum_reg, MERIT_UNLIKELY, TRUE, GUID_NULL, GUID_NULL,
FALSE, FALSE, GUID_NULL, GUID_NULL);
ok(hr == S_OK, "IFilterMapper_EnumMatchingFilters failed with %x\n", hr);
while(!found && IEnumRegFilters_Next(enum_reg, 1, &regfilter, &count) == S_OK)
{
if (!lstrcmpW(regfilter->Name, testfilterW) && IsEqualGUID(&clsid, &regfilter->Clsid))
found = TRUE;
}
IEnumRegFilters_Release(enum_reg);
ok(!found, "IFilterMapper shouldn't find filter\n");
ret = RegDeleteKeyW(HKEY_CLASSES_ROOT, key_name);
ok(!ret, "RegDeleteKeyA failed: %lu\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment