From: Jactry Zeng jzeng@codeweavers.com
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v3: Resent with minor style changes (consistent 8-space indentation, use IsEqualGUID())
dlls/qasf/Makefile.in | 1 + dlls/qasf/asfreader.c | 67 +++++++++++++ dlls/qasf/qasf_classes.idl | 7 ++ dlls/qasf/qasf_main.c | 3 + dlls/qasf/qasf_private.h | 1 + dlls/qasf/tests/Makefile.in | 1 + dlls/qasf/tests/asfreader.c | 192 ++++++++++++++++++++++++++++++++++++ 7 files changed, 272 insertions(+) create mode 100644 dlls/qasf/asfreader.c create mode 100644 dlls/qasf/tests/asfreader.c
diff --git a/dlls/qasf/Makefile.in b/dlls/qasf/Makefile.in index dd02f5a344e..39239d38aea 100644 --- a/dlls/qasf/Makefile.in +++ b/dlls/qasf/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = strmbase dmoguids strmiids uuid ole32 oleaut32 EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ + asfreader.c \ dmowrapper.c \ qasf_main.c
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c new file mode 100644 index 00000000000..e5dbd1d052f --- /dev/null +++ b/dlls/qasf/asfreader.c @@ -0,0 +1,67 @@ +/* + * WM ASF reader + * + * Copyright 2020 Jactry Zeng for CodeWeavers + * + * 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 + */ + +#include "qasf_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(qasf); + +struct asf_reader +{ + struct strmbase_filter filter; +}; + +static inline struct asf_reader *impl_reader_from_strmbase_filter(struct strmbase_filter *iface) +{ + return CONTAINING_RECORD(iface, struct asf_reader, filter); +} + +static struct strmbase_pin *asf_reader_get_pin(struct strmbase_filter *iface, unsigned int index) +{ + return NULL; +} + +static void asf_reader_destroy(struct strmbase_filter *iface) +{ + struct asf_reader *filter = impl_reader_from_strmbase_filter(iface); + + strmbase_filter_cleanup(&filter->filter); + free(filter); +} + +static struct strmbase_filter_ops filter_ops = +{ + .filter_get_pin = asf_reader_get_pin, + .filter_destroy = asf_reader_destroy, +}; + +HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) +{ + struct asf_reader *object; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + strmbase_filter_init(&object->filter, outer, &CLSID_WMAsfReader, &filter_ops); + + TRACE("Created WM ASF reader %p.\n", object); + *out = &object->filter.IUnknown_inner; + + return S_OK; +} diff --git a/dlls/qasf/qasf_classes.idl b/dlls/qasf/qasf_classes.idl index 0acf3806910..b6f6c58fedc 100644 --- a/dlls/qasf/qasf_classes.idl +++ b/dlls/qasf/qasf_classes.idl @@ -25,3 +25,10 @@ uuid(94297043-bd82-4dfd-b0de-8177739c6d20), ] coclass DMOWrapperFilter {} + +[ + helpstring("WM ASF Reader"), + threading(both), + uuid(187463a0-5bb7-11d3-acbe-0080c75e246e), +] +coclass WMAsfReader {} diff --git a/dlls/qasf/qasf_main.c b/dlls/qasf/qasf_main.c index 5df23649f0d..2e65b693fa0 100644 --- a/dlls/qasf/qasf_main.c +++ b/dlls/qasf/qasf_main.c @@ -98,6 +98,7 @@ static const IClassFactoryVtbl class_factory_vtbl = class_factory_LockServer, };
+static struct class_factory asf_reader_cf = {{&class_factory_vtbl}, asf_reader_create}; static struct class_factory dmo_wrapper_cf = {{&class_factory_vtbl}, dmo_wrapper_create};
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) @@ -116,6 +117,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
if (IsEqualGUID(clsid, &CLSID_DMOWrapperFilter)) return IClassFactory_QueryInterface(&dmo_wrapper_cf.IClassFactory_iface, iid, out); + if (IsEqualGUID(clsid, &CLSID_WMAsfReader)) + return IClassFactory_QueryInterface(&asf_reader_cf.IClassFactory_iface, iid, out);
FIXME("%s not available, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/qasf/qasf_private.h b/dlls/qasf/qasf_private.h index bdb2e433b2f..c7e8e92e2ae 100644 --- a/dlls/qasf/qasf_private.h +++ b/dlls/qasf/qasf_private.h @@ -29,6 +29,7 @@ #include "wine/debug.h" #include "wine/strmbase.h"
+HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; HRESULT dmo_wrapper_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN;
#endif /* QASF_PRIVATE_H */ diff --git a/dlls/qasf/tests/Makefile.in b/dlls/qasf/tests/Makefile.in index 793f0d2c4b2..4b8d40671fb 100644 --- a/dlls/qasf/tests/Makefile.in +++ b/dlls/qasf/tests/Makefile.in @@ -2,4 +2,5 @@ TESTDLL = qasf.dll IMPORTS = strmbase dmoguids strmiids uuid msdmo ole32
C_SRCS = \ + asfreader.c \ dmowrapper.c diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c new file mode 100644 index 00000000000..9098d5cfdf5 --- /dev/null +++ b/dlls/qasf/tests/asfreader.c @@ -0,0 +1,192 @@ +/* + * WM ASF reader unit tests + * + * Copyright 2019 Zebediah Figura + * Copyright 2020 Jactry Zeng for CodeWeavers + * + * 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 + */ + +#define COBJMACROS + +#include "dshow.h" +#include "wine/strmbase.h" +#include "wine/test.h" + +#include "initguid.h" + +DEFINE_GUID(IID_IWMHeaderInfo, 0x96406bda, 0x2b2b, 0x11d3, 0xb3, 0x6b, 0x00, 0xc0, 0x4f, 0x61, 0x08, 0xff); +DEFINE_GUID(IID_IWMReaderAdvanced, 0x96406bea, 0x2b2b, 0x11d3, 0xb3, 0x6b, 0x00, 0xc0, 0x4f, 0x61, 0x08, 0xff); +DEFINE_GUID(IID_IWMReaderAdvanced2, 0xae14a945, 0xb90c, 0x4d0d, 0x91, 0x27, 0x80, 0xd6, 0x65, 0xf7, 0xd7, 0x3e); + +static IBaseFilter *create_asf_reader(void) +{ + IBaseFilter *filter = NULL; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_WMAsfReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + return filter; +} + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IBaseFilter *filter = create_asf_reader(); + + check_interface(filter, &IID_IBaseFilter, TRUE); + check_interface(filter, &IID_IMediaFilter, TRUE); + todo_wine check_interface(filter, &IID_IFileSourceFilter, TRUE); + check_interface(filter, &IID_IPersist, TRUE); + check_interface(filter, &IID_IUnknown, TRUE); + + check_interface(filter, &IID_IAMFilterMiscFlags, FALSE); + check_interface(filter, &IID_IMediaSeeking, FALSE); + check_interface(filter, &IID_IReferenceClock, FALSE); + check_interface(filter, &IID_IQualityControl, FALSE); + todo_wine check_interface(filter, &IID_IServiceProvider, TRUE); + todo_wine check_interface(filter, &IID_IWMHeaderInfo, TRUE); + todo_wine check_interface(filter, &IID_IWMReaderAdvanced, TRUE); + todo_wine check_interface(filter, &IID_IWMReaderAdvanced2, TRUE); + + IBaseFilter_Release(filter); +} + +static const GUID test_iid = {0x33333333}; +static LONG outer_ref = 1; + +static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID iid, void **out) +{ + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IBaseFilter) + || IsEqualGUID(iid, &test_iid)) + { + *out = (IUnknown *)0xdeadbeef; + return S_OK; + } + ok(0, "Unexpected call %s.\n", wine_dbgstr_guid(iid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI outer_AddRef(IUnknown *iface) +{ + return InterlockedIncrement(&outer_ref); +} + +static ULONG WINAPI outer_Release(IUnknown *iface) +{ + return InterlockedDecrement(&outer_ref); +} + +static const IUnknownVtbl outer_vtbl = +{ + outer_QueryInterface, + outer_AddRef, + outer_Release, +}; + +static IUnknown test_outer = {&outer_vtbl}; + +static void test_aggregation(void) +{ + IBaseFilter *filter, *filter2; + IUnknown *unk, *unk2; + HRESULT hr; + ULONG ref; + + filter = (IBaseFilter *)0xdeadbeef; + hr = CoCreateInstance(&CLSID_WMAsfReader, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&filter); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!filter, "Got interface %p.\n", filter); + + hr = CoCreateInstance(&CLSID_WMAsfReader, &test_outer, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void **)&unk); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n"); + ref = get_refcount(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + ref = IUnknown_AddRef(unk); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + ref = IUnknown_Release(unk); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); + + hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == unk, "Got unexpected IUnknown %p.\n", unk2); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IBaseFilter, (void **)&filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_QueryInterface(filter, &IID_IUnknown, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &IID_IBaseFilter, (void **)&filter2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(filter2 == (IBaseFilter *)0xdeadbeef, "Got unexpected IBaseFilter %p.\n", filter2); + + hr = IUnknown_QueryInterface(unk, &test_iid, (void **)&unk2); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(!unk2, "Got unexpected IUnknown %p.\n", unk2); + + hr = IBaseFilter_QueryInterface(filter, &test_iid, (void **)&unk2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2); + + IBaseFilter_Release(filter); + ref = IUnknown_Release(unk); + ok(!ref, "Got unexpected refcount %d.\n", ref); + ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); +} + +START_TEST(asfreader) +{ + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + test_interfaces(); + test_aggregation(); + + CoUninitialize(); +}
From: Jactry Zeng jzeng@codeweavers.com
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v3: Resent with minor style changes (standardize trace messages, avoid "This")
dlls/qasf/asfreader.c | 71 +++++++++++++++++++++++++++++++++++++ dlls/qasf/tests/asfreader.c | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index e5dbd1d052f..6d4a05a723e 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qasf); struct asf_reader { struct strmbase_filter filter; + IFileSourceFilter IFileSourceFilter_iface; };
static inline struct asf_reader *impl_reader_from_strmbase_filter(struct strmbase_filter *iface) @@ -45,10 +46,79 @@ static void asf_reader_destroy(struct strmbase_filter *iface) free(filter); }
+static HRESULT asf_reader_query_interface(struct strmbase_filter *iface, REFIID iid, void **out) +{ + struct asf_reader *filter = impl_reader_from_strmbase_filter(iface); + + if (IsEqualGUID(iid, &IID_IFileSourceFilter)) + { + *out = &filter->IFileSourceFilter_iface; + IUnknown_AddRef((IUnknown *)*out); + return S_OK; + } + + return E_NOINTERFACE; +} + static struct strmbase_filter_ops filter_ops = { .filter_get_pin = asf_reader_get_pin, .filter_destroy = asf_reader_destroy, + .filter_query_interface = asf_reader_query_interface, +}; + +static inline struct asf_reader *impl_from_IFileSourceFilter(IFileSourceFilter *iface) +{ + return CONTAINING_RECORD(iface, struct asf_reader, IFileSourceFilter_iface); +} + +static HRESULT WINAPI filesourcefilter_QueryInterface(IFileSourceFilter *iface, REFIID iid, void **out) +{ + struct asf_reader *filter = impl_from_IFileSourceFilter(iface); + + return IBaseFilter_QueryInterface(&filter->filter.IBaseFilter_iface, iid, out); +} + +static ULONG WINAPI filesourcefilter_AddRef(IFileSourceFilter *iface) +{ + struct asf_reader *filter = impl_from_IFileSourceFilter(iface); + + return IBaseFilter_AddRef(&filter->filter.IBaseFilter_iface); +} + +static ULONG WINAPI filesourcefilter_Release(IFileSourceFilter *iface) +{ + struct asf_reader *filter = impl_from_IFileSourceFilter(iface); + + return IBaseFilter_Release(&filter->filter.IBaseFilter_iface); +} + +static HRESULT WINAPI filesourcefilter_Load(IFileSourceFilter *iface, LPCOLESTR filename, const AM_MEDIA_TYPE *type) +{ + struct asf_reader *filter = impl_from_IFileSourceFilter(iface); + + FIXME("filter %p, filename %s, type %p, stub!\n", filter, debugstr_w(filename), type); + strmbase_dump_media_type(type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI filesourcefilter_GetCurFile(IFileSourceFilter *iface, LPOLESTR *filename, AM_MEDIA_TYPE *type) +{ + struct asf_reader *filter = impl_from_IFileSourceFilter(iface); + + FIXME("filter %p, filename %p, type %p, stub!\n", filter, filename, type); + + return E_NOTIMPL; +} + +static const IFileSourceFilterVtbl filesourcefilter_vtbl = +{ + filesourcefilter_QueryInterface, + filesourcefilter_AddRef, + filesourcefilter_Release, + filesourcefilter_Load, + filesourcefilter_GetCurFile, };
HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) @@ -59,6 +129,7 @@ HRESULT asf_reader_create(IUnknown *outer, IUnknown **out) return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, outer, &CLSID_WMAsfReader, &filter_ops); + object->IFileSourceFilter_iface.lpVtbl = &filesourcefilter_vtbl;
TRACE("Created WM ASF reader %p.\n", object); *out = &object->filter.IUnknown_inner; diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c index 9098d5cfdf5..607b1ca5974 100644 --- a/dlls/qasf/tests/asfreader.c +++ b/dlls/qasf/tests/asfreader.c @@ -71,7 +71,7 @@ static void test_interfaces(void)
check_interface(filter, &IID_IBaseFilter, TRUE); check_interface(filter, &IID_IMediaFilter, TRUE); - todo_wine check_interface(filter, &IID_IFileSourceFilter, TRUE); + check_interface(filter, &IID_IFileSourceFilter, TRUE); check_interface(filter, &IID_IPersist, TRUE); check_interface(filter, &IID_IUnknown, TRUE);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=69010
Your paranoid android.
=== debiant (32 bit report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit French report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit WoW report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (64 bit WoW report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
From: Jactry Zeng jzeng@codeweavers.com
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v3: Resent with minor style changes (8-space indentation, avoid IID for things that aren't IIDs), and fix 64-bit test failure
dlls/qasf/asfreader.c | 22 ++++++- dlls/qasf/tests/asfreader.c | 122 ++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+), 2 deletions(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index 6d4a05a723e..de5c563836f 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -26,6 +26,9 @@ struct asf_reader { struct strmbase_filter filter; IFileSourceFilter IFileSourceFilter_iface; + + AM_MEDIA_TYPE type; + WCHAR *filename; };
static inline struct asf_reader *impl_reader_from_strmbase_filter(struct strmbase_filter *iface) @@ -42,6 +45,9 @@ static void asf_reader_destroy(struct strmbase_filter *iface) { struct asf_reader *filter = impl_reader_from_strmbase_filter(iface);
+ free(filter->filename); + FreeMediaType(&filter->type); + strmbase_filter_cleanup(&filter->filter); free(filter); } @@ -97,10 +103,22 @@ static HRESULT WINAPI filesourcefilter_Load(IFileSourceFilter *iface, LPCOLESTR { struct asf_reader *filter = impl_from_IFileSourceFilter(iface);
- FIXME("filter %p, filename %s, type %p, stub!\n", filter, debugstr_w(filename), type); + TRACE("filter %p, filename %s, type %p.\n", filter, debugstr_w(filename), type); strmbase_dump_media_type(type);
- return E_NOTIMPL; + if (!filename) + return E_POINTER; + + if (filter->filename) + return E_FAIL; + + if (!(filter->filename = wcsdup(filename))) + return E_OUTOFMEMORY; + + if (type) + CopyMediaType(&filter->type, type); + + return S_OK; }
static HRESULT WINAPI filesourcefilter_GetCurFile(IFileSourceFilter *iface, LPOLESTR *filename, AM_MEDIA_TYPE *type) diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c index 607b1ca5974..35a2866f463 100644 --- a/dlls/qasf/tests/asfreader.c +++ b/dlls/qasf/tests/asfreader.c @@ -27,6 +27,8 @@
#include "initguid.h"
+static const GUID testguid = {0x22222222, 0x2222, 0x2222, {0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22}}; + DEFINE_GUID(IID_IWMHeaderInfo, 0x96406bda, 0x2b2b, 0x11d3, 0xb3, 0x6b, 0x00, 0xc0, 0x4f, 0x61, 0x08, 0xff); DEFINE_GUID(IID_IWMReaderAdvanced, 0x96406bea, 0x2b2b, 0x11d3, 0xb3, 0x6b, 0x00, 0xc0, 0x4f, 0x61, 0x08, 0xff); DEFINE_GUID(IID_IWMReaderAdvanced2, 0xae14a945, 0xb90c, 0x4d0d, 0x91, 0x27, 0x80, 0xd6, 0x65, 0xf7, 0xd7, 0x3e); @@ -181,12 +183,132 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); }
+static void test_filesourcefilter(void) +{ + IBaseFilter *filter = create_asf_reader(); + IFileSourceFilter *filesource; + IFilterGraph2 *graph; + IEnumPins *enumpins; + AM_MEDIA_TYPE type; + LPOLESTR olepath; + IPin *pins[4]; + HRESULT hr; + ULONG ref; + BYTE *ptr; + + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filesource); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + + hr = IFileSourceFilter_Load(filesource, NULL, NULL); + ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + olepath = (void *)0xdeadbeef; + memset(&type, 0x22, sizeof(type)); + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + todo_wine ok(!olepath, "Got %s.\n", wine_dbgstr_w(olepath)); + todo_wine ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + wine_dbgstr_guid(&type.majortype)); + todo_wine ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + wine_dbgstr_guid(&type.subtype)); + ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); + ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); + todo_wine ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); + todo_wine ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + todo_wine ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + memset(&ptr, 0x22, sizeof(ptr)); + ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); + + hr = IFileSourceFilter_Load(filesource, L"nonexistent.wmv", NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFileSourceFilter_GetCurFile(filesource, NULL, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + hr = IFileSourceFilter_Load(filesource, L"nonexistent2.wmv", NULL); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + + olepath = (void *)0xdeadbeef; + memset(&type, 0x22, sizeof(type)); + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", + wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + wine_dbgstr_guid(&type.majortype)); + ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + wine_dbgstr_guid(&type.subtype)); + ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); + ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); + ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); + ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); + CoTaskMemFree(olepath); + } + + hr = IBaseFilter_EnumPins(filter, &enumpins); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IEnumPins_Next(enumpins, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + IEnumPins_Release(enumpins); + + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_AddFilter(graph, filter, NULL); + todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) + || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* win2008 */, + "Got hr %#x.\n", hr); + + hr = IFileSourceFilter_Load(filesource, L"nonexistent2.wmv", NULL); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + + olepath = (void *)0xdeadbeef; + memset(&type, 0x22, sizeof(type)); + hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", + wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + wine_dbgstr_guid(&type.majortype)); + ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + wine_dbgstr_guid(&type.subtype)); + ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); + ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); + ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); + ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); + CoTaskMemFree(olepath); + } + + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IBaseFilter_Release(filter); + ref = IFileSourceFilter_Release(filesource); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(asfreader) { CoInitializeEx(NULL, COINIT_MULTITHREADED);
test_interfaces(); test_aggregation(); + test_filesourcefilter();
CoUninitialize(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=69011
Your paranoid android.
=== debiant (32 bit report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit French report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit WoW report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (64 bit WoW report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
From: Jactry Zeng jzeng@codeweavers.com
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v3: Resent with minor style changes (avoid This)
dlls/qasf/asfreader.c | 23 ++++++++++- dlls/qasf/tests/asfreader.c | 82 +++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 46 deletions(-)
diff --git a/dlls/qasf/asfreader.c b/dlls/qasf/asfreader.c index de5c563836f..372d03a3902 100644 --- a/dlls/qasf/asfreader.c +++ b/dlls/qasf/asfreader.c @@ -125,9 +125,28 @@ static HRESULT WINAPI filesourcefilter_GetCurFile(IFileSourceFilter *iface, LPOL { struct asf_reader *filter = impl_from_IFileSourceFilter(iface);
- FIXME("filter %p, filename %p, type %p, stub!\n", filter, filename, type); + TRACE("filter %p, filename %p, type %p.\n", filter, filename, type);
- return E_NOTIMPL; + if (!filename) + return E_POINTER; + *filename = NULL; + + if (type) + { + type->majortype = filter->type.majortype; + type->subtype = filter->type.subtype; + type->lSampleSize = filter->type.lSampleSize; + type->pUnk = filter->type.pUnk; + type->cbFormat = filter->type.cbFormat; + } + + if (filter->filename) + { + *filename = CoTaskMemAlloc((wcslen(filter->filename) + 1) * sizeof(WCHAR)); + wcscpy(*filename, filter->filename); + } + + return S_OK; }
static const IFileSourceFilterVtbl filesourcefilter_vtbl = diff --git a/dlls/qasf/tests/asfreader.c b/dlls/qasf/tests/asfreader.c index 35a2866f463..55d2d4404dc 100644 --- a/dlls/qasf/tests/asfreader.c +++ b/dlls/qasf/tests/asfreader.c @@ -211,25 +211,25 @@ static void test_filesourcefilter(void) olepath = (void *)0xdeadbeef; memset(&type, 0x22, sizeof(type)); hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(!olepath, "Got %s.\n", wine_dbgstr_w(olepath)); - todo_wine ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!olepath, "Got %s.\n", wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", wine_dbgstr_guid(&type.majortype)); - todo_wine ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", wine_dbgstr_guid(&type.subtype)); ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); - todo_wine ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); - todo_wine ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); - todo_wine ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); memset(&ptr, 0x22, sizeof(ptr)); ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat);
hr = IFileSourceFilter_Load(filesource, L"nonexistent.wmv", NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IFileSourceFilter_GetCurFile(filesource, NULL, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
hr = IFileSourceFilter_Load(filesource, L"nonexistent2.wmv", NULL); ok(hr == E_FAIL, "Got hr %#x.\n", hr); @@ -237,24 +237,21 @@ static void test_filesourcefilter(void) olepath = (void *)0xdeadbeef; memset(&type, 0x22, sizeof(type)); hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", - wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); - ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", - wine_dbgstr_guid(&type.majortype)); - ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", - wine_dbgstr_guid(&type.subtype)); - ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); - ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); - ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); - ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); - ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); - ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); - ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); - CoTaskMemFree(olepath); - } + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", + wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + wine_dbgstr_guid(&type.majortype)); + ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + wine_dbgstr_guid(&type.subtype)); + ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); + ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); + ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); + ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); + CoTaskMemFree(olepath);
hr = IBaseFilter_EnumPins(filter, &enumpins); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -276,24 +273,21 @@ static void test_filesourcefilter(void) olepath = (void *)0xdeadbeef; memset(&type, 0x22, sizeof(type)); hr = IFileSourceFilter_GetCurFile(filesource, &olepath, &type); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (SUCCEEDED(hr)) - { - ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", - wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); - ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", - wine_dbgstr_guid(&type.majortype)); - ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", - wine_dbgstr_guid(&type.subtype)); - ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); - ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); - ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); - ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); - ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); - ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); - ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); - CoTaskMemFree(olepath); - } + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!wcscmp(olepath, L"nonexistent.wmv"), "Expected path %s, got %s.\n", + wine_dbgstr_w(L"nonexistent.wmv"), wine_dbgstr_w(olepath)); + ok(IsEqualGUID(&type.majortype, &MEDIATYPE_NULL), "Got majortype %s.\n", + wine_dbgstr_guid(&type.majortype)); + ok(IsEqualGUID(&type.subtype, &MEDIASUBTYPE_NULL), "Got subtype %s.\n", + wine_dbgstr_guid(&type.subtype)); + ok(type.bFixedSizeSamples == 0x22222222, "Got fixed size %d.\n", type.bFixedSizeSamples); + ok(type.bTemporalCompression == 0x22222222, "Got temporal compression %d.\n", type.bTemporalCompression); + ok(!type.lSampleSize, "Got sample size %u.\n", type.lSampleSize); + ok(IsEqualGUID(&type.formattype, &testguid), "Got format type %s.\n", wine_dbgstr_guid(&type.formattype)); + ok(!type.pUnk, "Got pUnk %p.\n", type.pUnk); + ok(!type.cbFormat, "Got format size %u.\n", type.cbFormat); + ok(type.pbFormat == ptr, "Got format block %p.\n", type.pbFormat); + CoTaskMemFree(olepath);
ref = IFilterGraph2_Release(graph); ok(!ref, "Got outstanding refcount %d.\n", ref);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=69012
Your paranoid android.
=== debiant (32 bit report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit French report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit WoW report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (64 bit WoW report) ===
qasf: asfreader.c:43: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x004010ce).
Report validation errors: qasf:asfreader crashed (c0000005)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=69009
Your paranoid android.
=== debiant (32 bit report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit French report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Japanese:Japan report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit Chinese:China report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (32 bit WoW report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)
=== debiant (64 bit WoW report) ===
qasf: asfreader.c:41: Test failed: Got hr 0x80040154. Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x0040104e).
Report validation errors: qasf:asfreader crashed (c0000005)