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 2018
----- 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
785 discussions
Start a n
N
ew thread
Anton Baskanov : amstream: Implement AMAudioStream::JoinFilter.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: d7511089bf973404704833df999f0c2ce80db35c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d7511089bf973404704833df…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:41 2018 +0700 amstream: Implement AMAudioStream::JoinFilter. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 82454ed..58f9f20 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -837,9 +837,11 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStr { AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface); - FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter); + TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter); - return S_FALSE; + This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter; + + return S_OK; } static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
1
0
0
0
Anton Baskanov : amstream: Implement CheckMediaType for AMAudioStream based on code from mediastreamfilter.c.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 6030403151da72fd315dcf92041dd850319d86d7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6030403151da72fd315dcf92…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:40 2018 +0700 amstream: Implement CheckMediaType for AMAudioStream based on code from mediastreamfilter.c. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index b6f591a..82454ed 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -1080,9 +1080,18 @@ static HRESULT WINAPI AudioMediaStreamInputPin_CheckMediaType(BasePin *base, con { AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); - FIXME("(%p)->(%p) stub!\n", This, media_type); + TRACE("(%p)->(%p)\n", This, media_type); - return E_NOTIMPL; + if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Audio)) + { + if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_PCM)) + { + TRACE("Audio sub-type %s matches\n", debugstr_guid(&media_type->subtype)); + return S_OK; + } + } + + return S_OK; } static LONG WINAPI AudioMediaStreamInputPin_GetMediaTypeVersion(BasePin *base)
1
0
0
0
Anton Baskanov : amstream: Implement GetMediaType for AMAudioStream based on code from mediastreamfilter.c.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 3f2b5ff2985450e38ad08b7c3c708b4d37eb5e54 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3f2b5ff2985450e38ad08b7c…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:39 2018 +0700 amstream: Implement GetMediaType for AMAudioStream based on code from mediastreamfilter.c. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index e308f0f..b6f591a 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -1094,9 +1094,18 @@ static HRESULT WINAPI AudioMediaStreamInputPin_GetMediaType(BasePin *base, int i { AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); - FIXME("(%p)->(%d,%p) stub!\n", This, index, media_type); + TRACE("(%p)->(%d,%p)\n", This, index, media_type); - return E_NOTIMPL; + /* FIXME: Reset structure as we only fill majortype and minortype for now */ + ZeroMemory(media_type, sizeof(*media_type)); + + if (index) + return S_FALSE; + + media_type->majortype = MEDIATYPE_Audio; + media_type->subtype = MEDIASUBTYPE_PCM; + + return S_OK; } static HRESULT WINAPI AudioMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample)
1
0
0
0
Anton Baskanov : amstream: Add stub IPin and IMemInputPin to AMAudioStream.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: ee94f80cdf3fbb0892cfa15cef3e0c9ebca403b9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ee94f80cdf3fbb0892cfa15c…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:38 2018 +0700 amstream: Add stub IPin and IMemInputPin to AMAudioStream. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 138 +++++++++++++++++++++++++++++++++++++++++ dlls/amstream/tests/amstream.c | 6 ++ 2 files changed, 144 insertions(+) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 0284341..e308f0f 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -644,13 +644,22 @@ out_object: return hr; } +struct AudioMediaStreamImpl; + typedef struct { + BaseInputPin pin; + struct AudioMediaStreamImpl *parent; +} AudioMediaStreamInputPin; + +typedef struct AudioMediaStreamImpl { IAMMediaStream IAMMediaStream_iface; IAudioMediaStream IAudioMediaStream_iface; LONG ref; IMultiMediaStream* parent; MSPID purpose_id; STREAM_TYPE stream_type; + AudioMediaStreamInputPin *input_pin; + CRITICAL_SECTION critical_section; } AudioMediaStreamImpl; static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface) @@ -680,6 +689,18 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMedi *ret_iface = &This->IAudioMediaStream_iface; return S_OK; } + else if (IsEqualGUID(riid, &IID_IPin)) + { + IAMMediaStream_AddRef(iface); + *ret_iface = &This->input_pin->pin.pin.IPin_iface; + return S_OK; + } + else if (IsEqualGUID(riid, &IID_IMemInputPin)) + { + IAMMediaStream_AddRef(iface); + *ret_iface = &This->input_pin->pin.IMemInputPin_iface; + return S_OK; + } ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); return E_NOINTERFACE; @@ -703,7 +724,11 @@ static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream * TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref); if (!ref) + { + BaseInputPin_Destroy((BaseInputPin *)This->input_pin); + DeleteCriticalSection(&This->critical_section); HeapFree(GetProcessHeap(), 0, This); + } return ref; } @@ -1002,10 +1027,104 @@ static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream AudioMediaStreamImpl_IAudioMediaStream_CreateSample }; +static inline AudioMediaStreamInputPin *impl_from_AudioMediaStreamInputPin_IPin(IPin *iface) +{ + return CONTAINING_RECORD(iface, AudioMediaStreamInputPin, pin.pin.IPin_iface); +} + +/*** IUnknown methods ***/ +static HRESULT WINAPI AudioMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface); +} + +static ULONG WINAPI AudioMediaStreamInputPin_IPin_AddRef(IPin *iface) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface); +} + +static ULONG WINAPI AudioMediaStreamInputPin_IPin_Release(IPin *iface) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); +} + +static const IPinVtbl AudioMediaStreamInputPin_IPin_Vtbl = +{ + AudioMediaStreamInputPin_IPin_QueryInterface, + AudioMediaStreamInputPin_IPin_AddRef, + AudioMediaStreamInputPin_IPin_Release, + BaseInputPinImpl_Connect, + BaseInputPinImpl_ReceiveConnection, + BasePinImpl_Disconnect, + BasePinImpl_ConnectedTo, + BasePinImpl_ConnectionMediaType, + BasePinImpl_QueryPinInfo, + BasePinImpl_QueryDirection, + BasePinImpl_QueryId, + BaseInputPinImpl_QueryAccept, + BasePinImpl_EnumMediaTypes, + BasePinImpl_QueryInternalConnections, + BaseInputPinImpl_EndOfStream, + BaseInputPinImpl_BeginFlush, + BaseInputPinImpl_EndFlush, + BaseInputPinImpl_NewSegment, +}; + +static HRESULT WINAPI AudioMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); + + FIXME("(%p)->(%p) stub!\n", This, media_type); + + return E_NOTIMPL; +} + +static LONG WINAPI AudioMediaStreamInputPin_GetMediaTypeVersion(BasePin *base) +{ + return 0; +} + +static HRESULT WINAPI AudioMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->IPin_iface); + + FIXME("(%p)->(%d,%p) stub!\n", This, index, media_type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI AudioMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample) +{ + AudioMediaStreamInputPin *This = impl_from_AudioMediaStreamInputPin_IPin(&base->pin.IPin_iface); + + FIXME("(%p)->(%p) stub!\n", This, sample); + + return E_NOTIMPL; +} + +static const BaseInputPinFuncTable AudioMediaStreamInputPin_FuncTable = +{ + { + AudioMediaStreamInputPin_CheckMediaType, + NULL, + AudioMediaStreamInputPin_GetMediaTypeVersion, + AudioMediaStreamInputPin_GetMediaType, + }, + AudioMediaStreamInputPin_Receive, +}; + HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, STREAM_TYPE stream_type, IAMMediaStream **media_stream) { AudioMediaStreamImpl *object; + PIN_INFO pin_info; + HRESULT hr; TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); @@ -1017,6 +1136,20 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl; object->ref = 1; + InitializeCriticalSection(&object->critical_section); + + pin_info.pFilter = NULL; + pin_info.dir = PINDIR_INPUT; + pin_info.achName[0] = 'I'; + StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1); + hr = BaseInputPin_Construct(&AudioMediaStreamInputPin_IPin_Vtbl, + sizeof(AudioMediaStreamInputPin), &pin_info, &AudioMediaStreamInputPin_FuncTable, + &object->critical_section, NULL, (IPin **)&object->input_pin); + if (FAILED(hr)) + goto out_object; + + object->input_pin->parent = object; + object->parent = parent; object->purpose_id = *purpose_id; object->stream_type = stream_type; @@ -1024,6 +1157,11 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ *media_stream = &object->IAMMediaStream_iface; return S_OK; + +out_object: + HeapFree(GetProcessHeap(), 0, object); + + return hr; } typedef struct { diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index fba83c1..05957df 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -374,6 +374,7 @@ static void test_media_streams(void) { IAMMediaStream* am_media_stream; IMultiMediaStream *multi_media_stream; + IPin *pin = NULL; IDirectDrawMediaStream* ddraw_stream = NULL; IAudioMediaStream* audio_media_stream = NULL; IAudioStreamSample *audio_sample = NULL; @@ -393,6 +394,11 @@ static void test_media_streams(void) IAMMediaStream_Release(am_media_stream); + hr = IMediaStream_QueryInterface(audio_stream, &IID_IPin, (void **)&pin); + ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr); + + IPin_Release(pin); + hr = IMediaStream_QueryInterface(audio_stream, &IID_IDirectDrawMediaStream, (LPVOID*)&ddraw_stream); ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr);
1
0
0
0
Anton Baskanov : amstream: Implement AMDirectDrawStream::JoinFilter.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 649a26e84df566fb43e09b2fc0cc02e4956856fb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=649a26e84df566fb43e09b2f…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:37 2018 +0700 amstream: Implement AMDirectDrawStream::JoinFilter. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 6aad625..0284341 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -237,9 +237,11 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMed { DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface); - FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter); + TRACE("(%p/%p)->(%p)\n", This, iface, media_stream_filter); - return S_FALSE; + This->input_pin->pin.pin.pinInfo.pFilter = (IBaseFilter *)media_stream_filter; + + return S_OK; } static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
1
0
0
0
Anton Baskanov : amstream: Implement CheckMediaType for AMDirectDrawStream based on code form mediastreamfilter.c.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 5b03813d9d8a41714a175d94a8ca56d38694acc1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5b03813d9d8a41714a175d94…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:36 2018 +0700 amstream: Implement CheckMediaType for AMDirectDrawStream based on code form mediastreamfilter.c. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index d6f5eaf..6aad625 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -511,9 +511,24 @@ static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base { DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); - FIXME("(%p)->(%p) stub!\n", This, media_type); + TRACE("(%p)->(%p)\n", This, media_type); - return E_NOTIMPL; + if (IsEqualGUID(&media_type->majortype, &MEDIATYPE_Video)) + { + if (IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB1) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB4) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB8) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB565) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB555) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB24) || + IsEqualGUID(&media_type->subtype, &MEDIASUBTYPE_RGB32)) + { + TRACE("Video sub-type %s matches\n", debugstr_guid(&media_type->subtype)); + return S_OK; + } + } + + return S_FALSE; } static LONG WINAPI DirectDrawMediaStreamInputPin_GetMediaTypeVersion(BasePin *base)
1
0
0
0
Anton Baskanov : amstream: Implement GetMediaType for AMDirectDrawStream based on code from mediastreamfilter.c.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: 52c3c36d301189d1d1e816997c9ae9e2009b35bc URL:
https://source.winehq.org/git/wine.git/?a=commit;h=52c3c36d301189d1d1e81699…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:35 2018 +0700 amstream: Implement GetMediaType for AMDirectDrawStream based on code from mediastreamfilter.c. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index f8ce58b..d6f5eaf 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -525,9 +525,41 @@ static HRESULT WINAPI DirectDrawMediaStreamInputPin_GetMediaType(BasePin *base, { DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); - FIXME("(%p)->(%d,%p) stub!\n", This, index, media_type); + TRACE("(%p)->(%d,%p)\n", This, index, media_type); - return E_NOTIMPL; + /* FIXME: Reset structure as we only fill majortype and minortype for now */ + ZeroMemory(media_type, sizeof(*media_type)); + + media_type->majortype = MEDIATYPE_Video; + + switch (index) + { + case 0: + media_type->subtype = MEDIASUBTYPE_RGB1; + break; + case 1: + media_type->subtype = MEDIASUBTYPE_RGB4; + break; + case 2: + media_type->subtype = MEDIASUBTYPE_RGB8; + break; + case 3: + media_type->subtype = MEDIASUBTYPE_RGB565; + break; + case 4: + media_type->subtype = MEDIASUBTYPE_RGB555; + break; + case 5: + media_type->subtype = MEDIASUBTYPE_RGB24; + break; + case 6: + media_type->subtype = MEDIASUBTYPE_RGB32; + break; + default: + return S_FALSE; + } + + return S_OK; } static HRESULT WINAPI DirectDrawMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample)
1
0
0
0
Anton Baskanov : amstream: Add stub IPin and IMemInputPin to AMDirectDrawStream.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: f7febb8277e13e5770b1ee6ae6dae41c8506e96c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7febb8277e13e5770b1ee6a…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Fri Feb 16 23:43:34 2018 +0700 amstream: Add stub IPin and IMemInputPin to AMDirectDrawStream. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/mediastream.c | 139 +++++++++++++++++++++++++++++++++++++++++ dlls/amstream/tests/amstream.c | 6 ++ 2 files changed, 145 insertions(+) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 7a2e013..f8ce58b 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -26,6 +26,9 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" +#include "dshow.h" + +#include "wine/strmbase.h" #include "amstream_private.h" @@ -38,7 +41,14 @@ static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectD const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample); static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample); +struct DirectDrawMediaStreamImpl; + typedef struct { + BaseInputPin pin; + struct DirectDrawMediaStreamImpl *parent; +} DirectDrawMediaStreamInputPin; + +typedef struct DirectDrawMediaStreamImpl { IAMMediaStream IAMMediaStream_iface; IDirectDrawMediaStream IDirectDrawMediaStream_iface; LONG ref; @@ -46,6 +56,8 @@ typedef struct { MSPID purpose_id; STREAM_TYPE stream_type; IDirectDraw7 *ddraw; + DirectDrawMediaStreamInputPin *input_pin; + CRITICAL_SECTION critical_section; } DirectDrawMediaStreamImpl; static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface) @@ -75,6 +87,18 @@ static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IA *ret_iface = &This->IDirectDrawMediaStream_iface; return S_OK; } + else if (IsEqualGUID(riid, &IID_IPin)) + { + IAMMediaStream_AddRef(iface); + *ret_iface = &This->input_pin->pin.pin.IPin_iface; + return S_OK; + } + else if (IsEqualGUID(riid, &IID_IMemInputPin)) + { + IAMMediaStream_AddRef(iface); + *ret_iface = &This->input_pin->pin.IMemInputPin_iface; + return S_OK; + } ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface); return E_NOINTERFACE; @@ -99,6 +123,8 @@ static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStr if (!ref) { + BaseInputPin_Destroy((BaseInputPin *)This->input_pin); + DeleteCriticalSection(&This->critical_section); if (This->ddraw) IDirectDraw7_Release(This->ddraw); HeapFree(GetProcessHeap(), 0, This); @@ -432,10 +458,104 @@ static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirect DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame }; +static inline DirectDrawMediaStreamInputPin *impl_from_DirectDrawMediaStreamInputPin_IPin(IPin *iface) +{ + return CONTAINING_RECORD(iface, DirectDrawMediaStreamInputPin, pin.pin.IPin_iface); +} + +/*** IUnknown methods ***/ +static HRESULT WINAPI DirectDrawMediaStreamInputPin_IPin_QueryInterface(IPin *iface, REFIID riid, void **ret_iface) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_QueryInterface(&This->parent->IAMMediaStream_iface, riid, ret_iface); +} + +static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_AddRef(IPin *iface) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_AddRef(&This->parent->IAMMediaStream_iface); +} + +static ULONG WINAPI DirectDrawMediaStreamInputPin_IPin_Release(IPin *iface) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(iface); + + return IAMMediaStream_Release(&This->parent->IAMMediaStream_iface); +} + +static const IPinVtbl DirectDrawMediaStreamInputPin_IPin_Vtbl = +{ + DirectDrawMediaStreamInputPin_IPin_QueryInterface, + DirectDrawMediaStreamInputPin_IPin_AddRef, + DirectDrawMediaStreamInputPin_IPin_Release, + BaseInputPinImpl_Connect, + BaseInputPinImpl_ReceiveConnection, + BasePinImpl_Disconnect, + BasePinImpl_ConnectedTo, + BasePinImpl_ConnectionMediaType, + BasePinImpl_QueryPinInfo, + BasePinImpl_QueryDirection, + BasePinImpl_QueryId, + BaseInputPinImpl_QueryAccept, + BasePinImpl_EnumMediaTypes, + BasePinImpl_QueryInternalConnections, + BaseInputPinImpl_EndOfStream, + BaseInputPinImpl_BeginFlush, + BaseInputPinImpl_EndFlush, + BaseInputPinImpl_NewSegment, +}; + +static HRESULT WINAPI DirectDrawMediaStreamInputPin_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *media_type) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); + + FIXME("(%p)->(%p) stub!\n", This, media_type); + + return E_NOTIMPL; +} + +static LONG WINAPI DirectDrawMediaStreamInputPin_GetMediaTypeVersion(BasePin *base) +{ + return 0; +} + +static HRESULT WINAPI DirectDrawMediaStreamInputPin_GetMediaType(BasePin *base, int index, AM_MEDIA_TYPE *media_type) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->IPin_iface); + + FIXME("(%p)->(%d,%p) stub!\n", This, index, media_type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI DirectDrawMediaStreamInputPin_Receive(BaseInputPin *base, IMediaSample *sample) +{ + DirectDrawMediaStreamInputPin *This = impl_from_DirectDrawMediaStreamInputPin_IPin(&base->pin.IPin_iface); + + FIXME("(%p)->(%p) stub!\n", This, sample); + + return E_NOTIMPL; +} + +static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable = +{ + { + DirectDrawMediaStreamInputPin_CheckMediaType, + NULL, + DirectDrawMediaStreamInputPin_GetMediaTypeVersion, + DirectDrawMediaStreamInputPin_GetMediaType, + }, + DirectDrawMediaStreamInputPin_Receive, +}; + HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id, STREAM_TYPE stream_type, IAMMediaStream **media_stream) { DirectDrawMediaStreamImpl *object; + PIN_INFO pin_info; + HRESULT hr; TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream); @@ -447,6 +567,20 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl; object->ref = 1; + InitializeCriticalSection(&object->critical_section); + + pin_info.pFilter = NULL; + pin_info.dir = PINDIR_INPUT; + pin_info.achName[0] = 'I'; + StringFromGUID2(purpose_id, pin_info.achName + 1, MAX_PIN_NAME - 1); + hr = BaseInputPin_Construct(&DirectDrawMediaStreamInputPin_IPin_Vtbl, + sizeof(DirectDrawMediaStreamInputPin), &pin_info, &DirectDrawMediaStreamInputPin_FuncTable, + &object->critical_section, NULL, (IPin **)&object->input_pin); + if (FAILED(hr)) + goto out_object; + + object->input_pin->parent = object; + object->parent = parent; object->purpose_id = *purpose_id; object->stream_type = stream_type; @@ -454,6 +588,11 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_ *media_stream = &object->IAMMediaStream_iface; return S_OK; + +out_object: + HeapFree(GetProcessHeap(), 0, object); + + return hr; } typedef struct { diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index c08f989..fba83c1 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -258,6 +258,7 @@ static void test_media_streams(void) { IAMMediaStream* am_media_stream; IMultiMediaStream *multi_media_stream; + IPin *pin = NULL; IAudioMediaStream* audio_media_stream; IDirectDrawMediaStream *ddraw_stream = NULL; IDirectDrawStreamSample *ddraw_sample = NULL; @@ -277,6 +278,11 @@ static void test_media_streams(void) IAMMediaStream_Release(am_media_stream); + hr = IMediaStream_QueryInterface(video_stream, &IID_IPin, (void **)&pin); + ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr); + + IPin_Release(pin); + hr = IMediaStream_QueryInterface(video_stream, &IID_IAudioMediaStream, (LPVOID*)&audio_media_stream); ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr);
1
0
0
0
Isira Seneviratne : ping: Implement -l, -w, -n using IcmpSendEcho.
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: b1e9177c13990f7b03ac470aeb1b68eb99dc6180 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b1e9177c13990f7b03ac470a…
Author: Isira Seneviratne <isirasen96(a)gmail.com> Date: Sat Feb 17 10:40:55 2018 +0530 ping: Implement -l, -w, -n using IcmpSendEcho. Signed-off-by: Isira Seneviratne <isirasen96(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/ping/Makefile.in | 1 + programs/ping/ping_main.c | 146 ++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 137 insertions(+), 10 deletions(-) diff --git a/programs/ping/Makefile.in b/programs/ping/Makefile.in index 0eb3a90..0f87ad0 100644 --- a/programs/ping/Makefile.in +++ b/programs/ping/Makefile.in @@ -1,5 +1,6 @@ MODULE = ping.exe APPMODE = -mconsole +IMPORTS = ws2_32 iphlpapi C_SRCS = \ ping_main.c diff --git a/programs/ping/ping_main.c b/programs/ping/ping_main.c index 997d953..74a1c71 100644 --- a/programs/ping/ping_main.c +++ b/programs/ping/ping_main.c @@ -1,6 +1,8 @@ /* - * ping stub + * ping program + * * Copyright (C) 2010 Trey Hunner + * Copyright (C) 2018 Isira Seneviratne * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,9 +21,15 @@ #include "config.h" #include "wine/port.h" +#include "winsock2.h" +#include "ws2tcpip.h" +#include "iphlpapi.h" #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <icmpapi.h> +#include <limits.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -29,25 +37,42 @@ #include <windows.h> #include "wine/debug.h" +#include "wine/heap.h" WINE_DEFAULT_DEBUG_CHANNEL(ping); static void usage(void) { - printf("Usage: ping [-n count] [-w timeout] target_name\n\n" + printf("Usage: ping [-n count] [-w timeout] [-l buffer_length] target_name\n\n" "Options:\n" " -n Number of echo requests to send.\n" - " -w Timeout in milliseconds to wait for each reply.\n"); + " -w Timeout in milliseconds to wait for each reply.\n" + " -l Length of send buffer.\n"); } int main(int argc, char** argv) { - unsigned int n = 0; - int optc; + unsigned int n = 4, i = 0, w = 4000, l = 32; + int optc, res; + int rec = 0, lost = 0, min = INT_MAX, max = 0; + WSADATA wsa; + HANDLE icmp_file; + unsigned long ipaddr; + DWORD retval, reply_size; + char *send_data, ip[100], *hostname, rtt[16]; + void *reply_buffer; + struct in_addr addr; + ICMP_ECHO_REPLY *reply; + float avg = 0; + struct hostent *remote_host; - WINE_FIXME( "this command currently just sleeps based on -n parameter\n" ); + if (argc == 1) + { + usage(); + exit(1); + } - while ((optc = getopt( argc, argv, "n:w:tal:fi:v:r:s:j:k:" )) != -1) + while ((optc = getopt( argc, argv, "n:w:l:tal:fi:v:r:s:j:k:" )) != -1) { switch(optc) { @@ -59,18 +84,119 @@ int main(int argc, char** argv) exit(1); } break; + case 'w': + w = atoi(optarg); + if (w == 0) + { + printf("Bad value for option -w.\n"); + exit(1); + } + break; + case 'l': + l = atoi(optarg); + if (l == 0) + { + printf("Bad value for option -l.\n"); + exit(1); + } + break; case '?': usage(); exit(1); default: usage(); - WINE_FIXME( "this command currently only supports the -n parameter\n" ); + WINE_FIXME( "this command currently only supports the -n, -w and -l parameters.\n" ); exit(1); } } - if (n != 0) - Sleep((n - 1) * 1000); + if (argv[optind] != NULL) + hostname = argv[optind]; + else + { + printf("Pass a host name.\n"); + return 1; + } + + res = WSAStartup(MAKEWORD(2, 2), &wsa); + if (res != 0) + { + printf("WSAStartup failed: %d\n", res); + return 1; + } + + remote_host = gethostbyname(hostname); + if (remote_host == NULL) + { + printf("Ping request could not find host %s. Please check the name and try again.\n", + hostname); + return 1; + } + + addr.s_addr = *(u_long *) remote_host->h_addr_list[0]; + strcpy(ip, inet_ntoa(addr)); + ipaddr = inet_addr(ip); + if (ipaddr == INADDR_NONE) + { + printf("Could not get IP address of host %s.", hostname); + return 1; + } + + icmp_file = IcmpCreateFile(); + + send_data = heap_alloc_zero(l); + reply_size = sizeof(ICMP_ECHO_REPLY) + l + 8; + /* The buffer has to hold 8 more bytes of data (the size of an ICMP error message). */ + reply_buffer = heap_alloc(reply_size); + if (reply_buffer == NULL) + { + printf("Unable to allocate memory to reply buffer.\n"); + return 1; + } + + printf("Pinging %s [%s] with %d bytes of data:\n", hostname, ip, l); + for (;;) + { + retval = IcmpSendEcho(icmp_file, ipaddr, send_data, l, + NULL, reply_buffer, reply_size, w); + if (retval != 0) + { + reply = (ICMP_ECHO_REPLY *) reply_buffer; + if (reply->RoundTripTime >= 1) + sprintf(rtt, "=%d", reply->RoundTripTime); + else + strcpy(rtt, "<1"); + printf("Reply from %s: bytes=%d time%sms TTL=%d\n", ip, l, + rtt, reply->Options.Ttl); + if (reply->RoundTripTime > max) + max = reply->RoundTripTime; + if (reply->RoundTripTime < min) + min = reply->RoundTripTime; + avg += reply->RoundTripTime; + rec++; + } + else + { + printf("Request timed out.\n"); + lost++; + } + i++; + if (i == n) + break; + Sleep(1000); + } + + printf("\nPing statistics for %s\n", ip); + printf("\tPackets: Sent = %d, Received = %d, Lost = %d (%.0f%% loss)\n", + n, rec, lost, (float) lost / n * 100); + if (rec != 0) + { + avg /= rec; + printf("Approximate round trip times in milli-seconds:\n"); + printf("\tMinimum = %dms, Maximum = %dms, Average = %.0fms\n", + min, max, avg); + } + heap_free(reply_buffer); return 0; }
1
0
0
0
Michael Müller : kernelbase/tests: Add some tests for PathCchCombineEx().
by Alexandre Julliard
01 Mar '18
01 Mar '18
Module: wine Branch: master Commit: e9b3ccaca36c06966e860f1fa84dbdebb0d6c7ec URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e9b3ccaca36c06966e860f1f…
Author: Michael Müller <michael(a)fds-team.de> Date: Wed Feb 28 13:54:17 2018 +0300 kernelbase/tests: Add some tests for PathCchCombineEx(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 1 + configure.ac | 1 + dlls/kernelbase/tests/Makefile.in | 4 ++ dlls/kernelbase/tests/path.c | 123 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 129 insertions(+) diff --git a/configure b/configure index 28e678e..d8d123f 100755 --- a/configure +++ b/configure @@ -18729,6 +18729,7 @@ wine_fn_config_dll kerberos enable_kerberos wine_fn_config_dll kernel32 enable_kernel32 wine_fn_config_test dlls/kernel32/tests kernel32_test wine_fn_config_dll kernelbase enable_kernelbase +wine_fn_config_test dlls/kernelbase/tests kernelbase_test wine_fn_config_dll keyboard.drv16 enable_win16 wine_fn_config_dll krnl386.exe16 enable_win16 wine_fn_config_dll ksuser enable_ksuser diff --git a/configure.ac b/configure.ac index 2695c67..2e99320 100644 --- a/configure.ac +++ b/configure.ac @@ -3317,6 +3317,7 @@ WINE_CONFIG_DLL(kerberos) WINE_CONFIG_DLL(kernel32) WINE_CONFIG_TEST(dlls/kernel32/tests) WINE_CONFIG_DLL(kernelbase) +WINE_CONFIG_TEST(dlls/kernelbase/tests) WINE_CONFIG_DLL(keyboard.drv16,enable_win16) WINE_CONFIG_DLL(krnl386.exe16,enable_win16) WINE_CONFIG_DLL(ksuser) diff --git a/dlls/kernelbase/tests/Makefile.in b/dlls/kernelbase/tests/Makefile.in new file mode 100644 index 0000000..ac8e1fc --- /dev/null +++ b/dlls/kernelbase/tests/Makefile.in @@ -0,0 +1,4 @@ +TESTDLL = kernelbase.dll + +C_SRCS = \ + path.c diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c new file mode 100644 index 0000000..fbe1d3b --- /dev/null +++ b/dlls/kernelbase/tests/path.c @@ -0,0 +1,123 @@ +/* + * Path tests for kernelbase.dll + * + * Copyright 2017 Michael Müller + * + * 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 <stdarg.h> +#include <windef.h> +#include <winbase.h> +#include <stdlib.h> +#include <winerror.h> +#include <winnls.h> +#include <pathcch.h> +#include <strsafe.h> + +#include "wine/test.h" + +HRESULT (WINAPI *pPathCchCombineEx)(WCHAR *out, SIZE_T size, const WCHAR *path1, const WCHAR *path2, DWORD flags); + +static const struct +{ + const char *path1; + const char *path2; + const char *result; +} +combine_test[] = +{ + /* normal paths */ + {"C:\\", "a", "C:\\a" }, + {"C:\\b", "..\\a", "C:\\a" }, + {"C:", "a", "C:\\a" }, + {"C:\\", ".", "C:\\" }, + {"C:\\", "..", "C:\\" }, + {"\\a", "b", "\\a\\b" }, + + /* normal UNC paths */ + {"\\\\192.168.1.1\\test", "a", "\\\\192.168.1.1\\test\\a" }, + {"\\\\192.168.1.1\\test", "..", "\\\\192.168.1.1" }, + + /* NT paths */ + {"\\\\?\\C:\\", "a", "C:\\a" }, + {"\\\\?\\C:\\", "..", "C:\\" }, + + /* NT UNC path */ + {"\\\\?\\UNC\\192.168.1.1\\test", "a", "\\\\192.168.1.1\\test\\a" }, + {"\\\\?\\UNC\\192.168.1.1\\test", "..", "\\\\192.168.1.1" }, +}; + +static void test_PathCchCombineEx(void) +{ + WCHAR expected[MAX_PATH] = {'C',':','\\','a',0}; + WCHAR p1[MAX_PATH] = {'C',':','\\',0}; + WCHAR p2[MAX_PATH] = {'a',0}; + WCHAR output[MAX_PATH]; + HRESULT hr; + int i; + + if (!pPathCchCombineEx) + { + skip("PathCchCombineEx() is not available.\n"); + return; + } + + hr = pPathCchCombineEx(NULL, 2, p1, p2, 0); + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); + + memset(output, 0xff, sizeof(output)); + hr = pPathCchCombineEx(output, 0, p1, p2, 0); + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr); + ok(output[0] == 0xffff, "Expected output buffer to be unchanged\n"); + + memset(output, 0xff, sizeof(output)); + hr = pPathCchCombineEx(output, 1, p1, p2, 0); + ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr); + ok(output[0] == 0, "Expected output buffer to contain NULL string\n"); + + memset(output, 0xff, sizeof(output)); + hr = pPathCchCombineEx(output, 4, p1, p2, 0); + ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "Expected STRSAFE_E_INSUFFICIENT_BUFFER, got %08x\n", hr); + ok(output[0] == 0x0, "Expected output buffer to contain NULL string\n"); + + memset(output, 0xff, sizeof(output)); + hr = pPathCchCombineEx(output, 5, p1, p2, 0); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(!lstrcmpW(output, expected), + "Combination of %s + %s returned %s, expected %s\n", + wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected)); + + for (i = 0; i < sizeof(combine_test)/sizeof(combine_test[0]); i++) + { + MultiByteToWideChar(CP_ACP, 0, combine_test[i].path1, -1, p1, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, combine_test[i].path2, -1, p2, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, combine_test[i].result, -1, expected, MAX_PATH); + + hr = pPathCchCombineEx(output, MAX_PATH, p1, p2, 0); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(!lstrcmpW(output, expected), "Combining %s with %s returned %s, expected %s\n", + wine_dbgstr_w(p1), wine_dbgstr_w(p2), wine_dbgstr_w(output), wine_dbgstr_w(expected)); + } +} + +START_TEST(path) +{ + HMODULE hmod = LoadLibraryA("kernelbase.dll"); + + pPathCchCombineEx = (void *)GetProcAddress(hmod, "PathCchCombineEx"); + + test_PathCchCombineEx(); +}
1
0
0
0
← Newer
1
...
72
73
74
75
76
77
78
79
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
Results per page:
10
25
50
100
200