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
Ziqing Hui : windowscodecs/tests: Simplify init_decoder().
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 33406cd357175d0f28322abc462945a28e7949ce URL:
https://source.winehq.org/git/wine.git/?a=commit;h=33406cd357175d0f28322abc…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Tue Jul 21 13:49:18 2020 +0800 windowscodecs/tests: Simplify init_decoder(). Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/ddsformat.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index 30982fbb30..aebe31c1d5 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -371,27 +371,15 @@ static HRESULT init_decoder(IWICBitmapDecoder *decoder, IWICStream *stream, HRES IWICWineDecoder *wine_decoder; hr = IWICBitmapDecoder_Initialize(decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand); - if (index == -1) { - ok(hr == S_OK || wine_init, "Decoder initialize failed, hr %#x\n", hr); - } else { - ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr); - } + ok(hr == expected, "Test %u: Expected hr %#x, got %#x\n", index, expected, hr); if (hr != S_OK && wine_init) { hr = IWICBitmapDecoder_QueryInterface(decoder, &IID_IWICWineDecoder, (void **)&wine_decoder); - if (index == -1) { - ok(hr == S_OK || broken(hr != S_OK), "QueryInterface failed, hr %#x\n", hr); - } else { - ok(hr == S_OK || broken(hr != S_OK), "Test %u: QueryInterface failed, hr %#x\n", index, hr); - } + ok(hr == S_OK || broken(hr != S_OK), "Test %u: QueryInterface failed, hr %#x\n", index, hr); + if (hr == S_OK) { hr = IWICWineDecoder_Initialize(wine_decoder, (IStream*)stream, WICDecodeMetadataCacheOnDemand); - if (index == -1) { - ok(hr == S_OK, "Initialize failed, hr %#x\n", hr); - } else { - ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr); - } - + ok(hr == S_OK, "Test %u: Initialize failed, hr %#x\n", index, hr); } } @@ -511,7 +499,7 @@ static void test_dds_decoder_image_parameters(void) if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue; - hr = init_decoder(decoder, stream, S_OK, -1, test_data[i].wine_init); + hr = init_decoder(decoder, stream, test_data[i].init_hr, i, test_data[i].wine_init); if (hr != S_OK) { if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) { win_skip("Cube map is not supported\n"); @@ -831,7 +819,7 @@ static void test_dds_decoder(void) if (!stream) goto next; decoder = create_decoder(); if (!decoder) goto next; - hr = init_decoder(decoder, stream, S_OK, -1, test_data[i].wine_init); + hr = init_decoder(decoder, stream, test_data[i].init_hr, i, test_data[i].wine_init); if (hr != S_OK) { if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) { win_skip("Cube map is not supported\n");
1
0
0
0
Ziqing Hui : windowscodecs/tests: Remove the test data in test_dds_decoder_initialize().
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 7ca07bc8afa3a4d3ef25e7dc6cf5be13d2d7ddc8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7ca07bc8afa3a4d3ef25e7dc…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Tue Jul 21 13:48:52 2020 +0800 windowscodecs/tests: Remove the test data in test_dds_decoder_initialize(). Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/windowscodecs/tests/ddsformat.c | 87 +++++++++++++++--------------------- 1 file changed, 36 insertions(+), 51 deletions(-) diff --git a/dlls/windowscodecs/tests/ddsformat.c b/dlls/windowscodecs/tests/ddsformat.c index b8ca452a43..30982fbb30 100644 --- a/dlls/windowscodecs/tests/ddsformat.c +++ b/dlls/windowscodecs/tests/ddsformat.c @@ -266,43 +266,59 @@ static BYTE test_dds_dxt3[] = { 0x00, 0x00, 0x00, 0x00 }; +static BYTE test_dds_bad_magic[sizeof(test_dds_dxt1)]; +static BYTE test_dds_bad_header[sizeof(test_dds_dxt1)]; +static BYTE test_byte[1] = { 0 }; +static BYTE test_word[2] = { 0 }; +static BYTE test_dword[4] = { 0 }; +static BYTE test_qword_a[8] = { 0 }; +static BYTE test_qword_b[8] = "DDS "; + static struct test_data { BYTE *data; UINT size; + HRESULT init_hr; UINT expected_frame_count; UINT expected_bytes_per_block; const GUID *expected_pixel_format; WICDdsParameters expected_parameters; BOOL wine_init; } test_data[] = { - { test_dds_bgr565, sizeof(test_dds_bgr565), 1, 2, &GUID_WICPixelFormat32bppBGRA, + { test_dds_bgr565, sizeof(test_dds_bgr565), WINCODEC_ERR_BADHEADER, 1, 2, &GUID_WICPixelFormat32bppBGRA, { 4, 4, 1, 1, 1, DXGI_FORMAT_B5G6R5_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_24bpp, sizeof(test_dds_24bpp), 1, 3, &GUID_WICPixelFormat32bppBGRA, + { test_dds_24bpp, sizeof(test_dds_24bpp), WINCODEC_ERR_BADHEADER, 1, 3, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_UNKNOWN, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_32bpp_xrgb, sizeof(test_dds_32bpp_xrgb), 1, 4, &GUID_WICPixelFormat32bppBGRA, + { test_dds_32bpp_xrgb, sizeof(test_dds_32bpp_xrgb), WINCODEC_ERR_BADHEADER, 1, 4, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_B8G8R8X8_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_32bpp_argb, sizeof(test_dds_32bpp_argb), 1, 4, &GUID_WICPixelFormat32bppBGRA, + { test_dds_32bpp_argb, sizeof(test_dds_32bpp_argb), WINCODEC_ERR_BADHEADER, 1, 4, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_B8G8R8A8_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_64bpp, sizeof(test_dds_64bpp), 1, 8, &GUID_WICPixelFormat32bppBGRA, + { test_dds_64bpp, sizeof(test_dds_64bpp), WINCODEC_ERR_BADHEADER, 1, 8, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_R16G16B16A16_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_96bpp, sizeof(test_dds_96bpp), 1, 12, &GUID_WICPixelFormat32bppBGRA, + { test_dds_96bpp, sizeof(test_dds_96bpp), WINCODEC_ERR_BADHEADER, 1, 12, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_R32G32B32_FLOAT, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_128bpp, sizeof(test_dds_128bpp), 1, 16, &GUID_WICPixelFormat32bppBGRA, + { test_dds_128bpp, sizeof(test_dds_128bpp), WINCODEC_ERR_BADHEADER, 1, 16, &GUID_WICPixelFormat32bppBGRA, { 1, 1, 1, 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, WICDdsTexture2D, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_cube, sizeof(test_dds_cube), 18, 8, &GUID_WICPixelFormat32bppPBGRA, + { test_dds_cube, sizeof(test_dds_cube), WINCODEC_ERR_BADHEADER, 18, 8, &GUID_WICPixelFormat32bppPBGRA, { 4, 4, 1, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTextureCube, WICDdsAlphaModePremultiplied }, TRUE }, - { test_dds_cube_dx10, sizeof(test_dds_cube_dx10), 18, 8, &GUID_WICPixelFormat32bppBGRA, + { test_dds_cube_dx10, sizeof(test_dds_cube_dx10), WINCODEC_ERR_BADHEADER, 18, 8, &GUID_WICPixelFormat32bppBGRA, { 4, 4, 1, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTextureCube, WICDdsAlphaModeUnknown }, TRUE }, - { test_dds_dxt1, sizeof(test_dds_dxt1), 1, 8, &GUID_WICPixelFormat32bppPBGRA, + { test_dds_dxt1, sizeof(test_dds_dxt1), S_OK, 1, 8, &GUID_WICPixelFormat32bppPBGRA, { 4, 4, 1, 1, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModePremultiplied } }, - { test_dds_mipmaps, sizeof(test_dds_mipmaps), 3, 8, &GUID_WICPixelFormat32bppPBGRA, + { test_dds_mipmaps, sizeof(test_dds_mipmaps), S_OK, 3, 8, &GUID_WICPixelFormat32bppPBGRA, { 4, 4, 1, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModePremultiplied } }, - { test_dds_volume, sizeof(test_dds_volume), 7, 8, &GUID_WICPixelFormat32bppPBGRA, + { test_dds_volume, sizeof(test_dds_volume), S_OK, 7, 8, &GUID_WICPixelFormat32bppPBGRA, { 4, 4, 4, 3, 1, DXGI_FORMAT_BC1_UNORM, WICDdsTexture3D, WICDdsAlphaModePremultiplied } }, - { test_dds_array, sizeof(test_dds_array), 9, 8, &GUID_WICPixelFormat32bppBGRA, + { test_dds_array, sizeof(test_dds_array), S_OK, 9, 8, &GUID_WICPixelFormat32bppBGRA, { 4, 4, 1, 3, 3, DXGI_FORMAT_BC1_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown } }, - { test_dds_dxt3, sizeof(test_dds_dxt3), 8, 16, &GUID_WICPixelFormat32bppBGRA, - { 12, 12, 1, 4, 2, DXGI_FORMAT_BC2_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown } } + { test_dds_dxt3, sizeof(test_dds_dxt3), S_OK, 8, 16, &GUID_WICPixelFormat32bppBGRA, + { 12, 12, 1, 4, 2, DXGI_FORMAT_BC2_UNORM, WICDdsTexture2D, WICDdsAlphaModeUnknown } }, + { test_dds_bad_magic, sizeof(test_dds_bad_magic), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, + { test_dds_bad_header, sizeof(test_dds_bad_header), WINCODEC_ERR_BADHEADER }, + { test_byte, sizeof(test_byte), WINCODEC_ERR_STREAMREAD }, + { test_word, sizeof(test_word), WINCODEC_ERR_STREAMREAD }, + { test_dword, sizeof(test_dword), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, + { test_qword_a, sizeof(test_qword_a), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, + { test_qword_b, sizeof(test_qword_b), WINCODEC_ERR_STREAMREAD }, }; static IWICImagingFactory *factory = NULL; @@ -389,41 +405,6 @@ static BOOL has_extended_header(const BYTE *data) static void test_dds_decoder_initialize(void) { - static BYTE test_dds_bad_magic[sizeof(test_dds_dxt1)]; - static BYTE test_dds_bad_header[sizeof(test_dds_dxt1)]; - static BYTE byte = 0; - static DWORD dword = 0; - static BYTE qword1[8] = { 0 }; - static BYTE qword2[8] = "DDS "; - - static struct test_data { - void *data; - UINT size; - HRESULT expected; - BOOL wine_init; - } test_data[] = { - { test_dds_dxt1 , sizeof(test_dds_dxt1), S_OK }, - { test_dds_mipmaps, sizeof(test_dds_mipmaps), S_OK }, - { test_dds_volume, sizeof(test_dds_volume), S_OK }, - { test_dds_array, sizeof(test_dds_array), S_OK }, - { test_dds_dxt3, sizeof(test_dds_dxt3), S_OK }, - { test_dds_bgr565, sizeof(test_dds_bgr565), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_24bpp, sizeof(test_dds_24bpp), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_32bpp_xrgb, sizeof(test_dds_32bpp_xrgb), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_32bpp_argb, sizeof(test_dds_32bpp_argb), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_64bpp, sizeof(test_dds_64bpp), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_96bpp, sizeof(test_dds_96bpp), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_128bpp, sizeof(test_dds_128bpp), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_cube, sizeof(test_dds_cube), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_cube_dx10, sizeof(test_dds_cube_dx10), WINCODEC_ERR_BADHEADER, TRUE }, - { test_dds_bad_magic, sizeof(test_dds_bad_magic), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, - { test_dds_bad_header, sizeof(test_dds_bad_header), WINCODEC_ERR_BADHEADER }, - { &byte, sizeof(byte), WINCODEC_ERR_STREAMREAD }, - { &dword, sizeof(dword), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, - { &qword1, sizeof(qword1), WINCODEC_ERR_UNKNOWNIMAGEFORMAT }, - { &qword2, sizeof(qword2), WINCODEC_ERR_STREAMREAD }, - }; - int i; memcpy(test_dds_bad_magic, test_dds_dxt1, sizeof(test_dds_dxt1)); @@ -442,7 +423,7 @@ static void test_dds_decoder_initialize(void) decoder = create_decoder(); if (!decoder) goto next; - init_decoder(decoder, stream, test_data[i].expected, i, test_data[i].wine_init); + init_decoder(decoder, stream, test_data[i].init_hr, i, test_data[i].wine_init); next: if (decoder) IWICBitmapDecoder_Release(decoder); @@ -528,6 +509,8 @@ static void test_dds_decoder_image_parameters(void) hr = IWICDdsDecoder_GetParameters(dds_decoder, NULL); ok(hr == E_INVALIDARG, "Test %u: GetParameters got unexpected hr %#x\n", i, hr); + if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue; + hr = init_decoder(decoder, stream, S_OK, -1, test_data[i].wine_init); if (hr != S_OK) { if (test_data[i].expected_parameters.Dimension == WICDdsTextureCube) { @@ -842,6 +825,8 @@ static void test_dds_decoder(void) IWICStream *stream = NULL; IWICBitmapDecoder *decoder = NULL; + if (test_data[i].init_hr != S_OK && !test_data[i].wine_init) continue; + stream = create_stream(test_data[i].data, test_data[i].size); if (!stream) goto next; decoder = create_decoder();
1
0
0
0
Shawn M. Chapla : gdiplus: Add FillRegion serialization.
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 1cb437ac256280cfab5c325b660dd4833d17cda8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1cb437ac256280cfab5c325b…
Author: Shawn M. Chapla <schapla(a)codeweavers.com> Date: Mon Jul 20 22:45:19 2020 -0400 gdiplus: Add FillRegion serialization. Signed-off-by: Shawn M. Chapla <schapla(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/gdiplus_private.h | 2 ++ dlls/gdiplus/graphics.c | 13 ++++++++---- dlls/gdiplus/metafile.c | 48 ++++++++++++++++++++++++++++++++++++++++++ dlls/gdiplus/tests/metafile.c | 16 +++++++------- 4 files changed, 67 insertions(+), 12 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 1b2de4e8f4..aac5509afa 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -107,6 +107,8 @@ extern GpStatus METAFILE_FillPath(GpMetafile *metafile, GpBrush *brush, GpPath * extern GpStatus METAFILE_DrawDriverString(GpMetafile *metafile, GDIPCONST UINT16 *text, INT length, GDIPCONST GpFont *font, GDIPCONST GpStringFormat *format, GDIPCONST GpBrush *brush, GDIPCONST PointF *positions, INT flags, GDIPCONST GpMatrix *matrix) DECLSPEC_HIDDEN; +extern GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush, + GpRegion* region) DECLSPEC_HIDDEN; extern void METAFILE_Free(GpMetafile *metafile) DECLSPEC_HIDDEN; extern void calc_curve_bezier(const GpPointF *pts, REAL tension, REAL *x1, diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 1307bdc1ef..f0da41c6cb 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -4700,11 +4700,16 @@ GpStatus WINGDIPAPI GdipFillRegion(GpGraphics* graphics, GpBrush* brush, if(graphics->busy) return ObjectBusy; - if (!graphics->image && !graphics->alpha_hdc) - stat = GDI32_GdipFillRegion(graphics, brush, region); + if (graphics->image && graphics->image->type == ImageTypeMetafile) + stat = METAFILE_FillRegion((GpMetafile*)graphics->image, brush, region); + else + { + if (!graphics->image && !graphics->alpha_hdc) + stat = GDI32_GdipFillRegion(graphics, brush, region); - if (stat == NotImplemented) - stat = SOFTWARE_GdipFillRegion(graphics, brush, region); + if (stat == NotImplemented) + stat = SOFTWARE_GdipFillRegion(graphics, brush, region); + } if (stat == NotImplemented) { diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index ed4e8a8be4..1d7c0fe306 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -4854,3 +4854,51 @@ GpStatus METAFILE_DrawDriverString(GpMetafile *metafile, GDIPCONST UINT16 *text, return Ok; } + +GpStatus METAFILE_FillRegion(GpMetafile* metafile, GpBrush* brush, GpRegion* region) +{ + GpStatus stat; + DWORD brush_id; + DWORD region_id; + EmfPlusFillRegion *fill_region_record; + BOOL inline_color; + + if (metafile->metafile_type != MetafileTypeEmfPlusOnly && + metafile->metafile_type != MetafileTypeEmfPlusDual) + { + FIXME("metafile type not supported: %i\n", metafile->metafile_type); + return NotImplemented; + } + + inline_color = (brush->bt == BrushTypeSolidColor); + if (!inline_color) + { + stat = METAFILE_AddBrushObject(metafile, brush, &brush_id); + if (stat != Ok) + return stat; + } + + stat = METAFILE_AddRegionObject(metafile, region, ®ion_id); + if (stat != Ok) + return stat; + + stat = METAFILE_AllocateRecord(metafile, sizeof(EmfPlusFillRegion), + (void**)&fill_region_record); + if (stat != Ok) + return stat; + + fill_region_record->Header.Type = EmfPlusRecordTypeFillRegion; + fill_region_record->Header.Flags = region_id; + + if (inline_color) + { + fill_region_record->Header.Flags |= 0x8000; + fill_region_record->data.Color = ((GpSolidFill*)brush)->color; + } + else + fill_region_record->data.BrushId = brush_id; + + METAFILE_WriteRecords(metafile); + + return Ok; +} diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index f0b31b4f9c..ddb58504c9 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -3177,11 +3177,11 @@ static void test_unknownfontdecode(void) static const emfplus_record fillregion_records[] = { { EMR_HEADER }, { EmfPlusRecordTypeHeader }, - { EmfPlusRecordTypeObject, ObjectTypeRegion << 8, 1 }, - { EmfPlusRecordTypeFillRegion, 0x8000, 1 }, - { EmfPlusRecordTypeObject, (ObjectTypeBrush << 8) | 1, 1 }, - { EmfPlusRecordTypeObject, (ObjectTypeRegion << 8) | 2, 1 }, - { EmfPlusRecordTypeFillRegion, 2, 1 }, + { EmfPlusRecordTypeObject, ObjectTypeRegion << 8 }, + { EmfPlusRecordTypeFillRegion, 0x8000 }, + { EmfPlusRecordTypeObject, (ObjectTypeBrush << 8) | 1 }, + { EmfPlusRecordTypeObject, (ObjectTypeRegion << 8) | 2 }, + { EmfPlusRecordTypeFillRegion, 2 }, { EmfPlusRecordTypeEndOfFile }, { EMR_EOF }, { 0 } @@ -3251,15 +3251,15 @@ static void test_fillregion(void) stat = GdipBitmapGetPixel(bitmap, 25, 25, &color); expect(Ok, stat); - todo_wine expect(0xffaabbcc, color); + expect(0xffaabbcc, color); stat = GdipBitmapGetPixel(bitmap, 56, 56, &color); expect(Ok, stat); - todo_wine expect(0xffff0000, color); + expect(0xffff0000, color); stat = GdipBitmapGetPixel(bitmap, 57, 57, &color); expect(Ok, stat); - todo_wine expect(0xff0000ff, color); + expect(0xff0000ff, color); GdipDeleteRegion(solidregion); GdipDeleteRegion(hatchregion);
1
0
0
0
Shawn M. Chapla : gdiplus: Add FillRegion record deserialization.
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 8191ed86ca592adbce8e52963a52cfccddfcd8bd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8191ed86ca592adbce8e5296…
Author: Shawn M. Chapla <schapla(a)codeweavers.com> Date: Mon Jul 20 22:45:18 2020 -0400 gdiplus: Add FillRegion record deserialization. Signed-off-by: Shawn M. Chapla <schapla(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/metafile.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/dlls/gdiplus/metafile.c b/dlls/gdiplus/metafile.c index d6bcbb5c12..ed4e8a8be4 100644 --- a/dlls/gdiplus/metafile.c +++ b/dlls/gdiplus/metafile.c @@ -563,6 +563,16 @@ typedef struct EmfPlusDrawDriverString BYTE VariableData[1]; } EmfPlusDrawDriverString; +typedef struct EmfPlusFillRegion +{ + EmfPlusRecordHeader Header; + union + { + DWORD BrushId; + EmfPlusARGB Color; + } data; +} EmfPlusFillRegion; + static void metafile_free_object_table_entry(GpMetafile *metafile, BYTE id) { struct emfplus_object *object = &metafile->objtable[id]; @@ -3438,6 +3448,42 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile, return stat; } + case EmfPlusRecordTypeFillRegion: + { + EmfPlusFillRegion * const fill = (EmfPlusFillRegion*)header; + GpSolidFill *solidfill = NULL; + GpBrush *brush; + BYTE region = flags & 0xff; + + if (dataSize != sizeof(EmfPlusFillRegion) - sizeof(EmfPlusRecordHeader)) + return InvalidParameter; + + if (region >= EmfPlusObjectTableSize || + real_metafile->objtable[region].type != ObjectTypeRegion) + return InvalidParameter; + + if (flags & 0x8000) + { + stat = GdipCreateSolidFill(fill->data.Color, &solidfill); + if (stat != Ok) + return stat; + brush = (GpBrush*)solidfill; + } + else + { + if (fill->data.BrushId >= EmfPlusObjectTableSize || + real_metafile->objtable[fill->data.BrushId].type != ObjectTypeBrush) + return InvalidParameter; + + brush = real_metafile->objtable[fill->data.BrushId].u.brush; + } + + stat = GdipFillRegion(real_metafile->playback_graphics, brush, + real_metafile->objtable[region].u.region); + GdipDeleteBrush((GpBrush*)solidfill); + + return stat; + } default: FIXME("Not implemented for record type %x\n", recordType); return NotImplemented;
1
0
0
0
Shawn M. Chapla : gdiplus/tests: Add metafile FillRegion test.
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 5ccd10fce886573bce23cc61004ddb0e7a86cb28 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ccd10fce886573bce23cc61…
Author: Shawn M. Chapla <schapla(a)codeweavers.com> Date: Mon Jul 20 22:45:17 2020 -0400 gdiplus/tests: Add metafile FillRegion test. Signed-off-by: Shawn M. Chapla <schapla(a)codeweavers.com> Signed-off-by: Esme Povirk <esme(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/tests/metafile.c | 97 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c index 8179e1a5fd..f0b31b4f9c 100644 --- a/dlls/gdiplus/tests/metafile.c +++ b/dlls/gdiplus/tests/metafile.c @@ -3174,6 +3174,102 @@ static void test_unknownfontdecode(void) GdipDisposeImage((GpImage*)metafile); } +static const emfplus_record fillregion_records[] = { + { EMR_HEADER }, + { EmfPlusRecordTypeHeader }, + { EmfPlusRecordTypeObject, ObjectTypeRegion << 8, 1 }, + { EmfPlusRecordTypeFillRegion, 0x8000, 1 }, + { EmfPlusRecordTypeObject, (ObjectTypeBrush << 8) | 1, 1 }, + { EmfPlusRecordTypeObject, (ObjectTypeRegion << 8) | 2, 1 }, + { EmfPlusRecordTypeFillRegion, 2, 1 }, + { EmfPlusRecordTypeEndOfFile }, + { EMR_EOF }, + { 0 } +}; + +static void test_fillregion(void) +{ + static const GpPointF dst_points[3] = {{0.0, 0.0}, {100.0, 0.0}, {0.0, 100.0}}; + static const GpRectF frame = {0.0, 0.0, 100.0, 100.0}; + static const GpRectF solidrect = {20.0, 20.0, 20.0, 20.0}; + static const GpRectF hatchrect = {50.0, 50.0, 20.0, 20.0}; + + GpStatus stat; + GpMetafile *metafile; + GpGraphics *graphics; + GpBitmap *bitmap; + GpBrush *solidbrush, *hatchbrush; + GpRegion *solidregion, *hatchregion; + ARGB color; + HDC hdc; + + hdc = CreateCompatibleDC(0); + stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, + L"winetest", &metafile); + expect(Ok, stat); + DeleteDC(hdc); + hdc = NULL; + + stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics); + expect(Ok, stat); + + stat = GdipCreateRegionRect(&solidrect, &solidregion); + expect(Ok, stat); + + stat = GdipCreateSolidFill(0xffaabbcc, (GpSolidFill**)&solidbrush); + expect(Ok, stat); + + stat = GdipFillRegion(graphics, solidbrush, solidregion); + expect(Ok, stat); + + stat = GdipCreateRegionRect(&hatchrect, &hatchregion); + expect(Ok, stat); + + stat = GdipCreateHatchBrush(HatchStyleHorizontal, 0xffff0000, 0xff0000ff, + (GpHatch**)&hatchbrush); + expect(Ok, stat); + + stat = GdipFillRegion(graphics, hatchbrush, hatchregion); + expect(Ok, stat); + + stat = GdipDeleteGraphics(graphics); + graphics = NULL; + expect(Ok, stat); + + check_metafile(metafile, fillregion_records, "regionfill metafile", dst_points, + &frame, UnitPixel); + sync_metafile(&metafile, "regionfill.emf"); + + stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap); + expect(Ok, stat); + + stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics); + expect(Ok, stat); + + play_metafile(metafile, graphics, fillregion_records, "regionfill playback", + dst_points, &frame, UnitPixel); + + stat = GdipBitmapGetPixel(bitmap, 25, 25, &color); + expect(Ok, stat); + todo_wine expect(0xffaabbcc, color); + + stat = GdipBitmapGetPixel(bitmap, 56, 56, &color); + expect(Ok, stat); + todo_wine expect(0xffff0000, color); + + stat = GdipBitmapGetPixel(bitmap, 57, 57, &color); + expect(Ok, stat); + todo_wine expect(0xff0000ff, color); + + GdipDeleteRegion(solidregion); + GdipDeleteRegion(hatchregion); + GdipDeleteBrush(solidbrush); + GdipDeleteBrush(hatchbrush); + GdipDeleteGraphics(graphics); + GdipDisposeImage((GpImage*)bitmap); + GdipDisposeImage((GpImage*)metafile); +} + START_TEST(metafile) { struct GdiplusStartupInput gdiplusStartupInput; @@ -3225,6 +3321,7 @@ START_TEST(metafile) test_restoredc(); test_drawdriverstring(); test_unknownfontdecode(); + test_fillregion(); GdiplusShutdown(gdiplusToken); }
1
0
0
0
Paul Gofman : iphlpapi: Fix buffer reallocation in get_pid_map().
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 3feaca754613df248bc576b801d885baa8637050 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3feaca754613df248bc576b8…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jul 22 18:20:33 2020 +0300 iphlpapi: Fix buffer reallocation in get_pid_map(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49590
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/iphlpapi/ipstats.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 03e53abfb4..d8c2ce029b 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -1912,6 +1912,7 @@ static struct pid_map *get_pid_map( unsigned int *num_entries ) HeapFree( GetProcessHeap(), 0, buffer ); return NULL; } + buffer = new_buffer; } if (!(map = HeapAlloc( GetProcessHeap(), 0, map_count * sizeof(*map) )))
1
0
0
0
Paul Gofman : kernel32: Zero initialize module data in fetch_module().
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 3d54677586eb0a9f379839cd06c04d03fde380f7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3d54677586eb0a9f379839cd…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jul 22 16:06:12 2020 +0300 kernel32: Zero initialize module data in fetch_module(). Otherwise unitialized name string pointers may be freed in CreateToolhelp32Snapshot(). Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49590
Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/toolhelp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/toolhelp.c b/dlls/kernel32/toolhelp.c index d55e8185f2..d072ccaefc 100644 --- a/dlls/kernel32/toolhelp.c +++ b/dlls/kernel32/toolhelp.c @@ -108,9 +108,9 @@ static BOOL fetch_module( DWORD process, DWORD flags, LDR_DATA_TABLE_ENTRY **ldr while (curr != head) { if (!*num) - *ldr_mod = HeapAlloc( GetProcessHeap(), 0, sizeof(LDR_DATA_TABLE_ENTRY) ); + *ldr_mod = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LDR_DATA_TABLE_ENTRY) ); else - *ldr_mod = HeapReAlloc( GetProcessHeap(), 0, *ldr_mod, + *ldr_mod = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *ldr_mod, (*num + 1) * sizeof(LDR_DATA_TABLE_ENTRY) ); if (!*ldr_mod) break; if (!ReadProcessMemory( hProcess,
1
0
0
0
Dmitry Timoshkov : usp10: Don't specify ETO_GLYPH_INDEX for bitmap fonts.
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 24e09ac5823083bfd2e283e8b19e96a60d745e6e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=24e09ac5823083bfd2e283e8…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Tue Jul 21 18:57:00 2020 +0800 usp10: Don't specify ETO_GLYPH_INDEX for bitmap fonts. Use same check as ScriptShapeOpenType() does, fixes painting of non-latin characters in Wordpad using MS Sans Serif font. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Aric Stewart <aric(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/usp10/usp10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 322091c547..a6664279b5 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -3607,10 +3607,10 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN if (!hdc || !psc) return E_INVALIDARG; if (!piAdvance || !psa || !pwGlyphs) return E_INVALIDARG; - fuOptions &= ETO_CLIPPED + ETO_OPAQUE; + fuOptions &= ETO_CLIPPED | ETO_OPAQUE; fuOptions |= ETO_IGNORELANGUAGE; - if (!psa->fNoGlyphIndex) /* Have Glyphs? */ - fuOptions |= ETO_GLYPH_INDEX; /* Say don't do translation to glyph */ + if (!psa->fNoGlyphIndex && *psc && ((ScriptCache *)*psc)->sfnt) + fuOptions |= ETO_GLYPH_INDEX; /* We do actually have glyph indices */ if (!(lpDx = heap_calloc(cGlyphs, 2 * sizeof(*lpDx)))) return E_OUTOFMEMORY;
1
0
0
0
Alexandre Julliard : ntdll: Call virtual_set_large_address_space() directly from the Unix side.
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 9018a377355fb2906d06b50008d04761491bbfd9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9018a377355fb2906d06b500…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jul 22 14:27:33 2020 +0200 ntdll: Call virtual_set_large_address_space() directly from the Unix side. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 2 -- dlls/ntdll/unix/loader.c | 1 - dlls/ntdll/unix/server.c | 1 + dlls/ntdll/unix/unix_private.h | 2 +- dlls/ntdll/unix/virtual.c | 5 +---- dlls/ntdll/unixlib.h | 3 +-- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index adb1ed871b..bf8d71adeb 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4008,8 +4008,6 @@ void __wine_process_init(void) NtTerminateProcess( GetCurrentProcess(), status ); } - unix_funcs->virtual_set_large_address_space(); - /* the main exe needs to be the first in the load order list */ RemoveEntryList( &wm->ldr.InLoadOrderLinks ); InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks ); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 22ba928541..57b1a7e3a5 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1402,7 +1402,6 @@ static struct unix_funcs unix_funcs = virtual_map_section, virtual_locked_recvmsg, virtual_release_address_space, - virtual_set_large_address_space, exec_process, wine_server_call, server_send_fd, diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index 21817ad159..fadfcc2f9f 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1471,6 +1471,7 @@ void CDECL server_init_process_done( void *relay ) #ifdef __APPLE__ send_server_task_port(); #endif + if (nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE) virtual_set_large_address_space(); /* Install signal handlers; this cannot be done earlier, since we cannot * send exceptions to the debugger before the create process event that diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 7b4d34dead..db7ffbf8a9 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -110,7 +110,6 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN; extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN; -extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN; extern void CDECL server_send_fd( int fd ) DECLSPEC_HIDDEN; extern NTSTATUS CDECL server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, @@ -209,6 +208,7 @@ extern BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size ) DECLSPEC_HI extern SIZE_T virtual_uninterrupted_read_memory( const void *addr, void *buffer, SIZE_T size ) DECLSPEC_HIDDEN; extern NTSTATUS virtual_uninterrupted_write_memory( void *addr, const void *buffer, SIZE_T size ) DECLSPEC_HIDDEN; extern void virtual_set_force_exec( BOOL enable ) DECLSPEC_HIDDEN; +extern void virtual_set_large_address_space(void) DECLSPEC_HIDDEN; extern void virtual_fill_image_information( const pe_image_info_t *pe_info, SECTION_IMAGE_INFORMATION *info ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index f3fec7c29c..883e5cff92 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -3383,11 +3383,8 @@ void CDECL virtual_release_address_space(void) * * Enable use of a large address space when allowed by the application. */ -void CDECL virtual_set_large_address_space(void) +void virtual_set_large_address_space(void) { - IMAGE_NT_HEADERS *nt = get_exe_nt_header(); - - if (!(nt->FileHeader.Characteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)) return; /* no large address space on win9x */ if (NtCurrentTeb()->Peb->OSPlatformId != VER_PLATFORM_WIN32_NT) return; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index a706b174b4..715af51686 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 92 +#define NTDLL_UNIXLIB_VERSION 93 struct unix_funcs { @@ -93,7 +93,6 @@ struct unix_funcs ULONG protect, pe_image_info_t *image_info ); ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags ); void (CDECL *virtual_release_address_space)(void); - void (CDECL *virtual_set_large_address_space)(void); /* thread/process functions */ NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
1
0
0
0
Alexandre Julliard : ntdll: Avoid private Unix functions in RtlCreateUserStack().
by Alexandre Julliard
22 Jul '20
22 Jul '20
Module: wine Branch: master Commit: 131e53a1fc2cd7156b56402c97d53af8da72399e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=131e53a1fc2cd7156b56402c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jul 22 14:16:22 2020 +0200 ntdll: Avoid private Unix functions in RtlCreateUserStack(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/loader.c | 2 +- dlls/ntdll/unix/loader.c | 1 - dlls/ntdll/unix/unix_private.h | 3 ++- dlls/ntdll/unix/virtual.c | 3 ++- dlls/ntdll/unixlib.h | 3 +-- dlls/ntdll/virtual.c | 32 +++++++++++++++++++++++++++++++- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 18adb55c22..adb1ed871b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4016,7 +4016,7 @@ void __wine_process_init(void) RemoveEntryList( &wm->ldr.InMemoryOrderLinks ); InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderLinks ); - unix_funcs->virtual_alloc_thread_stack( &stack, 0, 0, NULL ); + RtlCreateUserStack( 0, 0, 0, 0x10000, 0x10000, &stack ); teb->Tib.StackBase = stack.StackBase; teb->Tib.StackLimit = stack.StackLimit; teb->DeallocationStack = stack.DeallocationStack; diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index dc4a579132..22ba928541 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1400,7 +1400,6 @@ static struct unix_funcs unix_funcs = get_build_id, get_host_version, virtual_map_section, - virtual_alloc_thread_stack, virtual_locked_recvmsg, virtual_release_address_space, virtual_set_large_address_space, diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 50f27c6d68..7b4d34dead 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -108,7 +108,6 @@ extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN; extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size, const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type, ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; -extern NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) DECLSPEC_HIDDEN; extern ssize_t CDECL virtual_locked_recvmsg( int fd, struct msghdr *hdr, int flags ) DECLSPEC_HIDDEN; extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN; extern void CDECL virtual_set_large_address_space(void) DECLSPEC_HIDDEN; @@ -196,6 +195,8 @@ extern TEB *virtual_alloc_first_teb(void) DECLSPEC_HIDDEN; extern NTSTATUS virtual_alloc_teb( TEB **ret_teb ) DECLSPEC_HIDDEN; extern void virtual_free_teb( TEB *teb ) DECLSPEC_HIDDEN; extern NTSTATUS virtual_clear_tls_index( ULONG index ) DECLSPEC_HIDDEN; +extern NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, + SIZE_T *pthread_size ) DECLSPEC_HIDDEN; extern void virtual_map_user_shared_data(void) DECLSPEC_HIDDEN; extern NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack ) DECLSPEC_HIDDEN; extern unsigned int virtual_locked_server_call( void *req_ptr ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 67c58642a7..f3fec7c29c 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2735,7 +2735,8 @@ NTSTATUS virtual_clear_tls_index( ULONG index ) /*********************************************************************** * virtual_alloc_thread_stack */ -NTSTATUS CDECL virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ) +NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, + SIZE_T *pthread_size ) { struct file_view *view; NTSTATUS status; diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 118f38a248..a706b174b4 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,7 +28,7 @@ struct msghdr; struct _DISPATCHER_CONTEXT; /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 91 +#define NTDLL_UNIXLIB_VERSION 92 struct unix_funcs { @@ -91,7 +91,6 @@ struct unix_funcs NTSTATUS (CDECL *virtual_map_section)( HANDLE handle, PVOID *addr_ptr, unsigned short zero_bits_64, SIZE_T commit_size, const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type, ULONG protect, pe_image_info_t *image_info ); - NTSTATUS (CDECL *virtual_alloc_thread_stack)( INITIAL_TEB *stack, SIZE_T reserve_size, SIZE_T commit_size, SIZE_T *pthread_size ); ssize_t (CDECL *virtual_locked_recvmsg)( int fd, struct msghdr *hdr, int flags ); void (CDECL *virtual_release_address_space)(void); void (CDECL *virtual_set_large_address_space)(void); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 1f582ffe60..3ba4b8afbc 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -44,6 +44,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(virtual); NTSTATUS WINAPI RtlCreateUserStack( SIZE_T commit, SIZE_T reserve, ULONG zero_bits, SIZE_T commit_align, SIZE_T reserve_align, INITIAL_TEB *stack ) { + PROCESS_STACK_ALLOCATION_INFORMATION alloc; + NTSTATUS status; + TRACE("commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p\n", commit, reserve, zero_bits, commit_align, reserve_align, stack); @@ -60,7 +63,34 @@ NTSTATUS WINAPI RtlCreateUserStack( SIZE_T commit, SIZE_T reserve, ULONG zero_bi reserve = (reserve + reserve_align - 1) & ~(reserve_align - 1); commit = (commit + commit_align - 1) & ~(commit_align - 1); - return unix_funcs->virtual_alloc_thread_stack( stack, reserve, commit, NULL ); + if (reserve < commit) reserve = commit; + if (reserve < 0x100000) reserve = 0x100000; + reserve = (reserve + 0xffff) & ~0xffff; /* round to 64K boundary */ + + alloc.ReserveSize = reserve; + alloc.ZeroBits = zero_bits; + status = NtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation, + &alloc, sizeof(alloc) ); + if (!status) + { + void *addr = alloc.StackBase; + SIZE_T size = page_size; + + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_NOACCESS ); + addr = (char *)alloc.StackBase + page_size; + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE | PAGE_GUARD ); + addr = (char *)alloc.StackBase + 2 * page_size; + size = reserve - 2 * page_size; + NtAllocateVirtualMemory( GetCurrentProcess(), &addr, 0, &size, MEM_COMMIT, PAGE_READWRITE ); + + /* note: limit is lower than base since the stack grows down */ + stack->OldStackBase = 0; + stack->OldStackLimit = 0; + stack->DeallocationStack = alloc.StackBase; + stack->StackBase = (char *)alloc.StackBase + reserve; + stack->StackLimit = (char *)alloc.StackBase + 2 * page_size; + } + return status; }
1
0
0
0
← Newer
1
...
17
18
19
20
21
22
23
...
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