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
May 2022
----- 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
907 discussions
Start a n
N
ew thread
Jacek Caban : winemac: Use NtUserSetClipboardData in set_win32_clipboard_formats_from_mac_pasteboard.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 455e334a9e0a5b7a974a6d7f9675ab2a679aa70d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=455e334a9e0a5b7a974a6d7f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri May 27 15:30:18 2022 +0200 winemac: Use NtUserSetClipboardData in set_win32_clipboard_formats_from_mac_pasteboard. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index 1b637123e0f..d7d28c69acb 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -1473,8 +1473,9 @@ static void set_win32_clipboard_formats_from_mac_pasteboard(CFArrayRef types) for (i = 0; i < count; i++) { + struct set_clipboard_params params = { 0 }; TRACE("adding format %s\n", debugstr_format(formats[i]->format_id)); - SetClipboardData(formats[i]->format_id, 0); + NtUserSetClipboardData(formats[i]->format_id, 0, ¶ms); } free(current_mac_formats);
1
0
0
0
Jacek Caban : winemac: Use ntdll for Unicode conversion in export_hdrop_to_filenames.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 36e2d7e9583d3d9db9613be89cfbe158d7fec8ac URL:
https://source.winehq.org/git/wine.git/?a=commit;h=36e2d7e9583d3d9db9613be8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu May 26 01:19:40 2022 +0200 winemac: Use ntdll for Unicode conversion in export_hdrop_to_filenames. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index eefc915d6e2..1b637123e0f 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -567,6 +567,21 @@ static void *import_html(CFDataRef data, size_t *ret_size) } +static CPTABLEINFO *get_ansi_cp(void) +{ + USHORT utf8_hdr[2] = { 0, CP_UTF8 }; + static CPTABLEINFO cp; + if (!cp.CodePage) + { + if (NtCurrentTeb()->Peb->AnsiCodePageData) + RtlInitCodePageTable(NtCurrentTeb()->Peb->AnsiCodePageData, &cp); + else + RtlInitCodePageTable(utf8_hdr, &cp); + } + return &cp; +} + + /* based on wine_get_dos_file_name */ static WCHAR *get_dos_file_name(const char *path) { @@ -942,21 +957,22 @@ static CFDataRef export_hdrop_to_filenames(void *data, size_t size) unixname = get_unix_file_name(p); else { - int len = MultiByteToWideChar(CP_ACP, 0, p, -1, NULL, 0); - if (len) - { - if (len > buffer_len) - { - free(buffer); - buffer_len = len * 2; - buffer = malloc(buffer_len * sizeof(*buffer)); - } + CPTABLEINFO *cp = get_ansi_cp(); + DWORD len = strlen(p) + 1; - MultiByteToWideChar(CP_ACP, 0, p, -1, buffer, buffer_len); - unixname = get_unix_file_name(buffer); + if (len * 3 > buffer_len) + { + free(buffer); + buffer_len = len * 3; + buffer = malloc(buffer_len * sizeof(*buffer)); } + + if (cp->CodePage == CP_UTF8) + RtlUTF8ToUnicodeN(buffer, buffer_len * sizeof(WCHAR), &len, p, len); else - unixname = NULL; + RtlCustomCPToUnicodeN(cp, buffer, buffer_len * sizeof(WCHAR), &len, p, len); + + unixname = get_unix_file_name(buffer); } if (!unixname) {
1
0
0
0
Jacek Caban : winemac: Use ntdll for UTF8 conversion.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 6e7701ae0655817094358466f3b53df2c9307fd5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6e7701ae0655817094358466…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu May 26 01:11:20 2022 +0200 winemac: Use ntdll for UTF8 conversion. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/clipboard.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/winemac.drv/clipboard.c b/dlls/winemac.drv/clipboard.c index d2780aa8bcb..eefc915d6e2 100644 --- a/dlls/winemac.drv/clipboard.c +++ b/dlls/winemac.drv/clipboard.c @@ -808,7 +808,11 @@ static void *import_utf8_to_unicodetext(CFDataRef data, size_t *ret_size) dst[j++] = 0; if ((ret = malloc(j * sizeof(WCHAR)))) - *ret_size = MultiByteToWideChar(CP_UTF8, 0, dst, j, ret, j) * sizeof(WCHAR); + { + DWORD dst_size; + RtlUTF8ToUnicodeN(ret, j * sizeof(WCHAR), &dst_size, dst, j); + *ret_size = dst_size; + } free(dst); } @@ -1031,10 +1035,12 @@ static CFDataRef export_html(void *data, size_t size) static CFDataRef export_unicodetext_to_utf8(void *data, size_t size) { CFMutableDataRef ret; - INT dst_len; + WCHAR *src = data; + DWORD dst_len = 0; - dst_len = WideCharToMultiByte(CP_UTF8, 0, data, -1, NULL, 0, NULL, NULL); - if (dst_len) dst_len--; /* Leave off null terminator. */ + /* Leave off null terminator. */ + if (size >= sizeof(WCHAR) && !src[size / sizeof(WCHAR) - 1]) size -= sizeof(WCHAR); + RtlUnicodeToUTF8N(NULL, 0, &dst_len, src, size); ret = CFDataCreateMutable(NULL, dst_len); if (ret) { @@ -1043,7 +1049,7 @@ static CFDataRef export_unicodetext_to_utf8(void *data, size_t size) CFDataSetLength(ret, dst_len); dst = (LPSTR)CFDataGetMutableBytePtr(ret); - WideCharToMultiByte(CP_UTF8, 0, data, -1, dst, dst_len, NULL, NULL); + RtlUnicodeToUTF8N(dst, dst_len, &dst_len, src, size); /* Remove carriage returns */ for (i = 0, j = 0; i < dst_len; i++)
1
0
0
0
Jacek Caban : winemac: Don't use snprintfW in macdrv_GetKeyNameText.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: cccec04f9aaed265854b06af6f888d94e5fcc465 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cccec04f9aaed265854b06af…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed May 25 23:48:35 2022 +0200 winemac: Don't use snprintfW in macdrv_GetKeyNameText. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> --- dlls/winemac.drv/keyboard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 08c76eb1389..94860f2e36c 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1266,9 +1266,11 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) if (!len) { - static const WCHAR format[] = {'K','e','y',' ','0','x','%','0','2','x',0}; - snprintfW(buffer, size, format, vkey); - len = strlenW(buffer); + char name[16]; + len = sprintf(name, "Key 0x%02x", vkey); + len = min(len + 1, size); + ascii_to_unicode(buffer, name, len); + if (len) buffer[--len] = 0; } if (!len)
1
0
0
0
Ziqing Hui : d2d1/tests: Add more effect xml.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: bf3df0bdb1781360aa0b7e587b4c907d9db7111a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf3df0bdb1781360aa0b7e58…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Thu May 26 16:40:54 2022 +0800 d2d1/tests: Add more effect xml. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/tests/d2d1.c | 161 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 142 insertions(+), 19 deletions(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 940205989bb..d5fa6f26e4d 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -88,6 +88,88 @@ L"<?xml version='1.0'?> \ </Effect> \ "; +static const WCHAR *effect_xml_minimum = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_version = +L"<Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_inputs = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_name = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_author = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_category = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_description = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_without_type = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description'/> \ + <Inputs/> \ + </Effect> \ +"; + static const DWORD test_vs[] = { #if 0 @@ -10497,6 +10579,26 @@ static void test_effect_register(BOOL d3d11) ID2D1Effect *effect; HRESULT hr; + const struct xml_test + { + const WCHAR *xml; + HRESULT hr; + } + xml_tests[] = + { + {effect_xml_a, S_OK}, + {effect_xml_b, S_OK}, + {effect_xml_c, S_OK}, + {effect_xml_minimum, S_OK}, + {effect_xml_without_version, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, + {effect_xml_without_inputs, E_INVALIDARG}, + {effect_xml_without_name, E_INVALIDARG}, + {effect_xml_without_author, E_INVALIDARG}, + {effect_xml_without_category, E_INVALIDARG}, + {effect_xml_without_description, E_INVALIDARG}, + {effect_xml_without_type, E_INVALIDARG}, + }; + const D2D1_PROPERTY_BINDING binding[] = { {L"Integer", effect_impl_set_integer, effect_impl_get_integer}, @@ -10543,27 +10645,48 @@ static void test_effect_register(BOOL d3d11) } /* Register effect once */ - hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, - effect_xml_a, NULL, 0, effect_impl_create); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); - todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr); + for (i = 0; i < ARRAY_SIZE(xml_tests); ++i) + { + const struct xml_test *test = &xml_tests[i]; + winetest_push_context("Test %u", i); + + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create); + todo_wine_if(test->hr != S_OK) + ok(hr == test->hr, "Got unexpected hr %#lx, expected %#lx.\n", hr, test->hr); + if (hr == S_OK) + { + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr); + } + + winetest_pop_context(); + } /* Register effect multiple times */ - hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, - effect_xml_a, NULL, 0, effect_impl_create); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, - effect_xml_a, NULL, 0, effect_impl_create); - ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); - todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); - todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr); + for (i = 0; i < ARRAY_SIZE(xml_tests); ++i) + { + const struct xml_test *test = &xml_tests[i]; + + if (test->hr != S_OK) + continue; + + winetest_push_context("Test %u", i); + + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, test->xml, NULL, 0, effect_impl_create); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr); + + winetest_pop_context(); + } /* Register effect multiple times with different xml */ hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
1
0
0
0
Ziqing Hui : d2d1/tests: Test registering effect multiple times with different binding.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 3b4e112c17a461bdf9119b4ad6d68d0d60ba1f9c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3b4e112c17a461bdf9119b4a…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Thu May 26 16:40:53 2022 +0800 d2d1/tests: Test registering effect multiple times with different binding. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/tests/d2d1.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 29d3780a6e7..940205989bb 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -10437,7 +10437,7 @@ static HRESULT STDMETHODCALLTYPE effect_impl_create(IUnknown **effect_impl) object->ID2D1EffectImpl_iface.lpVtbl = &effect_impl_vtbl; object->refcount = 1; - object->integer = 0; + object->integer = 10; object->effect_context = NULL; *effect_impl = (IUnknown *)&object->ID2D1EffectImpl_iface; @@ -10489,11 +10489,12 @@ static HRESULT STDMETHODCALLTYPE effect_impl_get_context(const IUnknown *iface, static void test_effect_register(BOOL d3d11) { ID2D1DeviceContext *device_context; + ID2D1EffectContext *effect_context; struct d2d1_test_context ctx; + unsigned int i, integer; ID2D1Factory1 *factory; WCHAR display_name[64]; ID2D1Effect *effect; - unsigned int i; HRESULT hr; const D2D1_PROPERTY_BINDING binding[] = @@ -10613,6 +10614,52 @@ static void test_effect_register(BOOL d3d11) winetest_pop_context(); } + /* Register effect multiple times with different binding */ + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, + effect_xml_c, binding, 1, effect_impl_create); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + integer = 0xdeadbeef; + effect_context = (ID2D1EffectContext *)0xdeadbeef; + hr = ID2D1Effect_GetValueByName(effect, L"Integer", + D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Effect_GetValueByName(effect, L"Context", + D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(integer == 10, "Got unexpected integer %u.\n", integer); + ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context); + ID2D1Effect_Release(effect); + } + + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, + effect_xml_c, binding + 1, 1, effect_impl_create); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + integer = 0xdeadbeef; + effect_context = (ID2D1EffectContext *)0xdeadbeef; + hr = ID2D1Effect_GetValueByName(effect, L"Integer", + D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Effect_GetValueByName(effect, L"Context", + D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(integer == 10, "Got unexpected integer %u.\n", integer); + ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context); + ID2D1Effect_Release(effect); + } + + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + /* Unregister builtin effect */ hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_D2D1Composite); todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
1
0
0
0
Ziqing Hui : d2d1/tests: Test effect property if register effect multiple times with different xml.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: a95433d685b9f228948e6d1fa28bdb4879c007be URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a95433d685b9f228948e6d1f…
Author: Ziqing Hui <zhui(a)codeweavers.com> Date: Thu May 26 16:40:52 2022 +0800 d2d1/tests: Test effect property if register effect multiple times with different xml. Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/tests/d2d1.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index d5adb0c749c..29d3780a6e7 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -37,7 +37,7 @@ DEFINE_GUID(GUID_TestPixelShader, 0x53015748,0xfc13,0x4168,0xbd,0x13,0x0f,0xcf, static const WCHAR *effect_xml_a = L"<?xml version='1.0'?> \ <Effect> \ - <Property name='DisplayName' type='string' value='TestEffect'/> \ + <Property name='DisplayName' type='string' value='TestEffectA'/> \ <Property name='Author' type='string' value='The Wine Project'/> \ <Property name='Category' type='string' value='Test'/> \ <Property name='Description' type='string' value='Test effect.'/> \ @@ -56,7 +56,7 @@ L"<?xml version='1.0'?> \ static const WCHAR *effect_xml_b = L"<?xml version='1.0'?> \ <Effect> \ - <Property name='DisplayName' type='string' value='TestEffect'/> \ + <Property name='DisplayName' type='string' value='TestEffectB'/> \ <Property name='Author' type='string' value='The Wine Project'/> \ <Property name='Category' type='string' value='Test'/> \ <Property name='Description' type='string' value='Test effect.'/> \ @@ -72,7 +72,7 @@ L"<?xml version='1.0'?> \ static const WCHAR *effect_xml_c = L"<?xml version='1.0'?> \ <Effect> \ - <Property name='DisplayName' type='string' value='TestEffect'/> \ + <Property name='DisplayName' type='string' value='TestEffectC'/> \ <Property name='Author' type='string' value='The Wine Project'/> \ <Property name='Category' type='string' value='Test'/> \ <Property name='Description' type='string' value='Test effect.'/> \ @@ -10488,8 +10488,11 @@ static HRESULT STDMETHODCALLTYPE effect_impl_get_context(const IUnknown *iface, static void test_effect_register(BOOL d3d11) { + ID2D1DeviceContext *device_context; struct d2d1_test_context ctx; ID2D1Factory1 *factory; + WCHAR display_name[64]; + ID2D1Effect *effect; unsigned int i; HRESULT hr; @@ -10529,6 +10532,7 @@ static void test_effect_register(BOOL d3d11) if (!init_test_context(&ctx, d3d11)) return; + device_context = ctx.context; factory = ctx.factory1; if (!factory) { @@ -10564,9 +10568,31 @@ static void test_effect_register(BOOL d3d11) hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, effect_xml_a, NULL, 0, effect_impl_create); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name)); + ID2D1Effect_Release(effect); + } + hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect, effect_xml_b, NULL, 0, effect_impl_create); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, + D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name)); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name)); + ID2D1Effect_Release(effect); + } + hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect); todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
1
0
0
0
Dmitry Timoshkov : crypt32: CryptAcquireCertificatePrivateKey() should reset last error code on success.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 559a83a8f434bd7d856b86010793be592b874a23 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=559a83a8f434bd7d856b8601…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Fri May 27 10:55:20 2022 +0300 crypt32: CryptAcquireCertificatePrivateKey() should reset last error code on success. One of Chrome crypto plugins depends on this. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/crypt32/cert.c | 1 + dlls/crypt32/tests/cert.c | 45 +++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index ad39b7d18c7..b57cc685212 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -1006,6 +1006,7 @@ BOOL WINAPI CryptAcquireCertificatePrivateKey(PCCERT_CONTEXT pCert, CryptMemFree(info); if (cert_in_store) CertFreeCertificateContext(cert_in_store); + if (ret) SetLastError(0); return ret; } diff --git a/dlls/crypt32/tests/cert.c b/dlls/crypt32/tests/cert.c index 0f8684a5483..ea25826f4ed 100644 --- a/dlls/crypt32/tests/cert.c +++ b/dlls/crypt32/tests/cert.c @@ -4305,45 +4305,42 @@ static void testAcquireCertPrivateKey(void) CERT_KEY_CONTEXT keyContext; /* Don't cache provider */ + SetLastError(0xdeadbeef); ret = CryptAcquireCertificatePrivateKey(cert, 0, NULL, &certCSP, &keySpec, &callerFree); - ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", - GetLastError()); - if (ret) - { - ok(callerFree, "Expected callerFree to be TRUE\n"); - CryptReleaseContext(certCSP, 0); - } + ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %08lx\n", GetLastError()); + ok(callerFree, "Expected callerFree to be TRUE\n"); + CryptReleaseContext(certCSP, 0); + SetLastError(0xdeadbeef); ret = CryptAcquireCertificatePrivateKey(cert, 0, NULL, &certCSP, NULL, NULL); - ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", - GetLastError()); + ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %08lx\n", GetLastError()); CryptReleaseContext(certCSP, 0); /* Use the key prov info's caching (there shouldn't be any) */ + SetLastError(0xdeadbeef); ret = CryptAcquireCertificatePrivateKey(cert, CRYPT_ACQUIRE_USE_PROV_INFO_FLAG, NULL, &certCSP, &keySpec, &callerFree); - ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", - GetLastError()); - if (ret) - { - ok(callerFree, "Expected callerFree to be TRUE\n"); - CryptReleaseContext(certCSP, 0); - } + ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %08lx\n", GetLastError()); + ok(callerFree, "Expected callerFree to be TRUE\n"); + CryptReleaseContext(certCSP, 0); /* Cache it (and check that it's cached) */ + SetLastError(0xdeadbeef); ret = CryptAcquireCertificatePrivateKey(cert, CRYPT_ACQUIRE_CACHE_FLAG, NULL, &certCSP, &keySpec, &callerFree); - ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", - GetLastError()); + ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %08lx\n", GetLastError()); ok(!callerFree, "Expected callerFree to be FALSE\n"); size = sizeof(keyContext); ret = CertGetCertificateContextProperty(cert, CERT_KEY_CONTEXT_PROP_ID, &keyContext, &size); - ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", - GetLastError()); + ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); /* Remove the cached provider */ CryptReleaseContext(keyContext.hCryptProv, 0); @@ -4354,17 +4351,17 @@ static void testAcquireCertPrivateKey(void) CertSetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo); /* Now use the key prov info's caching */ + SetLastError(0xdeadbeef); ret = CryptAcquireCertificatePrivateKey(cert, CRYPT_ACQUIRE_USE_PROV_INFO_FLAG, NULL, &certCSP, &keySpec, &callerFree); - ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", - GetLastError()); + ok(ret, "CryptAcquireCertificatePrivateKey failed: %08lx\n", GetLastError()); + ok(GetLastError() == ERROR_SUCCESS, "got %08lx\n", GetLastError()); ok(!callerFree, "Expected callerFree to be FALSE\n"); size = sizeof(keyContext); ret = CertGetCertificateContextProperty(cert, CERT_KEY_CONTEXT_PROP_ID, &keyContext, &size); - ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", - GetLastError()); + ok(ret, "CertGetCertificateContextProperty failed: %08lx\n", GetLastError()); CryptReleaseContext(certCSP, 0); CryptDestroyKey(key);
1
0
0
0
Rémi Bernon : ntdll: Use struct entry directly for the free lists.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 0044e52784ed313af0cbe7f5fdcdbd71efc78715 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0044e52784ed313af0cbe7f5…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri May 27 09:16:40 2022 +0200 ntdll: Use struct entry directly for the free lists. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 9ca7abb1bb3..16abc158e55 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -74,6 +74,8 @@ struct rtl_heap_entry /* header for heap blocks */ +#define ALIGNMENT (2 * sizeof(void *)) + typedef struct block { DWORD size; /* Block size; must be the first field */ @@ -92,11 +94,13 @@ C_ASSERT( sizeof(struct block) == 8 ); /* entry to link free blocks in free lists */ -typedef struct entry +struct DECLSPEC_ALIGN(ALIGNMENT) entry { struct block block; struct list entry; -} ARENA_FREE; +}; + +C_ASSERT( sizeof(struct entry) == 2 * ALIGNMENT ); typedef struct { @@ -122,7 +126,6 @@ typedef struct #define ARENA_FREE_FILLER 0xfeeefeee /* everything is aligned on 8 byte boundaries (16 for Win64) */ -#define ALIGNMENT (2*sizeof(void*)) #define LARGE_ALIGNMENT 16 /* large blocks have stricter alignment */ #define ARENA_OFFSET (ALIGNMENT - sizeof(ARENA_INUSE)) #define COMMIT_MASK 0xffff /* bitmask for commit/decommit granularity */ @@ -137,7 +140,7 @@ C_ASSERT( sizeof(ARENA_LARGE) % LARGE_ALIGNMENT == 0 ); #define HEAP_MIN_DATA_SIZE ROUND_SIZE(2 * sizeof(struct list)) #define HEAP_MIN_BLOCK_SIZE (HEAP_MIN_DATA_SIZE + sizeof(ARENA_INUSE)) /* minimum size that must remain to shrink an allocated block */ -#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(ARENA_FREE)) +#define HEAP_MIN_SHRINK_SIZE (HEAP_MIN_DATA_SIZE+sizeof(struct entry)) /* minimum size to start allocating large blocks */ #define HEAP_MIN_LARGE_BLOCK_SIZE (0x10000 * ALIGNMENT - 0x1000) /* extra size to add at the end of block for tail checking */ @@ -156,12 +159,6 @@ static const SIZE_T free_list_sizes[] = }; #define HEAP_NB_FREE_LISTS (ARRAY_SIZE(free_list_sizes) + HEAP_NB_SMALL_FREE_LISTS) -typedef union -{ - ARENA_FREE arena; - void *alignment[4]; -} FREE_LIST_ENTRY; - struct tagHEAP; typedef struct DECLSPEC_ALIGN(ALIGNMENT) tagSUBHEAP @@ -200,7 +197,7 @@ typedef struct tagHEAP DWORD pending_pos; /* Position in pending free requests ring */ ARENA_INUSE **pending_free; /* Ring buffer for pending free requests */ RTL_CRITICAL_SECTION cs; - FREE_LIST_ENTRY free_lists[HEAP_NB_FREE_LISTS]; + struct entry free_lists[HEAP_NB_FREE_LISTS]; SUBHEAP subheap; } HEAP; @@ -249,7 +246,7 @@ static inline void block_set_type( struct block *block, UINT type ) static inline UINT block_get_overhead( const struct block *block ) { - if (block_get_flags( block ) & BLOCK_FLAG_FREE) return sizeof(struct entry); + if (block_get_flags( block ) & BLOCK_FLAG_FREE) return sizeof(*block) + sizeof(struct list); return sizeof(*block) + block->unused_bytes; } @@ -425,7 +422,7 @@ static void notify_free_all( SUBHEAP *subheap ) /* size is the size of the whole block including the arena header */ static inline struct entry *find_free_list( HEAP *heap, SIZE_T block_size, BOOL last ) { - FREE_LIST_ENTRY *list, *end = heap->free_lists + ARRAY_SIZE(heap->free_lists); + struct entry *list, *end = heap->free_lists + ARRAY_SIZE(heap->free_lists); unsigned int i; if (block_size <= HEAP_MAX_SMALL_FREE_LIST) @@ -435,7 +432,7 @@ static inline struct entry *find_free_list( HEAP *heap, SIZE_T block_size, BOOL list = heap->free_lists + i; if (last && ++list == end) list = heap->free_lists; - return &list->arena; + return list; } /* get the memory protection type to use for a given heap */ @@ -492,8 +489,8 @@ static void heap_dump( const HEAP *heap ) if (i < HEAP_NB_SMALL_FREE_LISTS) size = HEAP_MIN_BLOCK_SIZE + i * ALIGNMENT; else size = free_list_sizes[i - HEAP_NB_SMALL_FREE_LISTS]; TRACE( " %p: size %8Ix, prev %p, next %p\n", heap->free_lists + i, size, - LIST_ENTRY( heap->free_lists[i].arena.entry.prev, struct entry, entry ), - LIST_ENTRY( heap->free_lists[i].arena.entry.next, struct entry, entry ) ); + LIST_ENTRY( heap->free_lists[i].entry.prev, struct entry, entry ), + LIST_ENTRY( heap->free_lists[i].entry.next, struct entry, entry ) ); } TRACE( " subheaps: %p\n", &heap->subheap_list ); @@ -629,7 +626,7 @@ static inline BOOL subheap_commit( SUBHEAP *subheap, const struct block *block, SIZE_T size; void *addr; - commit_end = (char *)block + block_size + sizeof(ARENA_FREE); + commit_end = (char *)block + block_size + sizeof(struct entry); commit_end = ROUND_ADDR((char *)commit_end + COMMIT_MASK, COMMIT_MASK); if (commit_end > end) commit_end = end; @@ -908,8 +905,8 @@ static BOOL validate_large_arena( const HEAP *heap, const ARENA_LARGE *arena ) static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, SIZE_T commitSize, SIZE_T totalSize ) { + struct entry *pEntry; SUBHEAP *subheap; - FREE_LIST_ENTRY *pEntry; unsigned int i; if (!address) @@ -968,12 +965,12 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, /* Build the free lists */ - list_init( &heap->free_lists[0].arena.entry ); + list_init( &heap->free_lists[0].entry ); for (i = 0, pEntry = heap->free_lists; i < HEAP_NB_FREE_LISTS; i++, pEntry++) { - block_set_size( &pEntry->arena.block, BLOCK_FLAG_FREE_LINK, 0 ); - block_set_type( &pEntry->arena.block, ARENA_FREE_MAGIC ); - if (i) list_add_after( &pEntry[-1].arena.entry, &pEntry->arena.entry ); + block_set_size( &pEntry->block, BLOCK_FLAG_FREE_LINK, 0 ); + block_set_type( &pEntry->block, ARENA_FREE_MAGIC ); + if (i) list_add_after( &pEntry[-1].entry, &pEntry->entry ); } /* Initialize critical section */ @@ -1025,7 +1022,7 @@ static struct block *find_free_block( HEAP *heap, SIZE_T block_size, SUBHEAP **s /* Find a suitable free list, and in it find a block large enough */ - while ((ptr = list_next( &heap->free_lists[0].arena.entry, ptr ))) + while ((ptr = list_next( &heap->free_lists[0].entry, ptr ))) { entry = LIST_ENTRY( ptr, struct entry, entry ); block = (struct block *)entry; @@ -1048,7 +1045,7 @@ static struct block *find_free_block( HEAP *heap, SIZE_T block_size, SUBHEAP **s } /* make sure we can fit the block and a free entry at the end */ - total_size = sizeof(SUBHEAP) + block_size + sizeof(ARENA_FREE); + total_size = sizeof(SUBHEAP) + block_size + sizeof(struct entry); if (total_size < block_size) return NULL; /* overflow */ if ((*subheap = HEAP_CreateSubHeap( heap, NULL, heap->flags, total_size, @@ -1078,7 +1075,7 @@ static BOOL is_valid_free_block( const HEAP *heap, const struct block *block ) unsigned int i; if ((subheap = find_subheap( heap, block, FALSE ))) return TRUE; - for (i = 0; i < HEAP_NB_FREE_LISTS; i++) if (block == &heap->free_lists[i].arena.block) return TRUE; + for (i = 0; i < HEAP_NB_FREE_LISTS; i++) if (block == &heap->free_lists[i].block) return TRUE; return FALSE; }
1
0
0
0
Rémi Bernon : ntdll: Rename freeList variables to free_list.
by Alexandre Julliard
27 May '22
27 May '22
Module: wine Branch: master Commit: 2cc6f00a7814348b26c04c07cfe37143021964a3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2cc6f00a7814348b26c04c07…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri May 27 09:15:42 2022 +0200 ntdll: Rename freeList variables to free_list. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/ntdll/heap.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 411bb26aa3d..9ca7abb1bb3 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -150,11 +150,11 @@ C_ASSERT( HEAP_MAX_SMALL_FREE_LIST % ALIGNMENT == 0 ); #define HEAP_NB_SMALL_FREE_LISTS (((HEAP_MAX_SMALL_FREE_LIST - HEAP_MIN_BLOCK_SIZE) / ALIGNMENT) + 1) /* Max size of the blocks on the free lists above HEAP_MAX_SMALL_FREE_LIST */ -static const SIZE_T HEAP_freeListSizes[] = +static const SIZE_T free_list_sizes[] = { 0x200, 0x400, 0x1000, ~(SIZE_T)0 }; -#define HEAP_NB_FREE_LISTS (ARRAY_SIZE( HEAP_freeListSizes ) + HEAP_NB_SMALL_FREE_LISTS) +#define HEAP_NB_FREE_LISTS (ARRAY_SIZE(free_list_sizes) + HEAP_NB_SMALL_FREE_LISTS) typedef union { @@ -200,7 +200,7 @@ typedef struct tagHEAP DWORD pending_pos; /* Position in pending free requests ring */ ARENA_INUSE **pending_free; /* Ring buffer for pending free requests */ RTL_CRITICAL_SECTION cs; - FREE_LIST_ENTRY freeList[HEAP_NB_FREE_LISTS]; + FREE_LIST_ENTRY free_lists[HEAP_NB_FREE_LISTS]; SUBHEAP subheap; } HEAP; @@ -425,16 +425,16 @@ static void notify_free_all( SUBHEAP *subheap ) /* size is the size of the whole block including the arena header */ static inline struct entry *find_free_list( HEAP *heap, SIZE_T block_size, BOOL last ) { - FREE_LIST_ENTRY *list, *end = heap->freeList + ARRAY_SIZE(heap->freeList); + FREE_LIST_ENTRY *list, *end = heap->free_lists + ARRAY_SIZE(heap->free_lists); unsigned int i; if (block_size <= HEAP_MAX_SMALL_FREE_LIST) i = (block_size - HEAP_MIN_BLOCK_SIZE) / ALIGNMENT; else for (i = HEAP_NB_SMALL_FREE_LISTS; i < HEAP_NB_FREE_LISTS - 1; i++) - if (block_size <= HEAP_freeListSizes[i - HEAP_NB_SMALL_FREE_LISTS]) break; + if (block_size <= free_list_sizes[i - HEAP_NB_SMALL_FREE_LISTS]) break; - list = heap->freeList + i; - if (last && ++list == end) list = heap->freeList; + list = heap->free_lists + i; + if (last && ++list == end) list = heap->free_lists; return &list->arena; } @@ -486,14 +486,14 @@ static void heap_dump( const HEAP *heap ) TRACE( "heap: %p\n", heap ); TRACE( " next %p\n", LIST_ENTRY( heap->entry.next, HEAP, entry ) ); - TRACE( " free_lists: %p\n", heap->freeList ); + TRACE( " free_lists: %p\n", heap->free_lists ); for (i = 0; i < HEAP_NB_FREE_LISTS; i++) { if (i < HEAP_NB_SMALL_FREE_LISTS) size = HEAP_MIN_BLOCK_SIZE + i * ALIGNMENT; - else size = HEAP_freeListSizes[i - HEAP_NB_SMALL_FREE_LISTS]; - TRACE( " %p: size %8Ix, prev %p, next %p\n", heap->freeList + i, size, - LIST_ENTRY( heap->freeList[i].arena.entry.prev, struct entry, entry ), - LIST_ENTRY( heap->freeList[i].arena.entry.next, struct entry, entry ) ); + else size = free_list_sizes[i - HEAP_NB_SMALL_FREE_LISTS]; + TRACE( " %p: size %8Ix, prev %p, next %p\n", heap->free_lists + i, size, + LIST_ENTRY( heap->free_lists[i].arena.entry.prev, struct entry, entry ), + LIST_ENTRY( heap->free_lists[i].arena.entry.next, struct entry, entry ) ); } TRACE( " subheaps: %p\n", &heap->subheap_list ); @@ -968,8 +968,8 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags, /* Build the free lists */ - list_init( &heap->freeList[0].arena.entry ); - for (i = 0, pEntry = heap->freeList; i < HEAP_NB_FREE_LISTS; i++, pEntry++) + list_init( &heap->free_lists[0].arena.entry ); + for (i = 0, pEntry = heap->free_lists; i < HEAP_NB_FREE_LISTS; i++, pEntry++) { block_set_size( &pEntry->arena.block, BLOCK_FLAG_FREE_LINK, 0 ); block_set_type( &pEntry->arena.block, ARENA_FREE_MAGIC ); @@ -1025,7 +1025,7 @@ static struct block *find_free_block( HEAP *heap, SIZE_T block_size, SUBHEAP **s /* Find a suitable free list, and in it find a block large enough */ - while ((ptr = list_next( &heap->freeList[0].arena.entry, ptr ))) + while ((ptr = list_next( &heap->free_lists[0].arena.entry, ptr ))) { entry = LIST_ENTRY( ptr, struct entry, entry ); block = (struct block *)entry; @@ -1078,8 +1078,7 @@ static BOOL is_valid_free_block( const HEAP *heap, const struct block *block ) unsigned int i; if ((subheap = find_subheap( heap, block, FALSE ))) return TRUE; - if (block_get_flags( block ) != BLOCK_FLAG_FREE_LINK) return FALSE; - for (i = 0; i < HEAP_NB_FREE_LISTS; i++) if (block == &heap->freeList[i].arena.block) return TRUE; + for (i = 0; i < HEAP_NB_FREE_LISTS; i++) if (block == &heap->free_lists[i].arena.block) return TRUE; return FALSE; }
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
91
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Results per page:
10
25
50
100
200