winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2019
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
1097 discussions
Start a n
N
ew thread
Zebediah Figura : quartz/tests: Add some tests for IBaseFilter_FindPin().
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: bd948bb4830227e12dc192ff1f1e61895a623f02 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bd948bb4830227e12dc192ff…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Feb 28 19:00:28 2019 -0600 quartz/tests: Add some tests for IBaseFilter_FindPin(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/mpegsplit.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 4cf1633..eb81479 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -25,6 +25,7 @@ static const WCHAR mp3file[] = {'t','e','s','t','.','m','p','3',0}; static const WCHAR inputW[] = {'I','n','p','u','t',0}; +static const WCHAR audioW[] = {'A','u','d','i','o',0}; static IBaseFilter *create_mpeg_splitter(void) { @@ -269,12 +270,66 @@ todo_wine ok(ret, "Failed to delete file, error %u.\n", GetLastError()); } +static void test_find_pin(void) +{ + static const WCHAR input_pinW[] = {'i','n','p','u','t',' ','p','i','n',0}; + const WCHAR *filename = load_resource(mp3file); + IBaseFilter *filter = create_mpeg_splitter(); + IFilterGraph2 *graph; + IEnumPins *enum_pins; + IPin *pin, *pin2; + HRESULT hr; + ULONG ref; + BOOL ret; + + hr = IBaseFilter_FindPin(filter, input_pinW, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, inputW, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pin); + + hr = IBaseFilter_FindPin(filter, audioW, &pin); + ok(hr == VFW_E_NOT_FOUND, "Got hr %#x.\n", hr); + + graph = connect_input(filter, filename); + + hr = IBaseFilter_EnumPins(filter, &enum_pins); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, inputW, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin); + IPin_Release(pin); + IPin_Release(pin2); + + hr = IEnumPins_Next(enum_pins, 1, &pin2, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_FindPin(filter, audioW, &pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(pin == pin2, "Expected pin %p, got %p.\n", pin2, pin); + IPin_Release(pin); + IPin_Release(pin2); + + IEnumPins_Release(enum_pins); + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + START_TEST(mpegsplit) { CoInitialize(NULL); test_interfaces(); test_enum_pins(); + test_find_pin(); CoUninitialize(); }
1
0
0
0
Zebediah Figura : quartz/tests: Add some tests for IBaseFilter_EnumPins().
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 10b88be91d95fbcf26962c1a2fb097b91c61ab31 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=10b88be91d95fbcf26962c1a…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Feb 28 19:00:27 2019 -0600 quartz/tests: Add some tests for IBaseFilter_EnumPins(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/mpegsplit.c | 198 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index caadfbe..4cf1633 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -22,6 +22,10 @@ #include "dshow.h" #include "wine/test.h" +static const WCHAR mp3file[] = {'t','e','s','t','.','m','p','3',0}; + +static const WCHAR inputW[] = {'I','n','p','u','t',0}; + static IBaseFilter *create_mpeg_splitter(void) { IBaseFilter *filter = NULL; @@ -31,6 +35,70 @@ static IBaseFilter *create_mpeg_splitter(void) return filter; } +static WCHAR *load_resource(const WCHAR *name) +{ + static WCHAR pathW[MAX_PATH]; + DWORD written; + HANDLE file; + HRSRC res; + void *ptr; + + GetTempPathW(ARRAY_SIZE(pathW), pathW); + lstrcatW(pathW, name); + + file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "Failed to create file %s, error %u.\n", + wine_dbgstr_w(pathW), GetLastError()); + + res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA); + ok(!!res, "Failed to load resource, error %u.\n", GetLastError()); + ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res)); + WriteFile(file, ptr, SizeofResource( GetModuleHandleA(NULL), res), &written, NULL); + ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write resource.\n"); + CloseHandle(file); + + return pathW; +} + +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +static IFilterGraph2 *connect_input(IBaseFilter *splitter, const WCHAR *filename) +{ + static const WCHAR outputW[] = {'O','u','t','p','u','t',0}; + IFileSourceFilter *filesource; + IFilterGraph2 *graph; + IBaseFilter *reader; + IPin *source, *sink; + HRESULT hr; + + CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **)&reader); + IBaseFilter_QueryInterface(reader, &IID_IFileSourceFilter, (void **)&filesource); + IFileSourceFilter_Load(filesource, filename, NULL); + + CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterGraph2, (void **)&graph); + IFilterGraph2_AddFilter(graph, reader, NULL); + IFilterGraph2_AddFilter(graph, splitter, NULL); + + IBaseFilter_FindPin(splitter, inputW, &sink); + IBaseFilter_FindPin(reader, outputW, &source); + + hr = IFilterGraph2_ConnectDirect(graph, source, sink, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IPin_Release(source); + IPin_Release(sink); + IBaseFilter_Release(reader); + IFileSourceFilter_Release(filesource); + return graph; +} + #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) { @@ -72,11 +140,141 @@ static void test_interfaces(void) IBaseFilter_Release(filter); } +static void test_enum_pins(void) +{ + const WCHAR *filename = load_resource(mp3file); + IBaseFilter *filter = create_mpeg_splitter(); + IEnumPins *enum1, *enum2; + IFilterGraph2 *graph; + ULONG count, ref; + IPin *pins[3]; + HRESULT hr; + BOOL ret; + + ref = get_refcount(filter); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + hr = IBaseFilter_EnumPins(filter, &enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); + ok(ref == 2, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ref = get_refcount(filter); +todo_wine + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(pins[0]); +todo_wine + ok(ref == 3, "Got unexpected refcount %d.\n", ref); + ref = get_refcount(enum1); + ok(ref == 1, "Got unexpected refcount %d.\n", ref); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!count, "Got count %u.\n", count); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, NULL); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + IPin_Release(pins[0]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Clone(enum1, &enum2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 2); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Skip(enum1, 1); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum2, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + IEnumPins_Release(enum2); + + graph = connect_input(filter, filename); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); +todo_wine + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + IPin_Release(pins[0]); + + hr = IEnumPins_Next(enum1, 1, pins, NULL); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 2, pins, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + hr = IEnumPins_Reset(enum1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IEnumPins_Next(enum1, 3, pins, &count); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(count == 2, "Got count %u.\n", count); + IPin_Release(pins[0]); + IPin_Release(pins[1]); + + IEnumPins_Release(enum1); + IFilterGraph2_Release(graph); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ret = DeleteFileW(filename); + ok(ret, "Failed to delete file, error %u.\n", GetLastError()); +} + START_TEST(mpegsplit) { CoInitialize(NULL); test_interfaces(); + test_enum_pins(); CoUninitialize(); }
1
0
0
0
Zebediah Figura : quartz/mpegsplit: Fix sink pin name.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: dc6e0a6cb51a6216ead828947fb94d35fdfa353b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=dc6e0a6cb51a6216ead82894…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Thu Feb 28 19:00:26 2019 -0600 quartz/mpegsplit: Fix sink pin name. This fixes a bug with Neocron 2, which uses FindPin() to retrieve the sink pin. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/avisplit.c | 7 ++++++- dlls/quartz/mpegsplit.c | 6 +++++- dlls/quartz/parser.c | 10 +++++++--- dlls/quartz/parser.h | 7 +++++-- dlls/quartz/waveparser.c | 6 +++++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 6f27c29..40020bb 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -1429,6 +1429,7 @@ static const IBaseFilterVtbl AVISplitterImpl_Vtbl = HRESULT AVISplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) { + static const WCHAR sink_name[] = {'i','n','p','u','t',' ','p','i','n',0}; HRESULT hr; AVISplitterImpl * This; @@ -1445,7 +1446,11 @@ HRESULT AVISplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) This->streams = NULL; This->oldindex = NULL; - hr = Parser_Create(&(This->Parser), &AVISplitterImpl_Vtbl, &CLSID_AviSplitter, AVISplitter_Sample, AVISplitter_QueryAccept, AVISplitter_InputPin_PreConnect, AVISplitter_Flush, AVISplitter_Disconnect, AVISplitter_first_request, AVISplitter_done_process, NULL, AVISplitter_seek, NULL); + hr = Parser_Create(&This->Parser, &AVISplitterImpl_Vtbl, &CLSID_AviSplitter, + sink_name, AVISplitter_Sample, AVISplitter_QueryAccept, + AVISplitter_InputPin_PreConnect, AVISplitter_Flush, + AVISplitter_Disconnect, AVISplitter_first_request, + AVISplitter_done_process, NULL, AVISplitter_seek, NULL); if (FAILED(hr)) return hr; diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index 5869f16..226fcac 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -870,6 +870,7 @@ static const IAMStreamSelectVtbl AMStreamSelectVtbl = HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) { + static const WCHAR sink_name[] = {'I','n','p','u','t',0}; MPEGSplitterImpl *This; HRESULT hr = E_FAIL; @@ -885,7 +886,10 @@ HRESULT MPEGSplitter_create(IUnknown * pUnkOuter, LPVOID * ppv) return E_OUTOFMEMORY; ZeroMemory(This, sizeof(MPEGSplitterImpl)); - hr = Parser_Create(&(This->Parser), &MPEGSplitter_Vtbl, &CLSID_MPEG1Splitter, MPEGSplitter_process_sample, MPEGSplitter_query_accept, MPEGSplitter_pre_connect, MPEGSplitter_cleanup, MPEGSplitter_disconnect, MPEGSplitter_first_request, NULL, NULL, MPEGSplitter_seek, NULL); + hr = Parser_Create(&This->Parser, &MPEGSplitter_Vtbl, &CLSID_MPEG1Splitter, + sink_name, MPEGSplitter_process_sample, MPEGSplitter_query_accept, + MPEGSplitter_pre_connect, MPEGSplitter_cleanup, MPEGSplitter_disconnect, + MPEGSplitter_first_request, NULL, NULL, MPEGSplitter_seek, NULL); if (FAILED(hr)) { CoTaskMemFree(This); diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 664cecf..b0cb500 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -35,7 +35,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz); -static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; static const IMediaSeekingVtbl Parser_Seeking_Vtbl; static const IPinVtbl Parser_OutputPin_Vtbl; static const IPinVtbl Parser_InputPin_Vtbl; @@ -93,7 +92,12 @@ static const BaseFilterFuncTable BaseFuncTable = { Parser_GetPinCount }; -HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, const CLSID* pClsid, PFN_PROCESS_SAMPLE fnProcessSample, PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect, PFN_CLEANUP fnCleanup, PFN_DISCONNECT fnDisconnect, REQUESTPROC fnRequest, STOPPROCESSPROC fnDone, SourceSeeking_ChangeStop stop, SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) +HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *Parser_Vtbl, + const CLSID* pClsid, const WCHAR *sink_name, PFN_PROCESS_SAMPLE fnProcessSample, + PFN_QUERY_ACCEPT fnQueryAccept, PFN_PRE_CONNECT fnPreConnect, + PFN_CLEANUP fnCleanup, PFN_DISCONNECT fnDisconnect, REQUESTPROC fnRequest, + STOPPROCESSPROC fnDone, SourceSeeking_ChangeStop stop, + SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) { HRESULT hr; PIN_INFO piInput; @@ -109,7 +113,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c /* construct input pin */ piInput.dir = PINDIR_INPUT; piInput.pFilter = &pParser->filter.IBaseFilter_iface; - lstrcpynW(piInput.achName, wcsInputPinName, ARRAY_SIZE(piInput.achName)); + lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName)); if (!start) start = Parser_ChangeStart; diff --git a/dlls/quartz/parser.h b/dlls/quartz/parser.h index 840e475..8660cf2 100644 --- a/dlls/quartz/parser.h +++ b/dlls/quartz/parser.h @@ -53,8 +53,11 @@ typedef struct Parser_OutputPin extern HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt); -extern HRESULT Parser_Create(ParserImpl*, const IBaseFilterVtbl *, const CLSID*, PFN_PROCESS_SAMPLE, PFN_QUERY_ACCEPT, PFN_PRE_CONNECT, - PFN_CLEANUP, PFN_DISCONNECT, REQUESTPROC, STOPPROCESSPROC, SourceSeeking_ChangeStop stop, SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate); +HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, + const CLSID *clsid, const WCHAR *sink_name, PFN_PROCESS_SAMPLE, + PFN_QUERY_ACCEPT, PFN_PRE_CONNECT, PFN_CLEANUP, PFN_DISCONNECT, + REQUESTPROC, STOPPROCESSPROC, SourceSeeking_ChangeStop, + SourceSeeking_ChangeStart, SourceSeeking_ChangeRate) DECLSPEC_HIDDEN; /* Override the _Release function and call this when releasing */ extern void Parser_Destroy(ParserImpl *This); diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index fa9cd45..834b634 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -417,6 +417,7 @@ static const IBaseFilterVtbl WAVEParser_Vtbl = HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) { + static const WCHAR sink_name[] = {'i','n','p','u','t',' ','p','i','n',0}; HRESULT hr; WAVEParserImpl * This; @@ -430,7 +431,10 @@ HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) /* Note: This memory is managed by the transform filter once created */ This = CoTaskMemAlloc(sizeof(WAVEParserImpl)); - hr = Parser_Create(&(This->Parser), &WAVEParser_Vtbl, &CLSID_WAVEParser, WAVEParser_Sample, WAVEParser_QueryAccept, WAVEParser_InputPin_PreConnect, WAVEParser_Cleanup, WAVEParser_disconnect, WAVEParser_first_request, NULL, NULL, WAVEParserImpl_seek, NULL); + hr = Parser_Create(&This->Parser, &WAVEParser_Vtbl, &CLSID_WAVEParser, + sink_name, WAVEParser_Sample, WAVEParser_QueryAccept, + WAVEParser_InputPin_PreConnect, WAVEParser_Cleanup, WAVEParser_disconnect, + WAVEParser_first_request, NULL, NULL, WAVEParserImpl_seek, NULL); if (FAILED(hr)) return hr;
1
0
0
0
Nikolay Sivov : user32: Make GetWindowLong() fail for some values on 64-bit.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: c2f4e2b338906918c77634631ff82f106570e02e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c2f4e2b338906918c7763463…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 00:53:43 2019 +0300 user32: Make GetWindowLong() fail for some values on 64-bit. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/win.c | 4 ---- dlls/user32/win.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index d9a8e85..639eef4 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -6346,7 +6346,6 @@ static void test_set_window_long_size(void) /* GWLP_WNDPROC */ SetLastError(0xdeadbeef); wnd_proc = (WNDPROC)(LONG_PTR)GetWindowLongA(hwnd, GWLP_WNDPROC); -todo_wine ok(!wnd_proc && GetLastError() == ERROR_INVALID_INDEX, "Unexpected window proc.\n"); wnd_proc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_WNDPROC); @@ -6427,12 +6426,10 @@ todo_wine SetLastError(0xdeadbeef); ret = GetWindowLongA(hwnd, GWLP_HINSTANCE); -todo_wine ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected instance %#x.\n", ret); SetLastError(0xdeadbeef); ret = GetWindowLongW(hwnd, GWLP_HINSTANCE); -todo_wine ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected instance %#x.\n", ret); SetLastError(0xdeadbeef); @@ -6451,7 +6448,6 @@ todo_wine /* GWLP_HWNDPARENT */ SetLastError(0xdeadbeef); ret = GetWindowLongA(hwnd, GWLP_HWNDPARENT); -todo_wine ok(!ret && GetLastError() == ERROR_INVALID_INDEX, "Unexpected parent window %#x.\n", ret); SetLastError(0xdeadbeef); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index f5ac867..0bb9fd9 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -2690,7 +2690,19 @@ WORD WINAPI GetWindowWord( HWND hwnd, INT offset ) */ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset ) { - return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), FALSE ); + switch (offset) + { +#ifdef _WIN64 + case GWLP_WNDPROC: + case GWLP_HINSTANCE: + case GWLP_HWNDPARENT: + WARN( "Invalid offset %d\n", offset ); + SetLastError( ERROR_INVALID_INDEX ); + return 0; +#endif + default: + return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), FALSE ); + } } @@ -2699,7 +2711,19 @@ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset ) */ LONG WINAPI GetWindowLongW( HWND hwnd, INT offset ) { - return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), TRUE ); + switch (offset) + { +#ifdef _WIN64 + case GWLP_WNDPROC: + case GWLP_HINSTANCE: + case GWLP_HWNDPARENT: + WARN( "Invalid offset %d\n", offset ); + SetLastError( ERROR_INVALID_INDEX ); + return 0; +#endif + default: + return WIN_GetWindowLong( hwnd, offset, sizeof(LONG), TRUE ); + } }
1
0
0
0
Nikolay Sivov : user32: Do not touch some of the values on 64-bit with SetWindowLong().
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: d00ed8e7b94390f831873278b399b6862f3cc484 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d00ed8e7b94390f831873278…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 00:53:42 2019 +0300 user32: Do not touch some of the values on 64-bit with SetWindowLong(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/win.c | 230 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/user32/win.c | 31 ++++++- 2 files changed, 258 insertions(+), 3 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d00ed8e7b94390f83187…
1
0
0
0
Alexandre Julliard : winebuild: Make relay entry points hot-patchable.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 9d0ba368da20efb05eafabcc3cf8b8e62d1e40c6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9d0ba368da20efb05eafabcc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Mar 1 12:39:39 2019 +0100 winebuild: Make relay entry points hot-patchable. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/winebuild/spec32.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index d4091c2..132ab88 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -218,13 +218,14 @@ static void output_relay_debug( DLLSPEC *spec ) if (!needs_relay( odp )) continue; - output( "\t.align %d\n", get_alignment(4) ); - output( ".L__wine_spec_relay_entry_point_%d:\n", i ); - output_cfi( ".cfi_startproc" ); - switch (target_cpu) { case CPU_x86: + output( "\t.align %d\n", get_alignment(4) ); + output( "\t.long 0x90909090,0x90909090\n" ); + output( ".L__wine_spec_relay_entry_point_%d:\n", i ); + output_cfi( ".cfi_startproc" ); + output( "\t.byte 0x8b,0xff,0x55,0x8b,0xec,0x5d\n" ); /* hotpatch prolog */ if (odp->flags & (FLAG_THISCALL | FLAG_FASTCALL)) /* add the register arguments */ { output( "\tpopl %%eax\n" ); @@ -251,6 +252,7 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tret $%u\n", get_args_size( odp )); else output( "\tret\n" ); + output_cfi( ".cfi_endproc" ); break; case CPU_ARM: @@ -263,6 +265,9 @@ static void output_relay_debug( DLLSPEC *spec ) has_float = is_float_arg( odp, j ); val = (odp->u.func.args_str_offset << 16) | (i - spec->base); + output( "\t.align %d\n", get_alignment(4) ); + output( ".L__wine_spec_relay_entry_point_%d:\n", i ); + output_cfi( ".cfi_startproc" ); output( "\tpush {r0-r3}\n" ); output( "\tmov r2, SP\n"); if (has_float) output( "\tvpush {s0-s15}\n" ); @@ -279,10 +284,14 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tadd SP, #%u\n", 24 + (has_float ? 64 : 0) ); output( "\tbx IP\n"); output( "2:\t.long .L__wine_spec_relay_descr-1b\n" ); + output_cfi( ".cfi_endproc" ); break; } case CPU_ARM64: + output( "\t.align %d\n", get_alignment(4) ); + output( ".L__wine_spec_relay_entry_point_%d:\n", i ); + output_cfi( ".cfi_startproc" ); switch (odp->u.func.nb_args) { default: @@ -314,9 +323,14 @@ static void output_relay_debug( DLLSPEC *spec ) if (odp->u.func.nb_args) output( "\tadd SP, SP, #%u\n", 8 * ((min(odp->u.func.nb_args, 8) + 1) & ~1) ); output( "\tret\n"); + output_cfi( ".cfi_endproc" ); break; case CPU_x86_64: + output( "\t.align %d\n", get_alignment(4) ); + output( "\t.long 0x90909090,0x90909090\n" ); + output( ".L__wine_spec_relay_entry_point_%d:\n", i ); + output_cfi( ".cfi_startproc" ); switch (odp->u.func.nb_args) { default: output( "\tmovq %%%s,32(%%rsp)\n", is_float_arg( odp, 3 ) ? "xmm3" : "r9" ); @@ -333,12 +347,12 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" ); output( "\tcallq *8(%%rcx)\n" ); output( "\tret\n" ); + output_cfi( ".cfi_endproc" ); break; default: assert(0); } - output_cfi( ".cfi_endproc" ); } }
1
0
0
0
Alexandre Julliard : winebuild: Use stdcall for fastcall wrappers.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 26bbbb7b73dcd345f5f89b9c48ace1f65f038ede URL:
https://source.winehq.org/git/wine.git/?a=commit;h=26bbbb7b73dcd345f5f89b9c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Mar 1 10:30:56 2019 +0100 winebuild: Use stdcall for fastcall wrappers. This allows catching mismatched argument lists. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/hal/hal.c | 4 ++-- dlls/ntdll/rtl.c | 2 +- dlls/ntoskrnl.exe/ntoskrnl_private.h | 4 ++-- tools/winebuild/spec32.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/hal/hal.c b/dlls/hal/hal.c index d663c44..269a551 100644 --- a/dlls/hal/hal.c +++ b/dlls/hal/hal.c @@ -36,13 +36,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntoskrnl); #ifdef __i386__ #define DEFINE_FASTCALL1_WRAPPER(func) \ - __ASM_GLOBAL_FUNC( __fastcall_ ## func, \ + __ASM_STDCALL_FUNC( __fastcall_ ## func, 4, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ "jmp " __ASM_NAME(#func) __ASM_STDCALL(4) ) #define DEFINE_FASTCALL_WRAPPER(func,args) \ - __ASM_GLOBAL_FUNC( __fastcall_ ## func, \ + __ASM_STDCALL_FUNC( __fastcall_ ## func, args, \ "popl %eax\n\t" \ "pushl %edx\n\t" \ "pushl %ecx\n\t" \ diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index d13ec31..755cc6e 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -52,7 +52,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll); #ifdef __i386__ #define DEFINE_FASTCALL_WRAPPER(func,args) \ - __ASM_GLOBAL_FUNC( __fastcall_ ## func, \ + __ASM_STDCALL_FUNC( __fastcall_ ## func, args, \ "popl %eax\n\t" \ "pushl %edx\n\t" \ "pushl %ecx\n\t" \ diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index c4002e8..440e638 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -30,13 +30,13 @@ struct _OBJECT_TYPE { #ifdef __i386__ #define DEFINE_FASTCALL1_WRAPPER(func) \ - __ASM_GLOBAL_FUNC( __fastcall_ ## func, \ + __ASM_STDCALL_FUNC( __fastcall_ ## func, 4, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ "jmp " __ASM_NAME(#func) __ASM_STDCALL(4) ) #define DEFINE_FASTCALL_WRAPPER(func,args) \ - __ASM_GLOBAL_FUNC( __fastcall_ ## func, \ + __ASM_STDCALL_FUNC( __fastcall_ ## func, args, \ "popl %eax\n\t" \ "pushl %edx\n\t" \ "pushl %ecx\n\t" \ diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 44d1c2c..d4091c2 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -968,7 +968,7 @@ void output_def_file( DLLSPEC *spec, int include_private ) else if (strcmp(name, odp->link_name)) /* try to reduce output */ { output( "=%s", odp->link_name ); - if (!kill_at && target_cpu == CPU_x86 && !(odp->flags & (FLAG_THISCALL | FLAG_FASTCALL))) + if (!kill_at && target_cpu == CPU_x86 && !(odp->flags & FLAG_THISCALL)) output( "@%d", at_param ); } break;
1
0
0
0
Nikolay Sivov : mfplat: Fail to create user queues on uninitialized platform.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 5e1b3b2f5aaf17d90fad39864dec1caa077d5bfe URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5e1b3b2f5aaf17d90fad3986…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:15 2019 +0300 mfplat: Fail to create user queues on uninitialized platform. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 5 +++++ dlls/mfplat/mfplat_private.h | 1 + dlls/mfplat/queue.c | 3 +++ dlls/mfplat/tests/mfplat.c | 53 +++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 2d82589..a8963ca 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -521,6 +521,11 @@ HRESULT WINAPI MFUnlockPlatform(void) return S_OK; } +BOOL is_platform_locked(void) +{ + return platform_lock > 0; +} + /*********************************************************************** * MFCopyImage (mfplat.@) */ diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h index 2d9e7d5..ac35ff2 100644 --- a/dlls/mfplat/mfplat_private.h +++ b/dlls/mfplat/mfplat_private.h @@ -18,3 +18,4 @@ extern void init_system_queues(void) DECLSPEC_HIDDEN; extern void shutdown_system_queues(void) DECLSPEC_HIDDEN; +extern BOOL is_platform_locked(void) DECLSPEC_HIDDEN; diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index 23e54a5..f470cb4 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -543,6 +543,9 @@ static HRESULT alloc_user_queue(MFASYNC_WORKQUEUE_TYPE queue_type, DWORD *queue_ *queue_id = MFASYNC_CALLBACK_QUEUE_UNDEFINED; + if (!is_platform_locked()) + return MF_E_SHUTDOWN; + queue = heap_alloc_zero(sizeof(*queue)); if (!queue) return E_OUTOFMEMORY; diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index fa77929..2a2189b 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -837,6 +837,7 @@ static void test_MFCreateAsyncResult(void) static void test_startup(void) { + DWORD queue; HRESULT hr; hr = MFStartup(MAKELONG(MF_API_VERSION, 0xdead), MFSTARTUP_FULL); @@ -845,8 +846,58 @@ static void test_startup(void) hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); + hr = MFAllocateWorkQueue(&queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + hr = MFUnlockWorkQueue(queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + hr = MFShutdown(); - ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + hr = MFAllocateWorkQueue(&queue); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + /* Already shut down, has no effect. */ + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); + + hr = MFAllocateWorkQueue(&queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + hr = MFUnlockWorkQueue(queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + /* Platform lock. */ + hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); + ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); + + hr = MFAllocateWorkQueue(&queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + hr = MFUnlockWorkQueue(queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + + /* Unlocking implies shutdown. */ + hr = MFUnlockPlatform(); + ok(hr == S_OK, "Failed to unlock, %#x.\n", hr); + + hr = MFAllocateWorkQueue(&queue); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = MFLockPlatform(); + ok(hr == S_OK, "Failed to lock, %#x.\n", hr); + + hr = MFAllocateWorkQueue(&queue); + ok(hr == S_OK, "Failed to allocate a queue, hr %#x.\n", hr); + hr = MFUnlockWorkQueue(queue); + ok(hr == S_OK, "Failed to unlock the queue, hr %#x.\n", hr); + + hr = MFShutdown(); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); } static void test_allocate_queue(void)
1
0
0
0
Nikolay Sivov : mfplat: Cleanup user queues.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: 48b713efab642c36467a96122edf0c4d7422f64a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=48b713efab642c36467a9612…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:14 2019 +0300 mfplat: Cleanup user queues. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/queue.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index c793caa..23e54a5 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -254,6 +254,28 @@ static HRESULT lock_user_queue(DWORD queue) return hr; } +static void shutdown_queue(struct queue *queue) +{ + struct work_item *item, *item2; + + if (!queue->pool) + return; + + CloseThreadpoolCleanupGroupMembers(queue->env.CleanupGroup, TRUE, NULL); + CloseThreadpool(queue->pool); + queue->pool = NULL; + + EnterCriticalSection(&queue->cs); + LIST_FOR_EACH_ENTRY_SAFE(item, item2, &queue->pending_items, struct work_item, entry) + { + list_remove(&item->entry); + release_work_item(item); + } + LeaveCriticalSection(&queue->cs); + + DeleteCriticalSection(&queue->cs); +} + static HRESULT unlock_user_queue(DWORD queue) { HRESULT hr = MF_E_INVALID_WORKQUEUE; @@ -268,6 +290,8 @@ static HRESULT unlock_user_queue(DWORD queue) { if (--entry->refcount == 0) { + shutdown_queue((struct queue *)entry->obj); + heap_free(entry->obj); entry->obj = next_free_user_queue; next_free_user_queue = entry; } @@ -277,28 +301,6 @@ static HRESULT unlock_user_queue(DWORD queue) return hr; } -static void shutdown_queue(struct queue *queue) -{ - struct work_item *item, *item2; - - if (!queue->pool) - return; - - CloseThreadpoolCleanupGroupMembers(queue->env.CleanupGroup, TRUE, NULL); - CloseThreadpool(queue->pool); - queue->pool = NULL; - - EnterCriticalSection(&queue->cs); - LIST_FOR_EACH_ENTRY_SAFE(item, item2, &queue->pending_items, struct work_item, entry) - { - list_remove(&item->entry); - release_work_item(item); - } - LeaveCriticalSection(&queue->cs); - - DeleteCriticalSection(&queue->cs); -} - void shutdown_system_queues(void) { unsigned int i;
1
0
0
0
Nikolay Sivov : mfplat: Add support for scheduled items.
by Alexandre Julliard
01 Mar '19
01 Mar '19
Module: wine Branch: master Commit: a23e658a015524ddff824bdb1995469ce8c611af URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a23e658a015524ddff824bdb…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri Mar 1 11:03:13 2019 +0300 mfplat: Add support for scheduled items. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/queue.c | 70 ++++++++++++++++++++++++++++++++++++++++++++-- dlls/mfplat/tests/mfplat.c | 6 +--- 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index 1434645..c793caa 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); #define MAX_USER_QUEUE_HANDLES 124 #define WAIT_ITEM_KEY_MASK (0x82000000) +#define SCHEDULED_ITEM_KEY_MASK (0x80000000) static LONG next_item_key; @@ -53,6 +54,7 @@ struct work_item union { TP_WAIT *wait_object; + TP_TIMER *timer_object; } u; }; @@ -414,6 +416,30 @@ static void CALLBACK waiting_item_cancelable_callback(TP_CALLBACK_INSTANCE *inst release_work_item(item); } +static void CALLBACK scheduled_item_callback(TP_CALLBACK_INSTANCE *instance, void *context, TP_TIMER *timer) +{ + struct work_item *item = context; + + TRACE("result object %p.\n", item->result); + + invoke_async_callback(item->result); + + release_work_item(item); +} + +static void CALLBACK scheduled_item_cancelable_callback(TP_CALLBACK_INSTANCE *instance, void *context, TP_TIMER *timer) +{ + struct work_item *item = context; + + TRACE("result object %p.\n", item->result); + + queue_release_pending_item(item); + + invoke_async_callback(item->result); + + release_work_item(item); +} + static void queue_mark_item_pending(DWORD mask, struct work_item *item, MFWORKITEM_KEY *key) { *key = generate_item_key(mask); @@ -450,6 +476,36 @@ static HRESULT queue_submit_wait(struct queue *queue, HANDLE event, LONG priorit return S_OK; } +static HRESULT queue_submit_timer(struct queue *queue, IMFAsyncResult *result, INT64 timeout, MFWORKITEM_KEY *key) +{ + PTP_TIMER_CALLBACK callback; + struct work_item *item; + FILETIME filetime; + LARGE_INTEGER t; + + if (!(item = alloc_work_item(queue, result))) + return E_OUTOFMEMORY; + + if (key) + { + queue_mark_item_pending(SCHEDULED_ITEM_KEY_MASK, item, key); + callback = scheduled_item_cancelable_callback; + } + else + callback = scheduled_item_callback; + + t.QuadPart = timeout * 1000 * 10; + filetime.dwLowDateTime = t.u.LowPart; + filetime.dwHighDateTime = t.u.HighPart; + + item->u.timer_object = CreateThreadpoolTimer(callback, item, &queue->env); + SetThreadpoolTimer(item->u.timer_object, &filetime, 0, 0); + + TRACE("dispatched %p.\n", result); + + return S_OK; +} + static HRESULT queue_cancel_item(struct queue *queue, MFWORKITEM_KEY key) { HRESULT hr = MF_E_NOT_FOUND; @@ -463,6 +519,8 @@ static HRESULT queue_cancel_item(struct queue *queue, MFWORKITEM_KEY key) key >>= 32; if ((key & WAIT_ITEM_KEY_MASK) == WAIT_ITEM_KEY_MASK) CloseThreadpoolWait(item->u.wait_object); + else if ((key & SCHEDULED_ITEM_KEY_MASK) == SCHEDULED_ITEM_KEY_MASK) + CloseThreadpoolTimer(item->u.timer_object); else WARN("Unknown item key mask %#x.\n", (DWORD)key); queue_release_pending_item(item); @@ -771,9 +829,17 @@ HRESULT WINAPI MFInvokeCallback(IMFAsyncResult *result) static HRESULT schedule_work_item(IMFAsyncResult *result, INT64 timeout, MFWORKITEM_KEY *key) { - FIXME("%p, %s, %p.\n", result, wine_dbgstr_longlong(timeout), key); + struct queue *queue; + HRESULT hr; + + if (FAILED(hr = grab_queue(MFASYNC_CALLBACK_QUEUE_TIMER, &queue))) + return hr; + + TRACE("%p, %s, %p.\n", result, wine_dbgstr_longlong(timeout), key); + + hr = queue_submit_timer(queue, result, timeout, key); - return E_NOTIMPL; + return hr; } /*********************************************************************** diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 915af01..fa77929 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -1050,11 +1050,9 @@ static void test_scheduled_items(void) ok(hr == S_OK, "Failed to start up, hr %#x.\n", hr); hr = MFScheduleWorkItem(&callback, NULL, -5000, &key); -todo_wine ok(hr == S_OK, "Failed to schedule item, hr %#x.\n", hr); hr = MFCancelWorkItem(key); -todo_wine ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); hr = MFCancelWorkItem(key); @@ -1084,15 +1082,13 @@ todo_wine IMFAsyncResult_Release(result); hr = MFScheduleWorkItem(&callback, NULL, -5000, &key); -todo_wine ok(hr == S_OK, "Failed to schedule item, hr %#x.\n", hr); hr = MFCancelWorkItem(key); -todo_wine ok(hr == S_OK, "Failed to cancel item, hr %#x.\n", hr); hr = MFShutdown(); - ok(hr == S_OK, "Failed to shutdown, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); } static void test_serial_queue(void)
1
0
0
0
← Newer
1
...
105
106
107
108
109
110
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Results per page:
10
25
50
100
200