quartz: AMFilterData_ParseFilterData returns a pointer to a pointer to filter data.
This commit is contained in:
parent
c0338afebb
commit
c3e2407664
|
@ -114,6 +114,7 @@ dlls/qmgrprxy/qmgrprxy_p.c
|
||||||
dlls/quartz/fil_data.h
|
dlls/quartz/fil_data.h
|
||||||
dlls/quartz/quartz_strmif.h
|
dlls/quartz/quartz_strmif.h
|
||||||
dlls/quartz/quartz_strmif_p.c
|
dlls/quartz/quartz_strmif_p.c
|
||||||
|
dlls/quartz/tests/fil_data.h
|
||||||
dlls/rpcrt4/epm.h
|
dlls/rpcrt4/epm.h
|
||||||
dlls/rpcrt4/epm_c.c
|
dlls/rpcrt4/epm_c.c
|
||||||
dlls/rpcrt4/tests/server.h
|
dlls/rpcrt4/tests/server.h
|
||||||
|
|
|
@ -1323,6 +1323,7 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IFilterMapper2 *pFileMapper = NULL;
|
IFilterMapper2 *pFileMapper = NULL;
|
||||||
IAMFilterData *pFilterData = NULL;
|
IAMFilterData *pFilterData = NULL;
|
||||||
|
BYTE *ppRF = NULL;
|
||||||
REGFILTER2 *pRF = NULL;
|
REGFILTER2 *pRF = NULL;
|
||||||
WCHAR bufferW[10];
|
WCHAR bufferW[10];
|
||||||
ULONG j;
|
ULONG j;
|
||||||
|
@ -1338,9 +1339,10 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
hr = IAMFilterData_ParseFilterData(pFilterData, pData, cb, (BYTE **)&pRF);
|
hr = IAMFilterData_ParseFilterData(pFilterData, pData, cb, (BYTE **)&ppRF);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
pRF = ((REGFILTER2**)ppRF)[0];
|
||||||
|
|
||||||
snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion);
|
snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion);
|
||||||
hr = add_bstr_property(subcont, szVersionW, bufferW);
|
hr = add_bstr_property(subcont, szVersionW, bufferW);
|
||||||
|
|
|
@ -1732,14 +1732,14 @@ static HRESULT WINAPI AMFilterData_ParseFilterData(IAMFilterData* iface,
|
||||||
{
|
{
|
||||||
FilterMapper3Impl *This = impl_from_IAMFilterData(iface);
|
FilterMapper3Impl *This = impl_from_IAMFilterData(iface);
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
REGFILTER2 *prf2;
|
static REGFILTER2 *prf2;
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%p, %d, %p)\n", This, iface, pData, cb, ppRegFilter2);
|
TRACE("(%p/%p)->(%p, %d, %p)\n", This, iface, pData, cb, ppRegFilter2);
|
||||||
|
|
||||||
prf2 = CoTaskMemAlloc(sizeof(*prf2));
|
prf2 = CoTaskMemAlloc(sizeof(*prf2));
|
||||||
if (!prf2)
|
if (!prf2)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
*ppRegFilter2 = (BYTE *)prf2;
|
*ppRegFilter2 = (BYTE *)&prf2;
|
||||||
|
|
||||||
hr = FM2_ReadFilterData(pData, prf2);
|
hr = FM2_ReadFilterData(pData, prf2);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
|
@ -11,4 +11,6 @@ C_SRCS = \
|
||||||
referenceclock.c \
|
referenceclock.c \
|
||||||
videorenderer.c
|
videorenderer.c
|
||||||
|
|
||||||
|
IDL_H_SRCS = fil_data.idl
|
||||||
|
|
||||||
@MAKE_TEST_RULES@
|
@MAKE_TEST_RULES@
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
import "objidl.idl";
|
||||||
|
import "strmif.idl";
|
||||||
|
import "unknwn.idl";
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* IAMFilterData interface
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* - This interface is deprecated and IFilterMapper2 should be used instead.
|
||||||
|
* - There is no full replacement for IAMFilterData::ParseFilterData short of manually
|
||||||
|
* parsing out the REGFILTER2 struct from the binary blob.
|
||||||
|
*/
|
||||||
|
[
|
||||||
|
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);
|
||||||
|
}
|
|
@ -24,6 +24,9 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "initguid.h"
|
#include "initguid.h"
|
||||||
#include "dshow.h"
|
#include "dshow.h"
|
||||||
|
#include "winternl.h"
|
||||||
|
|
||||||
|
#include "fil_data.h"
|
||||||
|
|
||||||
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
|
||||||
|
|
||||||
|
@ -467,6 +470,70 @@ static void test_register_filter_with_null_clsMinorType(void)
|
||||||
if (pMapper) IFilterMapper2_Release(pMapper);
|
if (pMapper) IFilterMapper2_Release(pMapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_parse_filter_data(void)
|
||||||
|
{
|
||||||
|
static const BYTE data_block[] = {
|
||||||
|
0x02,0x00,0x00,0x00,0xff,0xff,0x5f,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x70,0x69,0x33,
|
||||||
|
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x30,0x74,0x79,0x33,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x31,0x70,0x69,0x33,
|
||||||
|
0x08,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x30,0x74,0x79,0x33,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x76,0x69,0x64,0x73,
|
||||||
|
0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||||
|
|
||||||
|
BYTE *prgbRegFilter2 = NULL;
|
||||||
|
REGFILTER2 *pRegFilter = NULL;
|
||||||
|
IFilterMapper2 *pMapper = NULL;
|
||||||
|
SAFEARRAYBOUND saBound;
|
||||||
|
SAFEARRAY *psa = NULL;
|
||||||
|
LPBYTE pbSAData = NULL;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
IAMFilterData *pData = NULL;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IFilterMapper2, (LPVOID*)&pMapper);
|
||||||
|
ok((hr == S_OK || broken(hr != S_OK)), "CoCreateInstance failed with %x\n", hr);
|
||||||
|
if (FAILED(hr)) goto out;
|
||||||
|
|
||||||
|
hr = IFilterMapper2_QueryInterface(pMapper, &IID_IAMFilterData, (LPVOID*)&pData);
|
||||||
|
ok((hr == S_OK || broken(hr != S_OK)), "Unable to find IID_IAMFilterData interface\n");
|
||||||
|
if (FAILED(hr)) goto out;
|
||||||
|
|
||||||
|
saBound.lLbound = 0;
|
||||||
|
saBound.cElements = sizeof(data_block);
|
||||||
|
psa = SafeArrayCreate(VT_UI1, 1, &saBound);
|
||||||
|
ok(psa != NULL, "Unable to crate safe array\n");
|
||||||
|
if (!psa) goto out;
|
||||||
|
hr = SafeArrayAccessData(psa, (LPVOID *)&pbSAData);
|
||||||
|
ok(hr == S_OK, "Unable to access array data\n");
|
||||||
|
if (FAILED(hr)) goto out;
|
||||||
|
memcpy(pbSAData, data_block, sizeof(data_block));
|
||||||
|
|
||||||
|
hr = IAMFilterData_ParseFilterData(pData, pbSAData, sizeof(data_block), &prgbRegFilter2);
|
||||||
|
/* We cannot do anything here. prgbRegFilter2 is very unstable */
|
||||||
|
/* Pre Vista, this is a stack pointer so anything that changes the stack invalidats it */
|
||||||
|
/* Post Vista, it is a static pointer in the data section of the module */
|
||||||
|
pRegFilter =((REGFILTER2**)prgbRegFilter2)[0];
|
||||||
|
ok (hr==S_OK,"Failed to Parse filter Data\n");
|
||||||
|
|
||||||
|
ok(IsBadReadPtr(prgbRegFilter2,sizeof(REGFILTER2**))==0,"Bad read pointer returned\n");
|
||||||
|
ok(IsBadReadPtr(pRegFilter,sizeof(REGFILTER2*))==0,"Bad read pointer for FilterData\n");
|
||||||
|
ok(pRegFilter->dwMerit == 0x5fffff,"Incorrect merit returned\n");
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (pRegFilter)
|
||||||
|
CoTaskMemFree(pRegFilter);
|
||||||
|
if (psa)
|
||||||
|
{
|
||||||
|
SafeArrayUnaccessData(psa);
|
||||||
|
SafeArrayDestroy(psa);
|
||||||
|
}
|
||||||
|
if (pData)
|
||||||
|
IAMFilterData_Release(pData);
|
||||||
|
if (pMapper)
|
||||||
|
IFilterMapper2_Release(pMapper);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(filtermapper)
|
START_TEST(filtermapper)
|
||||||
{
|
{
|
||||||
|
@ -476,6 +543,7 @@ START_TEST(filtermapper)
|
||||||
test_legacy_filter_registration();
|
test_legacy_filter_registration();
|
||||||
test_ifiltermapper_from_filtergraph();
|
test_ifiltermapper_from_filtergraph();
|
||||||
test_register_filter_with_null_clsMinorType();
|
test_register_filter_with_null_clsMinorType();
|
||||||
|
test_parse_filter_data();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue