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
July 2020
----- 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
1 participants
826 discussions
Start a n
N
ew thread
Anton Baskanov : amstream: Return S_OK from AMMultiMediaStream::SetState when IMediaControl::Run succeeds.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 6395c83d2ad48a9f660e22e58a1c4125eae32e30 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6395c83d2ad48a9f660e22e5…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Jul 21 10:50:06 2020 -0500 amstream: Return S_OK from AMMultiMediaStream::SetState when IMediaControl::Run succeeds. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/multimedia.c | 4 +++ dlls/amstream/tests/amstream.c | 71 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index f615e436b1..b2c9082cae 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -153,7 +153,11 @@ static HRESULT WINAPI multimedia_stream_SetState(IAMMultiMediaStream *iface, STR TRACE("(%p/%p)->(%u)\n", This, iface, new_state); if (new_state == STREAMSTATE_RUN) + { hr = IMediaControl_Run(This->media_control); + if (SUCCEEDED(hr)) + hr = S_OK; + } else if (new_state == STREAMSTATE_STOP) hr = IMediaControl_Stop(This->media_control); diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 9882b5c04e..8338a5a3ec 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -710,6 +710,8 @@ struct testfilter LONGLONG stop_position; HRESULT get_duration_hr; HRESULT set_positions_hr; + HRESULT init_stream_hr; + HRESULT cleanup_stream_hr; }; static inline struct testfilter *impl_from_BaseFilter(struct strmbase_filter *iface) @@ -736,16 +738,20 @@ static HRESULT testfilter_init_stream(struct strmbase_filter *iface) { struct testfilter *filter = impl_from_BaseFilter(iface); - BaseOutputPinImpl_Active(&filter->source); - return S_OK; + if (SUCCEEDED(filter->init_stream_hr)) + BaseOutputPinImpl_Active(&filter->source); + + return filter->init_stream_hr; } static HRESULT testfilter_cleanup_stream(struct strmbase_filter *iface) { struct testfilter *filter = impl_from_BaseFilter(iface); - BaseOutputPinImpl_Inactive(&filter->source); - return S_OK; + if (SUCCEEDED(filter->cleanup_stream_hr)) + BaseOutputPinImpl_Inactive(&filter->source); + + return filter->cleanup_stream_hr; } static const struct strmbase_filter_ops testfilter_ops = @@ -2062,6 +2068,62 @@ static void test_initialize(void) IUnknown_Release(graph_inner_unk); } +static void test_set_state(void) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + struct testfilter source; + IGraphBuilder *graph; + HRESULT hr; + ULONG ref; + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(graph != NULL, "Expected non-NULL graph.\n"); + testfilter_init(&source); + + hr = IGraphBuilder_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + source.init_stream_hr = E_FAIL; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + source.init_stream_hr = S_OK; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + source.init_stream_hr = S_FALSE; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + source.init_stream_hr = S_OK; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + source.cleanup_stream_hr = E_FAIL; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + source.cleanup_stream_hr = S_OK; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + source.cleanup_stream_hr = S_FALSE; + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + source.cleanup_stream_hr = S_OK; + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IGraphBuilder_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_enum_media_types(void) { IAMMultiMediaStream *mmstream = create_ammultimediastream(); @@ -5116,6 +5178,7 @@ START_TEST(amstream) test_find_pin(); test_pin_info(); test_initialize(); + test_set_state(); test_enum_media_types(); test_media_types(); test_IDirectDrawStreamSample();
1
0
0
0
Anton Baskanov : amstream/tests: Move the testfilter code above to use it in SetState tests.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 0e6f24db19a29fce4cb6a2f7107d5318e6a131b6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0e6f24db19a29fce4cb6a2f7…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Jul 21 10:50:05 2020 -0500 amstream/tests: Move the testfilter code above to use it in SetState tests. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/tests/amstream.c | 890 ++++++++++++++++++++--------------------- 1 file changed, 445 insertions(+), 445 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=0e6f24db19a29fce4cb6…
1
0
0
0
Anton Baskanov : amstream/tests: Add a test AVI file.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 053b55d2a8a1bf6055293c78835a4a0843e95ae6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=053b55d2a8a1bf6055293c78…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Jul 21 10:50:04 2020 -0500 amstream/tests: Add a test AVI file. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/tests/Makefile.in | 3 ++ dlls/amstream/tests/amstream.c | 63 +++++++++++++++++++++++++++++++--------- dlls/amstream/tests/rsrc.rc | 25 ++++++++++++++++ dlls/amstream/tests/test.avi | Bin 0 -> 12088 bytes 4 files changed, 78 insertions(+), 13 deletions(-) diff --git a/dlls/amstream/tests/Makefile.in b/dlls/amstream/tests/Makefile.in index 81eaed3c15..eb756ddf39 100644 --- a/dlls/amstream/tests/Makefile.in +++ b/dlls/amstream/tests/Makefile.in @@ -3,3 +3,6 @@ IMPORTS = strmbase strmiids uuid ddraw ole32 user32 C_SRCS = \ amstream.c + +RC_SRCS = \ + rsrc.rc diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index f6d4c5d3c4..0175257c05 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -53,6 +53,45 @@ static const AM_MEDIA_TYPE audio_mt = static const WCHAR primary_video_sink_id[] = L"I{A35FF56A-9FDA-11D0-8FDF-00C04FD9189D}"; static const WCHAR primary_audio_sink_id[] = L"I{A35FF56B-9FDA-11D0-8FDF-00C04FD9189D}"; +static const WCHAR *load_resource(const WCHAR *name) +{ + HMODULE module = GetModuleHandleA(NULL); + HRSRC resource; + DWORD written; + HANDLE file; + WCHAR *path; + DWORD size; + void *ptr; + + path = calloc(MAX_PATH + 1, sizeof(WCHAR)); + ok(!!path, "Failed to allocate temp path string.\n"); + GetTempPathW(MAX_PATH + 1, path); + wcscat(path, name); + + file = CreateFileW(path, 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(path), GetLastError()); + + resource = FindResourceW(module, name, (const WCHAR *)RT_RCDATA); + ok(!!resource, "Failed to find resource %s, error %u.\n", wine_dbgstr_w(name), GetLastError()); + + size = SizeofResource(module, resource); + ptr = LockResource(LoadResource(module, resource)); + + WriteFile(file, ptr, size, &written, NULL); + ok(written == size, "Failed to write file %s.\n", wine_dbgstr_w(path)); + + CloseHandle(file); + + return path; +} + +static void unload_resource(const WCHAR *path) +{ + BOOL ret = DeleteFileW(path); + ok(ret, "Failed to delete file %s.\n", wine_dbgstr_w(path)); + free((void *)path); +} + #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown* obj, ULONG ref, int line) { @@ -229,7 +268,7 @@ static void test_interfaces(void) ok(!ref, "Got outstanding refcount %u.\n", ref); } -static void test_openfile(void) +static void test_openfile(const WCHAR *test_avi_path) { IAMMultiMediaStream *mmstream = create_ammultimediastream(); IMediaStreamFilter *filter; @@ -241,7 +280,7 @@ static void test_openfile(void) ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!graph, "Expected NULL graph.\n"); - hr = IAMMultiMediaStream_OpenFile(mmstream, L"test.avi", AMMSF_NORENDER); + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NORENDER); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); @@ -260,7 +299,7 @@ static void test_openfile(void) check_interface(filter, &IID_IMediaSeeking, FALSE); - hr = IAMMultiMediaStream_OpenFile(mmstream, L"test.avi", 0); + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); check_interface(filter, &IID_IMediaSeeking, TRUE); @@ -271,7 +310,7 @@ static void test_openfile(void) ok(!ref, "Got outstanding refcount %d.\n", ref); } -static void test_renderfile(void) +static void test_renderfile(const WCHAR *test_avi_path) { IAMMultiMediaStream *pams; HRESULT hr; @@ -298,7 +337,7 @@ static void test_renderfile(void) hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr); - hr = IAMMultiMediaStream_OpenFile(pams, L"test.avi", 0); + hr = IAMMultiMediaStream_OpenFile(pams, test_avi_path, 0); ok(hr==S_OK, "IAMMultiMediaStream_OpenFile returned: %x\n", hr); hr = IAMMultiMediaStream_GetMediaStream(pams, &MSPID_PrimaryVideo, &pvidstream); @@ -5066,7 +5105,7 @@ static void test_ddrawstream_getsetdirectdraw(void) START_TEST(amstream) { - HANDLE file; + const WCHAR *test_avi_path; CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -5081,14 +5120,12 @@ START_TEST(amstream) test_media_types(); test_IDirectDrawStreamSample(); - file = CreateFileW(L"test.avi", 0, 0, NULL, OPEN_EXISTING, 0, NULL); - if (file != INVALID_HANDLE_VALUE) - { - CloseHandle(file); + test_avi_path = load_resource(L"test.avi"); - test_openfile(); - test_renderfile(); - } + test_openfile(test_avi_path); + test_renderfile(test_avi_path); + + unload_resource(test_avi_path); test_audiodata_query_interface(); test_audiodata_get_info(); diff --git a/dlls/amstream/tests/rsrc.rc b/dlls/amstream/tests/rsrc.rc new file mode 100644 index 0000000000..e1fc277503 --- /dev/null +++ b/dlls/amstream/tests/rsrc.rc @@ -0,0 +1,25 @@ +/* + * Resource file for amstream tests. + * + * Copyright 2020 Anton Baskanov + * + * 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 "windef.h" + +/* ffmpeg -f lavfi -i smptebars -f lavfi -i "sine=frequency=1000" -t 0.1 -r 10 -ar 8000 -f avi -vcodec rawvideo -vf scale=32x24 -acodec pcm_u8 test.avi */ +/* @makedep: test.avi */ +test.avi RCDATA "test.avi" diff --git a/dlls/amstream/tests/test.avi b/dlls/amstream/tests/test.avi new file mode 100644 index 0000000000..70aead5453 Binary files /dev/null and b/dlls/amstream/tests/test.avi differ
1
0
0
0
Anton Baskanov : amstream/tests: Fix file rendering test.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 7490b857b988baee2df547e2caac3d543088046e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7490b857b988baee2df547e2…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Jul 21 10:50:03 2020 -0500 amstream/tests: Fix file rendering test. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/tests/amstream.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index c47f11f1f6..f6d4c5d3c4 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -296,7 +296,7 @@ static void test_renderfile(void) ok(hr==S_OK, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); hr = IAMMultiMediaStream_AddMediaStream(pams, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); - ok(hr==S_OK, "IAMMultiMediaStream_AddMediaStream returned: %x\n", hr); + ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr); hr = IAMMultiMediaStream_OpenFile(pams, L"test.avi", 0); ok(hr==S_OK, "IAMMultiMediaStream_OpenFile returned: %x\n", hr); @@ -315,14 +315,15 @@ static void test_renderfile(void) surface = NULL; hr = IDirectDrawStreamSample_GetSurface(pddsample, &surface, &rect); ok(hr == S_OK, "got 0x%08x\n", hr); - ok(surface == NULL, "got %p\n", surface); + ok(surface != NULL, "Expected non-NULL surface.\n"); + IDirectDrawSurface_Release(surface); IDirectDrawStreamSample_Release(pddsample); hr = IDirectDrawSurface7_QueryInterface(pdds7, &IID_IDirectDrawSurface, (void**)&surface); ok(hr == S_OK, "got 0x%08x\n", hr); EXPECT_REF(surface, 1); - hr = IDirectDrawMediaStream_CreateSample(pddstream, surface, NULL, 0, &pddsample); + hr = IDirectDrawMediaStream_CreateSample(pddstream, surface, &rect, 0, &pddsample); ok(hr == S_OK, "IDirectDrawMediaStream_CreateSample returned: %x\n", hr); EXPECT_REF(surface, 2); IDirectDrawStreamSample_Release(pddsample);
1
0
0
0
Anton Baskanov : amstream/tests: Fix AMMultiMediaStream::OpenFile test.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 6a1109f3cd0ba0953c02509e9fdb2a84a9549e7b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6a1109f3cd0ba0953c02509e…
Author: Anton Baskanov <baskanov(a)gmail.com> Date: Tue Jul 21 10:50:02 2020 -0500 amstream/tests: Fix AMMultiMediaStream::OpenFile test. Signed-off-by: Anton Baskanov <baskanov(a)gmail.com> Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/amstream/tests/amstream.c | 47 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index a81cdba3f3..c47f11f1f6 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -231,35 +231,44 @@ static void test_interfaces(void) static void test_openfile(void) { - IAMMultiMediaStream *pams; + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IMediaStreamFilter *filter; + IGraphBuilder *graph; HRESULT hr; - IGraphBuilder* pgraph; + ULONG ref; - if (!(pams = create_ammultimediastream())) - return; + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!graph, "Expected NULL graph.\n"); - hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph); - ok(hr==S_OK, "IAMMultiMediaStream_GetFilterGraph returned: %x\n", hr); - ok(pgraph==NULL, "Filtergraph should not be created yet\n"); + hr = IAMMultiMediaStream_OpenFile(mmstream, L"test.avi", AMMSF_NORENDER); + ok(hr == S_OK, "Got hr %#x.\n", hr); - if (pgraph) - IGraphBuilder_Release(pgraph); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!graph, "Expected non-NULL graph.\n"); + IGraphBuilder_Release(graph); - check_interface(pams, &IID_IMediaSeeking, FALSE); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); - hr = IAMMultiMediaStream_OpenFile(pams, L"test.avi", 0); - ok(hr==S_OK, "IAMMultiMediaStream_OpenFile returned: %x\n", hr); + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); - check_interface(pams, &IID_IMediaSeeking, TRUE); + check_interface(filter, &IID_IMediaSeeking, FALSE); - hr = IAMMultiMediaStream_GetFilterGraph(pams, &pgraph); - ok(hr==S_OK, "IAMMultiMediaStream_GetFilterGraph returned: %x\n", hr); - ok(pgraph!=NULL, "Filtergraph should be created\n"); + hr = IAMMultiMediaStream_OpenFile(mmstream, L"test.avi", 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); - if (pgraph) - IGraphBuilder_Release(pgraph); + check_interface(filter, &IID_IMediaSeeking, TRUE); - IAMMultiMediaStream_Release(pams); + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStreamFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); } static void test_renderfile(void)
1
0
0
0
Alexandre Julliard : ntdll: Use a syscall thunk for NtQueryPerformanceCounter().
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 78c772e9d802d13522855fa3c8e2257c4933214a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=78c772e9d802d13522855fa3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 21 15:51:38 2020 +0200 ntdll: Use a syscall thunk for NtQueryPerformanceCounter(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/ntdll.spec | 4 ++-- dlls/ntdll/time.c | 21 +-------------------- dlls/ntdll/unix/loader.c | 1 - dlls/ntdll/unix/sync.c | 13 +++++++++++-- dlls/ntdll/unixlib.h | 3 +-- 5 files changed, 15 insertions(+), 27 deletions(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index ff1433be40..aea9174068 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -307,7 +307,7 @@ @ stdcall -syscall NtQueryMutant(long long ptr long ptr) @ stdcall -syscall NtQueryObject(long long ptr long ptr) @ stub NtQueryOpenSubKeys -@ stdcall NtQueryPerformanceCounter(ptr ptr) +@ stdcall -syscall NtQueryPerformanceCounter(ptr ptr) # @ stub NtQueryPortInformationProcess # @ stub NtQueryQuotaInformationFile @ stdcall -syscall NtQuerySection(long long ptr long ptr) @@ -1295,7 +1295,7 @@ @ stdcall -private -syscall ZwQueryMutant(long long ptr long ptr) NtQueryMutant @ stdcall -private -syscall ZwQueryObject(long long ptr long ptr) NtQueryObject @ stub ZwQueryOpenSubKeys -@ stdcall -private ZwQueryPerformanceCounter(ptr ptr) NtQueryPerformanceCounter +@ stdcall -private -syscall ZwQueryPerformanceCounter(ptr ptr) NtQueryPerformanceCounter # @ stub ZwQueryPortInformationProcess # @ stub ZwQueryQuotaInformationFile @ stdcall -private -syscall ZwQuerySection(long long ptr long ptr) NtQuerySection diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index 15d100d10e..f92443500d 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -375,31 +375,12 @@ LONGLONG WINAPI RtlGetSystemTimePrecise( void ) return unix_funcs->RtlGetSystemTimePrecise(); } -/****************************************************************************** - * NtQueryPerformanceCounter [NTDLL.@] - */ -NTSTATUS WINAPI NtQueryPerformanceCounter( LARGE_INTEGER *counter, LARGE_INTEGER *frequency ) -{ - NTSTATUS status; - - __TRY - { - status = unix_funcs->NtQueryPerformanceCounter( counter, frequency ); - } - __EXCEPT_PAGE_FAULT - { - return STATUS_ACCESS_VIOLATION; - } - __ENDTRY - return status; -} - /****************************************************************************** * RtlQueryPerformanceCounter [NTDLL.@] */ BOOL WINAPI DECLSPEC_HOTPATCH RtlQueryPerformanceCounter( LARGE_INTEGER *counter ) { - unix_funcs->NtQueryPerformanceCounter( counter, NULL ); + NtQueryPerformanceCounter( counter, NULL ); return TRUE; } diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 99c70b400a..3f3a10155d 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1362,7 +1362,6 @@ static struct unix_funcs unix_funcs = { NtCurrentTeb, NtGetContextThread, - NtQueryPerformanceCounter, DbgUiIssueRemoteBreakin, RtlGetSystemTimePrecise, RtlWaitOnAddress, diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index b7b9fa3443..2dc1a7c2aa 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -69,6 +69,7 @@ #include "winternl.h" #include "ddk/wdm.h" #include "wine/server.h" +#include "wine/exception.h" #include "wine/debug.h" #include "unix_private.h" @@ -1361,8 +1362,16 @@ NTSTATUS WINAPI NtDelayExecution( BOOLEAN alertable, const LARGE_INTEGER *timeou */ NTSTATUS WINAPI NtQueryPerformanceCounter( LARGE_INTEGER *counter, LARGE_INTEGER *frequency ) { - counter->QuadPart = monotonic_counter(); - if (frequency) frequency->QuadPart = TICKSPERSEC; + __TRY + { + counter->QuadPart = monotonic_counter(); + if (frequency) frequency->QuadPart = TICKSPERSEC; + } + __EXCEPT_PAGE_FAULT + { + return STATUS_ACCESS_VIOLATION; + } + __ENDTRY return STATUS_SUCCESS; } diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index d7487feafc..84e1a27977 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,14 +28,13 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 89 +#define NTDLL_UNIXLIB_VERSION 90 struct unix_funcs { /* Nt* functions */ TEB * (WINAPI *NtCurrentTeb)(void); NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context ); - NTSTATUS (WINAPI *NtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency ); /* other Win32 API functions */ NTSTATUS (WINAPI *DbgUiIssueRemoteBreakin)( HANDLE process );
1
0
0
0
Alexandre Julliard : ntdll: Use a syscall thunk for NtClose().
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 4752e252ea6ee084b679a9b9551a1c55f8744451 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4752e252ea6ee084b679a9b9…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 21 15:50:36 2020 +0200 ntdll: Use a syscall thunk for NtClose(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/ntdll.spec | 4 +-- dlls/ntdll/ntdll_misc.h | 2 -- dlls/ntdll/om.c | 90 ------------------------------------------------ dlls/ntdll/unix/loader.c | 1 - dlls/ntdll/unix/server.c | 9 +++++ dlls/ntdll/unixlib.h | 3 +- 7 files changed, 12 insertions(+), 98 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index eed8d10f0b..bc8215b6bf 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -24,7 +24,6 @@ C_SRCS = \ locale.c \ misc.c \ nt.c \ - om.c \ path.c \ printf.c \ process.c \ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 0bfe3d3545..ff1433be40 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -150,7 +150,7 @@ @ stdcall -syscall NtCancelTimer(long ptr) @ stdcall -syscall NtClearEvent(long) @ stdcall -syscall NtClearPowerRequest(long long) -@ stdcall NtClose(long) +@ stdcall -syscall NtClose(long) @ stub NtCloseObjectAuditAlarm # @ stub NtCompactKeys # @ stub NtCompareTokens @@ -1139,7 +1139,7 @@ @ stdcall -private -syscall ZwCancelTimer(long ptr) NtCancelTimer @ stdcall -private -syscall ZwClearEvent(long) NtClearEvent @ stdcall -private -syscall ZwClearPowerRequest(long long) NtClearPowerRequest -@ stdcall -private ZwClose(long) NtClose +@ stdcall -private -syscall ZwClose(long) NtClose @ stub ZwCloseObjectAuditAlarm # @ stub ZwCompactKeys # @ stub ZwCompareTokens diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 1f27cd100a..d845416e95 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -44,8 +44,6 @@ static const UINT_PTR page_size = 0x1000; extern UINT_PTR page_size DECLSPEC_HIDDEN; #endif -extern NTSTATUS close_handle( HANDLE ) DECLSPEC_HIDDEN; - /* exceptions */ extern LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN raise_status( NTSTATUS status, EXCEPTION_RECORD *rec ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c deleted file mode 100644 index 8c8f2a4297..0000000000 --- a/dlls/ntdll/om.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Object management functions - * - * Copyright 1999, 2000 Juergen Schmied - * Copyright 2005 Vitaliy Margolen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "wine/debug.h" -#include "windef.h" -#include "winternl.h" -#include "ntdll_misc.h" -#include "wine/server.h" -#include "wine/exception.h" - - -/* - * Generic object functions - */ - -static LONG WINAPI invalid_handle_exception_handler( EXCEPTION_POINTERS *eptr ) -{ - EXCEPTION_RECORD *rec = eptr->ExceptionRecord; - return (rec->ExceptionCode == EXCEPTION_INVALID_HANDLE) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH; -} - -/* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */ -NTSTATUS close_handle( HANDLE handle ) -{ - DWORD_PTR debug_port; - NTSTATUS ret = unix_funcs->NtClose( handle ); - - if (ret == STATUS_INVALID_HANDLE && handle && NtCurrentTeb()->Peb->BeingDebugged && - !NtQueryInformationProcess( NtCurrentProcess(), ProcessDebugPort, &debug_port, - sizeof(debug_port), NULL) && debug_port) - { - __TRY - { - EXCEPTION_RECORD record; - record.ExceptionCode = EXCEPTION_INVALID_HANDLE; - record.ExceptionFlags = 0; - record.ExceptionRecord = NULL; - record.ExceptionAddress = NULL; - record.NumberParameters = 0; - RtlRaiseException( &record ); - } - __EXCEPT(invalid_handle_exception_handler) - { - } - __ENDTRY - } - - return ret; -} - -/************************************************************************** - * NtClose [NTDLL.@] - * - * Close a handle reference to an object. - * - * PARAMS - * Handle [I] handle to close - * - * RETURNS - * Success: ERROR_SUCCESS. - * Failure: An NTSTATUS error code. - */ -NTSTATUS WINAPI NtClose( HANDLE Handle ) -{ - return close_handle( Handle ); -} diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index fba785c2b6..99c70b400a 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1360,7 +1360,6 @@ static double CDECL ntdll_tan( double d ) { return tan( d ); } */ static struct unix_funcs unix_funcs = { - NtClose, NtCurrentTeb, NtGetContextThread, NtQueryPerformanceCounter, diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 452094ff5d..21817ad159 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1629,6 +1629,7 @@ NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source, HANDLE */ NTSTATUS WINAPI NtClose( HANDLE handle ) { + HANDLE port; NTSTATUS ret; int fd = remove_fd_from_cache( handle ); @@ -1639,5 +1640,13 @@ NTSTATUS WINAPI NtClose( HANDLE handle ) } SERVER_END_REQ; if (fd != -1) close( fd ); + + if (ret != STATUS_INVALID_HANDLE || !handle) return ret; + if (!NtCurrentTeb()->Peb->BeingDebugged) return ret; + if (!NtQueryInformationProcess( NtCurrentProcess(), ProcessDebugPort, &port, sizeof(port), NULL) && port) + { + NtCurrentTeb()->ExceptionCode = ret; + pKiRaiseUserExceptionDispatcher(); + } return ret; } diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index e4206762b1..d7487feafc 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,12 +28,11 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 88 +#define NTDLL_UNIXLIB_VERSION 89 struct unix_funcs { /* Nt* functions */ - NTSTATUS (WINAPI *NtClose)( HANDLE handle ); TEB * (WINAPI *NtCurrentTeb)(void); NTSTATUS (WINAPI *NtGetContextThread)( HANDLE handle, CONTEXT *context ); NTSTATUS (WINAPI *NtQueryPerformanceCounter)( LARGE_INTEGER *counter, LARGE_INTEGER *frequency );
1
0
0
0
Alexandre Julliard : ntdll: Implement KiRaiseUserExceptionDispatcher().
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 5eefbc6db98985a5b63bec78fde7eef2f7fa02f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5eefbc6db98985a5b63bec78…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 21 15:50:03 2020 +0200 ntdll: Implement KiRaiseUserExceptionDispatcher(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/exception.c | 10 ++++++++++ dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/unix/loader.c | 2 ++ dlls/ntdll/unix/unix_private.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index 1fc8710897..b32665611f 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -176,6 +176,16 @@ void WINAPI RtlRaiseStatus( NTSTATUS status ) } +/******************************************************************* + * KiRaiseUserExceptionDispatcher (NTDLL.@) + */ +void WINAPI KiRaiseUserExceptionDispatcher(void) +{ + EXCEPTION_RECORD rec = { NtCurrentTeb()->ExceptionCode }; + RtlRaiseException( &rec ); +} + + /******************************************************************* * RtlAddVectoredContinueHandler (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index a3bc57716d..0bfe3d3545 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -66,7 +66,7 @@ # @ stub KiFastSystemCall # @ stub KiFastSystemCallRet # @ stub KiIntSystemCall -@ stub KiRaiseUserExceptionDispatcher +@ stdcall -norelay KiRaiseUserExceptionDispatcher() @ stub KiUserApcDispatcher @ stub KiUserCallbackDispatcher @ stdcall -norelay KiUserExceptionDispatcher(ptr ptr) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index a343274087..fba785c2b6 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -95,6 +95,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(module); extern IMAGE_NT_HEADERS __wine_spec_nt_header; void (WINAPI *pDbgUiRemoteBreakin)( void *arg ) = NULL; +void (WINAPI *pKiRaiseUserExceptionDispatcher)(void) = NULL; NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) = NULL; void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) = NULL; void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) = NULL; @@ -833,6 +834,7 @@ static void fixup_ntdll_imports( const IMAGE_NT_HEADERS *nt ) ERR( "%s not found\n", #name ) GET_FUNC( DbgUiRemoteBreakin ); + GET_FUNC( KiRaiseUserExceptionDispatcher ); GET_FUNC( KiUserExceptionDispatcher ); GET_FUNC( LdrInitializeThunk ); GET_FUNC( RtlUserThreadStart ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 19f742c200..60883bfa39 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -72,6 +72,7 @@ static const UINT_PTR page_size = 0x1000; /* callbacks to PE ntdll from the Unix side */ extern void (WINAPI *pDbgUiRemoteBreakin)( void *arg ) DECLSPEC_HIDDEN; +extern void (WINAPI *pKiRaiseUserExceptionDispatcher)(void) DECLSPEC_HIDDEN; extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN; extern void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN; extern void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : ntdll: Map errno to a status also in directory functions.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: 688799b1f7b2750b938f8da771480d2c16d1ae1d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=688799b1f7b2750b938f8da7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 21 18:18:17 2020 +0200 ntdll: Map errno to a status also in directory functions. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49523
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/file.c | 25 +++++++++++++++++++++++++ dlls/ntdll/unix/file.c | 13 +++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 6164b0c4bd..2fa12410c9 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -401,6 +401,31 @@ static void open_file_test(void) CloseHandle( handle ); CloseHandle( dir ); + attr.RootDirectory = 0; + wcscat( path, L"\\cmd.exe" ); + pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL ); + status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_DIRECTORY_FILE ); + ok( status == STATUS_NOT_A_DIRECTORY, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); + CloseHandle( handle ); + status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_NON_DIRECTORY_FILE ); + ok( !status, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); + CloseHandle( handle ); + pRtlFreeUnicodeString( &nameW ); + + wcscat( path, L"\\cmd.exe" ); + pRtlDosPathNameToNtPathName_U( path, &nameW, NULL, NULL ); + status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_DIRECTORY_FILE ); + todo_wine + ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); + status = pNtOpenFile( &handle, GENERIC_READ, &attr, &io, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_NON_DIRECTORY_FILE ); + todo_wine + ok( status == STATUS_OBJECT_PATH_NOT_FOUND, "open %s failed %x\n", wine_dbgstr_w(nameW.Buffer), status ); + pRtlFreeUnicodeString( &nameW ); + GetTempPathW( MAX_PATH, path ); lstrcatW( path, testdirW ); CreateDirectoryW( path, NULL ); diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 20eb6a0592..8356e08289 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -2454,7 +2454,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, PIO_APC_ROUTI } if (cwd == -1 || fchdir( cwd ) == -1) chdir( "/" ); } - else status = STATUS_ACCESS_DENIED; + else status = errno_to_status( errno ); pthread_mutex_unlock( &dir_mutex ); @@ -2557,11 +2557,8 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i } #endif /* VFAT_IOCTL_READDIR_BOTH */ - if (!(dir = opendir( unix_name ))) - { - if (errno == ENOENT) return STATUS_OBJECT_PATH_NOT_FOUND; - else return STATUS_ACCESS_DENIED; - } + if (!(dir = opendir( unix_name ))) return errno_to_status( errno ); + unix_name[pos - 1] = '/'; while ((de = readdir( dir ))) { @@ -3038,7 +3035,7 @@ static NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char * } if (fchdir( old_cwd ) == -1) chdir( "/" ); } - else status = STATUS_ACCESS_DENIED; + else status = errno_to_status( errno ); pthread_mutex_unlock( &dir_mutex ); if (old_cwd != -1) close( old_cwd ); @@ -3217,7 +3214,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char * disposition, FALSE ); if (fchdir( old_cwd ) == -1) chdir( "/" ); } - else status = STATUS_ACCESS_DENIED; + else status = errno_to_status( errno ); pthread_mutex_unlock( &dir_mutex ); if (old_cwd != -1) close( old_cwd ); if (needs_close) close( root_fd );
1
0
0
0
Alexandre Julliard : ntdll: Set a better exit status when the main image fails to load.
by Alexandre Julliard
21 Jul '20
21 Jul '20
Module: wine Branch: master Commit: f8d42a31c624f28f6c9bfd9678fb025bf15e9c12 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f8d42a31c624f28f6c9bfd96…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Jul 21 15:23:28 2020 +0200 ntdll: Set a better exit status when the main image fails to load. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49593
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index c21e9ec5b1..06e7c1bb37 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -513,7 +513,7 @@ done: failed: MESSAGE( "wine: cannot find %s\n", debugstr_w(name) ); - RtlExitUserProcess( GetLastError() ); + RtlExitUserProcess( STATUS_DLL_NOT_FOUND ); }
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
83
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
Results per page:
10
25
50
100
200