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
April 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
1024 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Add support for 2019 and 2020 WindowsSettings namespaces.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 1326687feb2b66d8013034387cfb47ea1bb99e7e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1326687feb2b66d801303438…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Apr 11 16:54:20 2022 +0200 ntdll: Add support for 2019 and 2020 WindowsSettings namespaces. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/actctx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 92f2f0148b2..be003b7c267 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -615,6 +615,8 @@ static const WCHAR windowsSettings2005NSW[] = L"
http://schemas.microsoft.com/SMI
static const WCHAR windowsSettings2011NSW[] = L"
http://schemas.microsoft.com/SMI/2011/WindowsSettings
"; static const WCHAR windowsSettings2016NSW[] = L"
http://schemas.microsoft.com/SMI/2016/WindowsSettings
"; static const WCHAR windowsSettings2017NSW[] = L"
http://schemas.microsoft.com/SMI/2017/WindowsSettings
"; +static const WCHAR windowsSettings2019NSW[] = L"
http://schemas.microsoft.com/SMI/2019/WindowsSettings
"; +static const WCHAR windowsSettings2020NSW[] = L"
http://schemas.microsoft.com/SMI/2020/WindowsSettings
"; struct olemisc_entry { @@ -2535,12 +2537,14 @@ static void parse_windows_settings_elem( xmlbuf_t *xmlbuf, struct assembly *asse while (next_xml_elem( xmlbuf, &elem, parent )) { - if (xml_elem_cmp( &elem, L"autoElevate", windowsSettings2005NSW ) || + if (xml_elem_cmp( &elem, L"activeCodePage", windowsSettings2019NSW ) || + xml_elem_cmp( &elem, L"autoElevate", windowsSettings2005NSW ) || xml_elem_cmp( &elem, L"disableTheming", windowsSettings2005NSW ) || xml_elem_cmp( &elem, L"disableWindowFiltering", windowsSettings2011NSW ) || xml_elem_cmp( &elem, L"dpiAware", windowsSettings2005NSW ) || xml_elem_cmp( &elem, L"dpiAwareness", windowsSettings2016NSW ) || xml_elem_cmp( &elem, L"gdiScaling", windowsSettings2017NSW ) || + xml_elem_cmp( &elem, L"heapType", windowsSettings2020NSW ) || xml_elem_cmp( &elem, L"highResolutionScrollingAware", windowsSettings2017NSW ) || xml_elem_cmp( &elem, L"longPathAware", windowsSettings2016NSW ) || xml_elem_cmp( &elem, L"magicFutureSetting", windowsSettings2017NSW ) || @@ -2564,7 +2568,7 @@ static void parse_application_elem( xmlbuf_t *xmlbuf, struct assembly *assembly, while (next_xml_elem( xmlbuf, &elem, parent )) { - if (xml_elem_cmp( &elem, L"windowsSettings", asmv3W )) + if (xml_elem_cmp( &elem, L"windowsSettings", asmv1W )) { parse_windows_settings_elem( xmlbuf, assembly, acl, &elem ); } @@ -2783,7 +2787,7 @@ static void parse_assembly_elem( xmlbuf_t *xmlbuf, struct assembly* assembly, { parse_compatibility_elem(xmlbuf, assembly, acl, &elem); } - else if (xml_elem_cmp(&elem, L"application", asmv3W)) + else if (xml_elem_cmp(&elem, L"application", asmv1W)) { parse_application_elem(xmlbuf, assembly, acl, &elem); } @@ -5845,7 +5849,9 @@ NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings( DWORD flags, HANDL if (wcscmp( ns, windowsSettings2005NSW ) && wcscmp( ns, windowsSettings2011NSW ) && wcscmp( ns, windowsSettings2016NSW ) && - wcscmp( ns, windowsSettings2017NSW )) + wcscmp( ns, windowsSettings2017NSW ) && + wcscmp( ns, windowsSettings2019NSW ) && + wcscmp( ns, windowsSettings2020NSW )) return STATUS_INVALID_PARAMETER; } else ns = windowsSettings2005NSW;
1
0
0
0
Alexandre Julliard : kernelbase: Move codepage initialization to ntdll.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: e81327358a26b160740b3421a4c7f300b4d2f06f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e81327358a26b160740b3421…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 13 15:13:16 2022 +0200 kernelbase: Move codepage initialization to ntdll. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 28 +++++++--------------------- dlls/ntdll/locale.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 25d6d76c0c4..42dcfff50e0 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -285,7 +285,6 @@ struct norm_table static NLSTABLEINFO nls_info; static UINT unix_cp = CP_UTF8; -static UINT mac_cp = 10000; static LCID system_lcid; static LCID user_lcid; static HKEY intl_key; @@ -1752,7 +1751,7 @@ static void update_locale_registry(void) */ void init_locale( HMODULE module ) { - UINT ansi_cp = 0, oem_cp = 0; + USHORT utf8[2] = { 0, CP_UTF8 }; USHORT *ansi_ptr, *oem_ptr; void *sort_ptr; WCHAR bufferW[LOCALE_NAME_MAX_LENGTH]; @@ -1781,26 +1780,13 @@ void init_locale( HMODULE module ) if (GetEnvironmentVariableW( L"WINEUNIXCP", bufferW, ARRAY_SIZE(bufferW) )) unix_cp = wcstoul( bufferW, NULL, 10 ); - GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, - (WCHAR *)&ansi_cp, sizeof(ansi_cp)/sizeof(WCHAR) ); - GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTMACCODEPAGE | LOCALE_RETURN_NUMBER, - (WCHAR *)&mac_cp, sizeof(mac_cp)/sizeof(WCHAR) ); - GetLocaleInfoW( LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER, - (WCHAR *)&oem_cp, sizeof(oem_cp)/sizeof(WCHAR) ); - NtGetNlsSectionPtr( 9, 0, NULL, &sort_ptr, &size ); NtGetNlsSectionPtr( 12, NormalizationC, NULL, (void **)&norm_info, &size ); init_sortkeys( sort_ptr ); - if (!ansi_cp || NtGetNlsSectionPtr( 11, ansi_cp, NULL, (void **)&ansi_ptr, &size )) - NtGetNlsSectionPtr( 11, 1252, NULL, (void **)&ansi_ptr, &size ); - if (!oem_cp || NtGetNlsSectionPtr( 11, oem_cp, 0, (void **)&oem_ptr, &size )) - NtGetNlsSectionPtr( 11, 437, NULL, (void **)&oem_ptr, &size ); - NtCurrentTeb()->Peb->AnsiCodePageData = ansi_ptr; - NtCurrentTeb()->Peb->OemCodePageData = oem_ptr; - NtCurrentTeb()->Peb->UnicodeCaseTableData = sort.casemap; + ansi_ptr = NtCurrentTeb()->Peb->AnsiCodePageData ? NtCurrentTeb()->Peb->AnsiCodePageData : utf8; + oem_ptr = NtCurrentTeb()->Peb->OemCodePageData ? NtCurrentTeb()->Peb->OemCodePageData : utf8; RtlInitNlsTables( ansi_ptr, oem_ptr, sort.casemap, &nls_info ); - RtlResetRtlTranslations( &nls_info ); RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\Nls", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &nls_key, NULL ); @@ -1840,11 +1826,11 @@ void init_locale( HMODULE module ) if (!RegCreateKeyExW( nls_key, L"Codepage", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL )) { - count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", ansi_cp ); + count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", GetACP() ); RegSetValueExW( hkey, L"ACP", 0, REG_SZ, (BYTE *)bufferW, (count + 1) * sizeof(WCHAR) ); - count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", oem_cp ); + count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", GetOEMCP() ); RegSetValueExW( hkey, L"OEMCP", 0, REG_SZ, (BYTE *)bufferW, (count + 1) * sizeof(WCHAR) ); - count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", mac_cp ); + count = swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03d", system_locale->idefaultmaccodepage ); RegSetValueExW( hkey, L"MACCP", 0, REG_SZ, (BYTE *)bufferW, (count + 1) * sizeof(WCHAR) ); RegCloseKey( hkey ); } @@ -1989,7 +1975,7 @@ static const CPTABLEINFO *get_codepage_table( UINT codepage ) case CP_OEMCP: return &nls_info.OemTableInfo; case CP_MACCP: - codepage = mac_cp; + codepage = system_locale->idefaultmaccodepage; break; case CP_THREAD_ACP: codepage = get_lcid_codepage( NtCurrentTeb()->CurrentLocale, 0 ); diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 597910e5639..3c96a742e4e 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -153,10 +153,14 @@ static const NLS_LOCALE_DATA *get_locale_data( UINT idx ) void locale_init(void) { + USHORT utf8[2] = { 0, CP_UTF8 }; WCHAR locale[LOCALE_NAME_MAX_LENGTH]; UNICODE_STRING name, value; LARGE_INTEGER unused; + SIZE_T size; LCID system_lcid, user_lcid = 0; + UINT ansi_cp = 1252, oem_cp = 437; + void *ansi_ptr = utf8, *oem_ptr = utf8, *case_ptr; NTSTATUS status; struct { @@ -189,10 +193,38 @@ void locale_init(void) const NLS_LOCALE_LCNAME_INDEX *entry = find_lcname_entry( locale ); if (entry) user_lcid = get_locale_data( entry->idx )->idefaultlanguage; } - if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) system_lcid = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); if (!user_lcid) user_lcid = system_lcid; NtSetDefaultUILanguage( user_lcid ); NtSetDefaultLocale( TRUE, user_lcid ); + + if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) + { + system_lcid = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); + ansi_cp = oem_cp = CP_UTF8; + } + else + { + const NLS_LOCALE_LCID_INDEX *entry = find_lcid_entry( system_lcid ); + ansi_cp = get_locale_data( entry->idx )->idefaultansicodepage; + oem_cp = get_locale_data( entry->idx )->idefaultcodepage; + } + + NtGetNlsSectionPtr( 10, 0, NULL, &case_ptr, &size ); + NtCurrentTeb()->Peb->UnicodeCaseTableData = case_ptr; + if (ansi_cp != CP_UTF8) + { + NtGetNlsSectionPtr( 11, ansi_cp, NULL, &ansi_ptr, &size ); + NtCurrentTeb()->Peb->AnsiCodePageData = ansi_ptr; + } + if (oem_cp != CP_UTF8) + { + NtGetNlsSectionPtr( 11, oem_cp, NULL, &oem_ptr, &size ); + NtCurrentTeb()->Peb->OemCodePageData = oem_ptr; + } + RtlInitNlsTables( ansi_ptr, oem_ptr, case_ptr, &nls_info ); + NlsAnsiCodePage = nls_info.AnsiTableInfo.CodePage; + NlsMbCodePageTag = nls_info.AnsiTableInfo.DBCSCodePage; + NlsMbOemCodePageTag = nls_info.OemTableInfo.DBCSCodePage; }
1
0
0
0
Alexandre Julliard : ntdll: Initialize the system locale on the Unix side.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: d53bc38d34ee043e16d3b0abf523f4e9407db8cb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d53bc38d34ee043e16d3b0ab…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 13 14:38:05 2022 +0200 ntdll: Initialize the system locale on the Unix side. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 16 ++++---------- dlls/ntdll/locale.c | 9 +------- dlls/ntdll/unix/env.c | 57 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 95d7d77ecd7..25d6d76c0c4 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -366,10 +366,9 @@ static void load_locale_nls(void) UINT index_count; } *geo_header; - LCID lcid; LARGE_INTEGER dummy; - RtlGetLocaleFileMappingAddress( (void **)&header, &lcid, &dummy ); + RtlGetLocaleFileMappingAddress( (void **)&header, &system_lcid, &dummy ); locale_table = (const NLS_LOCALE_HEADER *)((char *)header + header->locales); lcids_index = (const NLS_LOCALE_LCID_INDEX *)((char *)locale_table + locale_table->lcids_offset); lcnames_index = (const NLS_LOCALE_LCNAME_INDEX *)((char *)locale_table + locale_table->lcnames_offset); @@ -1766,17 +1765,10 @@ void init_locale( HMODULE module ) kernelbase_handle = module; load_locale_nls(); - NtQueryDefaultLocale( FALSE, &system_lcid ); - NtQueryDefaultLocale( TRUE, &user_lcid ); - if (!(system_locale = NlsValidateLocale( &system_lcid, 0 ))) - { - if (GetEnvironmentVariableW( L"WINELOCALE", bufferW, ARRAY_SIZE(bufferW) )) - system_locale = get_locale_by_name( bufferW, &system_lcid ); - if (!system_locale) system_locale = get_locale_by_name( L"en-US", &system_lcid ); - } - system_lcid = system_locale->ilanguage; - if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) system_lcid = LOCALE_CUSTOM_DEFAULT; + if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) system_lcid = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); + system_locale = NlsValidateLocale( &system_lcid, 0 ); + NtQueryDefaultLocale( TRUE, &user_lcid ); if (!(user_locale = NlsValidateLocale( &user_lcid, 0 ))) { if (GetEnvironmentVariableW( L"WINEUSERLOCALE", bufferW, ARRAY_SIZE(bufferW) )) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index 36fe3e92863..597910e5639 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -183,23 +183,16 @@ void locale_init(void) value.Buffer = locale; value.MaximumLength = sizeof(locale); - RtlInitUnicodeString( &name, L"WINELOCALE" ); - if (!RtlQueryEnvironmentVariable_U( NULL, &name, &value )) - { - const NLS_LOCALE_LCNAME_INDEX *entry = find_lcname_entry( locale ); - if (entry) system_lcid = get_locale_data( entry->idx )->idefaultlanguage; - } RtlInitUnicodeString( &name, L"WINEUSERLOCALE" ); if (!RtlQueryEnvironmentVariable_U( NULL, &name, &value )) { const NLS_LOCALE_LCNAME_INDEX *entry = find_lcname_entry( locale ); if (entry) user_lcid = get_locale_data( entry->idx )->idefaultlanguage; } - if (!system_lcid) system_lcid = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); + if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) system_lcid = MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); if (!user_lcid) user_lcid = system_lcid; NtSetDefaultUILanguage( user_lcid ); NtSetDefaultLocale( TRUE, user_lcid ); - NtSetDefaultLocale( FALSE, system_lcid ); } diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 3976e5b4365..ee958ae71f4 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -74,7 +74,7 @@ char **main_envp = NULL; WCHAR **main_wargv = NULL; static LCID user_lcid, system_lcid; -static LANGID user_ui_language, system_ui_language; +static LANGID user_ui_language; static char system_locale[LOCALE_NAME_MAX_LENGTH]; static char user_locale[LOCALE_NAME_MAX_LENGTH]; @@ -348,7 +348,6 @@ static BOOL is_dynamic_env_var( const char *var ) STARTS_WITH( var, "WINECONFIGDIR=" ) || STARTS_WITH( var, "WINEDLLDIR" ) || STARTS_WITH( var, "WINEUNIXCP=" ) || - STARTS_WITH( var, "WINELOCALE=" ) || STARTS_WITH( var, "WINEUSERLOCALE=" ) || STARTS_WITH( var, "WINEUSERNAME=" ) || STARTS_WITH( var, "WINEPRELOADRESERVE=" ) || @@ -762,6 +761,47 @@ static BOOL unix_to_win_locale( const char *unix_name, char *win_name ) } +static LCID init_system_lcid( void *locale_ptr ) +{ + struct + { + UINT ctypes; + UINT unknown1; + UINT unknown2; + UINT unknown3; + UINT locales; + UINT charmaps; + UINT geoids; + UINT scripts; + } *header = locale_ptr; + WCHAR name[LOCALE_NAME_MAX_LENGTH]; + const NLS_LOCALE_LCNAME_INDEX *lcnames; + const NLS_LOCALE_HEADER *locale_table; + const WCHAR *locale_strings; + int min, max; + + ascii_to_unicode( name, system_locale, strlen(system_locale) + 1 ); + locale_table = (const NLS_LOCALE_HEADER *)((char *)header + header->locales); + locale_strings = (const WCHAR *)((char *)locale_table + locale_table->strings_offset); + lcnames = (const NLS_LOCALE_LCNAME_INDEX *)((char *)locale_table + locale_table->lcnames_offset); + min = 0; + max = locale_table->nb_lcnames - 1; + while (min <= max) + { + int pos = (min + max) / 2; + int res = wcsicmp( name, locale_strings + lcnames[pos].name + 1 ); + if (res < 0) max = pos - 1; + else if (res > 0) min = pos + 1; + else + { + ULONG offset = locale_table->locales_offset + lcnames[pos].idx * locale_table->locale_size; + return ((const NLS_LOCALE_DATA *)((const char *)locale_table + offset))->idefaultlanguage; + } + } + return MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ); +} + + /****************************************************************** * init_locale */ @@ -1043,9 +1083,7 @@ static void add_dynamic_environment( WCHAR **env, SIZE_T *pos, SIZE_T *size ) append_envA( env, pos, size, "WINEUNIXCP", str ); } else append_envW( env, pos, size, "WINEUNIXCP", NULL ); - append_envA( env, pos, size, "WINELOCALE", system_locale ); - append_envA( env, pos, size, "WINEUSERLOCALE", - strcmp( user_locale, system_locale ) ? user_locale : NULL ); + append_envA( env, pos, size, "WINEUSERLOCALE", user_locale ); append_envA( env, pos, size, "SystemDrive", "C:" ); append_envA( env, pos, size, "SystemRoot", "C:\\windows" ); } @@ -2179,6 +2217,7 @@ NTSTATUS WINAPI NtInitializeNlsFiles( void **ptr, LCID *lcid, LARGE_INTEGER *siz status = map_section( handle, ptr, &mapsize, PAGE_READONLY ); NtClose( handle ); } + if (!status && !system_lcid) system_lcid = init_system_lcid( *ptr ); *lcid = system_lcid; return status; } @@ -2200,11 +2239,7 @@ NTSTATUS WINAPI NtQueryDefaultLocale( BOOLEAN user, LCID *lcid ) NTSTATUS WINAPI NtSetDefaultLocale( BOOLEAN user, LCID lcid ) { if (user) user_lcid = lcid; - else - { - system_lcid = lcid; - system_ui_language = LANGIDFROMLCID(lcid); /* there is no separate call to set it */ - } + else system_lcid = lcid; return STATUS_SUCCESS; } @@ -2234,7 +2269,7 @@ NTSTATUS WINAPI NtSetDefaultUILanguage( LANGID lang ) */ NTSTATUS WINAPI NtQueryInstallUILanguage( LANGID *lang ) { - *lang = system_ui_language; + *lang = LANGIDFROMLCID(system_lcid); /* there is no separate call to set it */ return STATUS_SUCCESS; }
1
0
0
0
Alexandre Julliard : msvcrt: Fix mbcs initialization for UTF-8 codepage.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 83a3a5c75b84b779525de2ce92f0be2c487e1087 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=83a3a5c75b84b779525de2ce…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Mar 23 17:25:46 2022 +0100 msvcrt: Fix mbcs initialization for UTF-8 codepage. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/mbcs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 166af32cd27..fa25a7092e3 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -220,7 +220,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo) WORD chartypes[256]; char bufA[256]; WCHAR bufW[256], lowW[256], upW[256]; - int charcount; + int charcount, maxchar; int ret; int i; @@ -288,7 +288,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo) bytes += 2; } - if (cpi.MaxCharSize > 1) + if (cpi.MaxCharSize == 2) { /* trail bytes not available through kernel32 but stored in a structure in msvcrt */ struct cp_extra_info_t *cpextra = g_cpextrainfo; @@ -316,10 +316,12 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo) else mbcinfo->ismbcodepage = 0; + maxchar = (newcp == CP_UTF8) ? 128 : 256; + /* we can't use GetStringTypeA directly because we don't have a locale - only a code page */ charcount = 0; - for (i = 0; i < 256; i++) + for (i = 0; i < maxchar; i++) if (!(mbcinfo->mbctype[i + 1] & _M1)) bufA[charcount++] = i; @@ -335,7 +337,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo) LCMapStringW(lcid, LCMAP_UPPERCASE, bufW, charcount, upW, charcount); charcount = 0; - for (i = 0; i < 256; i++) + for (i = 0; i < maxchar; i++) if (!(mbcinfo->mbctype[i + 1] & _M1)) { if (chartypes[charcount] & C1_UPPER) @@ -359,7 +361,7 @@ threadmbcinfo* create_mbcinfo(int cp, LCID lcid, threadmbcinfo *old_mbcinfo) } charcount = 0; - for (i = 0; i < 256; i++) + for (i = 0; i < maxchar; i++) { if(!(mbcinfo->mbctype[i + 1] & _M1)) {
1
0
0
0
Rémi Bernon : kernel32/tests: Add some HeapWalk tests for the LFH frontend.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 29fe143544e5d344d1e961c73b2907df47e3cb5e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=29fe143544e5d344d1e961c7…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 8 16:06:51 2022 +0200 kernel32/tests: Add some HeapWalk tests for the LFH frontend. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 127 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 1e82b3c18f4..53cff284c6f 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -740,6 +740,133 @@ static void test_HeapCreate(void) ret = HeapDestroy( heap ); ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); + + + /* LFH actually doesn't enable immediately, the pattern is required */ + + heap = HeapCreate( 0, 0, 0 ); + ok( !!heap, "HeapCreate failed, error %lu\n", GetLastError() ); + ok( !((ULONG_PTR)heap & 0xffff), "wrong heap alignment\n" ); + + compat_info = 2; + ret = pHeapSetInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info) ); + ok( ret, "HeapSetInformation failed, error %lu\n", GetLastError() ); + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + todo_wine + ok( compat_info == 2, "got HeapCompatibilityInformation %lu\n", compat_info ); + + for (i = 0; i < 0x11; i++) ptrs[i] = pHeapAlloc( heap, 0, 24 + 2 * sizeof(void *) ); + for (i = 0; i < 0x11; i++) HeapFree( heap, 0, ptrs[i] ); + + count = 0; + memset( &entries, 0xcd, sizeof(entries) ); + memset( &entry, 0xcd, sizeof(entry) ); + entry.lpData = NULL; + SetLastError( 0xdeadbeef ); + while ((ret = HeapWalk( heap, &entry ))) entries[count++] = entry; + ok( GetLastError() == ERROR_NO_MORE_ITEMS, "got error %lu\n", GetLastError() ); + todo_wine + ok( count == 3, "got count %lu\n", count ); + + todo_wine + ok( entries[0].wFlags == PROCESS_HEAP_REGION, "got wFlags %#x\n", entries[0].wFlags ); + todo_wine + ok( entries[0].lpData == heap, "got lpData %p\n", entries[0].lpData ); + todo_wine + ok( entries[0].cbData <= 0x1000 /* sizeof(*heap) */, "got cbData %#lx\n", entries[0].cbData ); + todo_wine + ok( entries[0].cbOverhead == 0, "got cbOverhead %#x\n", entries[0].cbOverhead ); + ok( entries[0].iRegionIndex == 0, "got iRegionIndex %d\n", entries[0].iRegionIndex ); + todo_wine + ok( entries[1].wFlags == 0, "got wFlags %#x\n", entries[1].wFlags ); + todo_wine + ok( entries[2].wFlags == PROCESS_HEAP_UNCOMMITTED_RANGE, "got wFlags %#x\n", entries[2].wFlags ); + + for (i = 0; i < 0x12; i++) ptrs[i] = pHeapAlloc( heap, 0, 24 + 2 * sizeof(void *) ); + for (i = 0; i < 0x12; i++) HeapFree( heap, 0, ptrs[i] ); + + count = 0; + memset( &entries, 0xcd, sizeof(entries) ); + memset( &entry, 0xcd, sizeof(entry) ); + entry.lpData = NULL; + SetLastError( 0xdeadbeef ); + while ((ret = HeapWalk( heap, &entry ))) entries[count++] = entry; + ok( GetLastError() == ERROR_NO_MORE_ITEMS, "got error %lu\n", GetLastError() ); + todo_wine + ok( count > 24, "got count %lu\n", count ); + if (count < 2) count = 2; + + todo_wine + ok( entries[0].wFlags == PROCESS_HEAP_REGION, "got wFlags %#x\n", entries[0].wFlags ); + todo_wine + ok( entries[0].lpData == heap, "got lpData %p\n", entries[0].lpData ); + todo_wine + ok( entries[0].cbData <= 0x1000 /* sizeof(*heap) */, "got cbData %#lx\n", entries[0].cbData ); + todo_wine + ok( entries[0].cbOverhead == 0, "got cbOverhead %#x\n", entries[0].cbOverhead ); + ok( entries[0].iRegionIndex == 0, "got iRegionIndex %d\n", entries[0].iRegionIndex ); + todo_wine + ok( entries[1].wFlags == 0, "got wFlags %#x\n", entries[1].wFlags ); + + for (i = 0; i < 0x12; i++) + { + todo_wine + ok( entries[4 + i].wFlags == 0, "got wFlags %#x\n", entries[4 + i].wFlags ); + todo_wine + ok( entries[4 + i].cbData == 0x20, "got cbData %#lx\n", entries[4 + i].cbData ); + todo_wine + ok( entries[4 + i].cbOverhead == 2 * sizeof(void *), "got cbOverhead %#x\n", entries[4 + i].cbOverhead ); + } + + if (entries[count - 1].wFlags == PROCESS_HEAP_REGION) /* > win7 */ + ok( entries[count - 2].wFlags == PROCESS_HEAP_UNCOMMITTED_RANGE, "got wFlags %#x\n", entries[count - 2].wFlags ); + else + { + todo_wine + ok( entries[count - 1].wFlags == PROCESS_HEAP_UNCOMMITTED_RANGE, "got wFlags %#x\n", entries[count - 2].wFlags ); + } + + for (i = 0; i < 0x12; i++) ptrs[i] = pHeapAlloc( heap, 0, 24 + 2 * sizeof(void *) ); + + count = 0; + memset( &entries, 0xcd, sizeof(entries) ); + memset( &entry, 0xcd, sizeof(entry) ); + entry.lpData = NULL; + SetLastError( 0xdeadbeef ); + while ((ret = HeapWalk( heap, &entry ))) entries[count++] = entry; + ok( GetLastError() == ERROR_NO_MORE_ITEMS, "got error %lu\n", GetLastError() ); + todo_wine + ok( count > 24, "got count %lu\n", count ); + if (count < 2) count = 2; + + todo_wine + ok( entries[0].wFlags == PROCESS_HEAP_REGION, "got wFlags %#x\n", entries[0].wFlags ); + todo_wine + ok( entries[0].lpData == heap, "got lpData %p\n", entries[0].lpData ); + ok( entries[0].cbData <= 0x1000 /* sizeof(*heap) */, "got cbData %#lx\n", entries[0].cbData ); + todo_wine + ok( entries[0].cbOverhead == 0, "got cbOverhead %#x\n", entries[0].cbOverhead ); + ok( entries[0].iRegionIndex == 0, "got iRegionIndex %d\n", entries[0].iRegionIndex ); + ok( entries[1].wFlags == 0 || entries[1].wFlags == PROCESS_HEAP_ENTRY_BUSY /* win7 */, "got wFlags %#x\n", entries[1].wFlags ); + + for (i = 1; i < count - 2; i++) + { + if (entries[i].wFlags != PROCESS_HEAP_ENTRY_BUSY) continue; + todo_wine_if( sizeof(void *) == 8 ) + ok( entries[i].cbData == 0x18 + 2 * sizeof(void *), "got cbData %#lx\n", entries[i].cbData ); + ok( entries[i].cbOverhead == 0x8, "got cbOverhead %#x\n", entries[i].cbOverhead ); + } + + if (entries[count - 1].wFlags == PROCESS_HEAP_REGION) /* > win7 */ + ok( entries[count - 2].wFlags == PROCESS_HEAP_UNCOMMITTED_RANGE, "got wFlags %#x\n", entries[count - 2].wFlags ); + else + ok( entries[count - 1].wFlags == PROCESS_HEAP_UNCOMMITTED_RANGE, "got wFlags %#x\n", entries[count - 2].wFlags ); + + for (i = 0; i < 0x12; i++) HeapFree( heap, 0, ptrs[i] ); + + ret = HeapDestroy( heap ); + ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); }
1
0
0
0
Rémi Bernon : kernel32/tests: Cleanup and add Heap(Query|Set)Information tests.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 98066b5a8e571e708f3dec4d2f72831b7ecc308a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=98066b5a8e571e708f3dec4d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 8 16:06:50 2022 +0200 kernel32/tests: Cleanup and add Heap(Query|Set)Information tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 147 +++++++++++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 52 deletions(-) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 3e608efb8dc..1e82b3c18f4 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -44,6 +44,7 @@ static BOOL (WINAPI *pGetPhysicallyInstalledSystemMemory)( ULONGLONG * ); #define MAKE_FUNC(f) static typeof(f) *p ## f MAKE_FUNC( HeapQueryInformation ); +MAKE_FUNC( HeapSetInformation ); MAKE_FUNC( GlobalFlags ); MAKE_FUNC( RtlGetNtGlobalFlags ); #undef MAKE_FUNC @@ -57,6 +58,7 @@ static void load_functions(void) LOAD_FUNC( kernel32, HeapAlloc ); LOAD_FUNC( kernel32, HeapReAlloc ); LOAD_FUNC( kernel32, HeapQueryInformation ); + LOAD_FUNC( kernel32, HeapSetInformation ); LOAD_FUNC( kernel32, GetPhysicallyInstalledSystemMemory ); LOAD_FUNC( kernel32, GlobalFlags ); LOAD_FUNC( ntdll, RtlGetNtGlobalFlags ); @@ -84,6 +86,7 @@ static void test_HeapCreate(void) HANDLE heap, heap1, heaps[8]; BYTE *ptr, *ptr1, *ptrs[128]; DWORD heap_count, count; + ULONG compat_info; UINT_PTR align; BOOL ret; @@ -643,6 +646,98 @@ static void test_HeapCreate(void) ret = HeapFree( heap, 0, ptr ); ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); + size = 0; + SetLastError( 0xdeadbeef ); + ret = pHeapQueryInformation( 0, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + todo_wine + ok( !ret, "HeapQueryInformation succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_NOACCESS, "got error %lu\n", GetLastError() ); + todo_wine + ok( size == 0, "got size %Iu\n", size ); + + size = 0; + SetLastError( 0xdeadbeef ); + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, NULL, 0, &size ); + ok( !ret, "HeapQueryInformation succeeded\n" ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got error %lu\n", GetLastError() ); + ok( size == sizeof(ULONG), "got size %Iu\n", size ); + + SetLastError( 0xdeadbeef ); + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, NULL, 0, NULL ); + ok( !ret, "HeapQueryInformation succeeded\n" ); + ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got error %lu\n", GetLastError() ); + + SetLastError( 0xdeadbeef ); + compat_info = 0xdeadbeef; + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info) + 1, NULL ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + ok( compat_info == 0, "got compat_info %lu\n", compat_info ); + + ret = HeapDestroy( heap ); + ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); + + + /* check setting LFH compat info */ + + heap = HeapCreate( 0, 0, 0 ); + ok( !!heap, "HeapCreate failed, error %lu\n", GetLastError() ); + ok( !((ULONG_PTR)heap & 0xffff), "wrong heap alignment\n" ); + + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + ok( compat_info == 0, "got HeapCompatibilityInformation %lu\n", compat_info ); + + compat_info = 2; + ret = pHeapSetInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info) ); + ok( ret, "HeapSetInformation failed, error %lu\n", GetLastError() ); + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + todo_wine + ok( compat_info == 2, "got HeapCompatibilityInformation %lu\n", compat_info ); + + /* cannot be undone */ + + compat_info = 0; + SetLastError( 0xdeadbeef ); + ret = pHeapSetInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info) ); + todo_wine + ok( !ret, "HeapSetInformation succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_GEN_FAILURE, "got error %lu\n", GetLastError() ); + compat_info = 1; + SetLastError( 0xdeadbeef ); + ret = pHeapSetInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info) ); + todo_wine + ok( !ret, "HeapSetInformation succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_GEN_FAILURE, "got error %lu\n", GetLastError() ); + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + todo_wine + ok( compat_info == 2, "got HeapCompatibilityInformation %lu\n", compat_info ); + + ret = HeapDestroy( heap ); + ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); + + /* some allocation pattern automatically enables LFH */ + + heap = HeapCreate( 0, 0, 0 ); + ok( !!heap, "HeapCreate failed, error %lu\n", GetLastError() ); + ok( !((ULONG_PTR)heap & 0xffff), "wrong heap alignment\n" ); + + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + ok( compat_info == 0, "got HeapCompatibilityInformation %lu\n", compat_info ); + + for (i = 0; i < 0x12; i++) ptrs[i] = pHeapAlloc( heap, 0, 0 ); + for (i = 0; i < 0x12; i++) HeapFree( heap, 0, ptrs[i] ); + + ret = pHeapQueryInformation( heap, HeapCompatibilityInformation, &compat_info, sizeof(compat_info), &size ); + ok( ret, "HeapQueryInformation failed, error %lu\n", GetLastError() ); + todo_wine + ok( compat_info == 2, "got HeapCompatibilityInformation %lu\n", compat_info ); + ret = HeapDestroy( heap ); ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); } @@ -1505,57 +1600,6 @@ static void test_LocalAlloc(void) } } -static void test_HeapQueryInformation(void) -{ - ULONG info; - SIZE_T size; - BOOL ret; - - if (!pHeapQueryInformation) - { - win_skip("HeapQueryInformation is not available\n"); - return; - } - - if (0) /* crashes under XP */ - { - size = 0; - pHeapQueryInformation(0, - HeapCompatibilityInformation, - &info, sizeof(info), &size); - size = 0; - pHeapQueryInformation(GetProcessHeap(), - HeapCompatibilityInformation, - NULL, sizeof(info), &size); - } - - size = 0; - SetLastError(0xdeadbeef); - ret = pHeapQueryInformation(GetProcessHeap(), - HeapCompatibilityInformation, - NULL, 0, &size); - ok(!ret, "HeapQueryInformation should fail\n"); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "expected ERROR_INSUFFICIENT_BUFFER got %lu\n", GetLastError()); - ok(size == sizeof(ULONG), "expected 4, got %Iu\n", size); - - SetLastError(0xdeadbeef); - ret = pHeapQueryInformation(GetProcessHeap(), - HeapCompatibilityInformation, - NULL, 0, NULL); - ok(!ret, "HeapQueryInformation should fail\n"); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "expected ERROR_INSUFFICIENT_BUFFER got %lu\n", GetLastError()); - - info = 0xdeadbeaf; - SetLastError(0xdeadbeef); - ret = pHeapQueryInformation(GetProcessHeap(), - HeapCompatibilityInformation, - &info, sizeof(info) + 1, NULL); - ok(ret, "HeapQueryInformation error %lu\n", GetLastError()); - ok(info == 0 || info == 1 || info == 2, "expected 0, 1 or 2, got %lu\n", info); -} - static void test_heap_checks( DWORD flags ) { BYTE old, *p, *p2; @@ -2017,7 +2061,6 @@ START_TEST(heap) test_GlobalAlloc(); test_LocalAlloc(); - test_HeapQueryInformation(); test_GetPhysicallyInstalledSystemMemory(); test_GlobalMemoryStatus();
1
0
0
0
Rémi Bernon : kernel32/tests: Add some HeapWalk tests.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 0237d1702f77372bd923c2ac4591cebdcdeb2709 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0237d1702f77372bd923c2ac…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 8 16:06:49 2022 +0200 kernel32/tests: Add some HeapWalk tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 270 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=0237d1702f77372bd923…
1
0
0
0
Rémi Bernon : kernel32/tests: Add some GetProcessHeaps tests.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 13a4da538ce9132394d5a6fd16a8fa75febd0b8f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=13a4da538ce9132394d5a6fd…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 8 16:06:48 2022 +0200 kernel32/tests: Add some GetProcessHeaps tests. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 190e83cc208..80e5d588047 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -80,23 +80,40 @@ static void test_HeapCreate(void) { static const BYTE buffer[512] = {0}; SIZE_T alloc_size = 0x8000 * sizeof(void *), size, i; + HANDLE heap, heap1, heaps[8]; BYTE *ptr, *ptr1, *ptrs[128]; - HANDLE heap, heap1; + DWORD heap_count, count; UINT_PTR align; BOOL ret; + heap_count = GetProcessHeaps( 0, NULL ); + ok( heap_count <= 6, "GetProcessHeaps returned %lu\n", heap_count ); + /* check heap alignment */ heap = HeapCreate( 0, 0, 0 ); ok( !!heap, "HeapCreate failed, error %lu\n", GetLastError() ); ok( !((ULONG_PTR)heap & 0xffff), "wrong heap alignment\n" ); + count = GetProcessHeaps( 0, NULL ); + ok( count == heap_count + 1, "GetProcessHeaps returned %lu\n", count ); heap1 = HeapCreate( 0, 0, 0 ); ok( !!heap, "HeapCreate failed, error %lu\n", GetLastError() ); ok( !((ULONG_PTR)heap1 & 0xffff), "wrong heap alignment\n" ); + count = GetProcessHeaps( 0, NULL ); + ok( count == heap_count + 2, "GetProcessHeaps returned %lu\n", count ); + count = GetProcessHeaps( ARRAY_SIZE(heaps), heaps ); + ok( count == heap_count + 2, "GetProcessHeaps returned %lu\n", count ); + ok( heaps[0] == GetProcessHeap(), "got wrong heap\n" ); + todo_wine + ok( heaps[heap_count + 0] == heap, "got wrong heap\n" ); + todo_wine + ok( heaps[heap_count + 1] == heap1, "got wrong heap\n" ); ret = HeapDestroy( heap1 ); ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); ret = HeapDestroy( heap ); ok( ret, "HeapDestroy failed, error %lu\n", GetLastError() ); + count = GetProcessHeaps( 0, NULL ); + ok( count == heap_count, "GetProcessHeaps returned %lu\n", count ); /* growable heap */
1
0
0
0
Rémi Bernon : kernel32/tests: Add invalid pointer heap validation tests.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 93d5aba89c26201c5c01626ea741c94d464863e4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=93d5aba89c26201c5c01626e…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Apr 8 16:06:47 2022 +0200 kernel32/tests: Add invalid pointer heap validation tests. Adding commented-out crashing tests to make it obvious that they were tested and that HeapFree or HeapReAlloc don't validate pointers. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index 6f85ecc6425..190e83cc208 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -78,6 +78,7 @@ struct heap static void test_HeapCreate(void) { + static const BYTE buffer[512] = {0}; SIZE_T alloc_size = 0x8000 * sizeof(void *), size, i; BYTE *ptr, *ptr1, *ptrs[128]; HANDLE heap, heap1; @@ -107,12 +108,49 @@ static void test_HeapCreate(void) ret = HeapFree( heap, 0, NULL ); ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); +#if 0 /* crashes */ + SetLastError( 0xdeadbeef ); + ret = HeapFree( heap, 0, (void *)0xdeadbe00 ); + ok( !ret, "HeapFree succeeded\n" ); + ok( GetLastError() == ERROR_NOACCESS, "got error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ptr = (BYTE *)((UINT_PTR)buffer & ~63) + 64; + ret = HeapFree( heap, 0, ptr ); + ok( !ret, "HeapFree succeeded\n" ); + ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); +#endif SetLastError( 0xdeadbeef ); ptr = HeapReAlloc( heap, 0, NULL, 1 ); ok( !ptr, "HeapReAlloc succeeded\n" ); todo_wine ok( GetLastError() == NO_ERROR, "got error %lu\n", GetLastError() ); +#if 0 /* crashes */ + SetLastError( 0xdeadbeef ); + ptr1 = HeapReAlloc( heap, 0, (void *)0xdeadbe00, 1 ); + ok( !ptr1, "HeapReAlloc succeeded\n" ); + ok( GetLastError() == ERROR_NOACCESS, "got error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ptr = (BYTE *)((UINT_PTR)buffer & ~63) + 64; + ptr1 = HeapReAlloc( heap, 0, ptr, 1 ); + ok( !ptr1, "HeapReAlloc succeeded\n" ); + ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); +#endif + + SetLastError( 0xdeadbeef ); + ret = HeapValidate( heap, 0, NULL ); + ok( ret, "HeapValidate failed, error %lu\n", GetLastError() ); + ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ret = HeapValidate( heap, 0, (void *)0xdeadbe00 ); + ok( !ret, "HeapValidate succeeded\n" ); + todo_wine + ok( GetLastError() == ERROR_NOACCESS, "got error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ptr = (BYTE *)((UINT_PTR)buffer & ~63) + 64; + ret = HeapValidate( heap, 0, ptr ); + ok( !ret, "HeapValidate succeeded\n" ); + ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); ptr = HeapAlloc( heap, 0, 0 ); ok( !!ptr, "HeapAlloc failed, error %lu\n", GetLastError() ); @@ -122,8 +160,14 @@ static void test_HeapCreate(void) ok( !ptr1, "HeapReAlloc succeeded\n" ); ptr1 = pHeapReAlloc( heap, 0, ptr, ~(SIZE_T)0 ); ok( !ptr1, "HeapReAlloc succeeded\n" ); + ret = HeapValidate( heap, 0, ptr ); + ok( ret, "HeapValidate failed, error %lu\n", GetLastError() ); ret = HeapFree( heap, 0, ptr ); ok( ret, "HeapFree failed, error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + ret = HeapValidate( heap, 0, ptr ); + ok( !ret, "HeapValidate succeeded\n" ); + ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() ); ptr = pHeapAlloc( heap, 0, ~(SIZE_T)0 ); ok( !ptr, "HeapAlloc succeeded\n" ); @@ -247,6 +291,7 @@ static void test_HeapCreate(void) ptr1 = HeapReAlloc( heap, HEAP_REALLOC_IN_PLACE_ONLY, ptr, 2 * alloc_size ); todo_wine ok( ptr1 != ptr, "HeapReAlloc HEAP_REALLOC_IN_PLACE_ONLY succeeded\n" ); + todo_wine ok( GetLastError() == ERROR_NOT_ENOUGH_MEMORY, "got error %lu\n", GetLastError() ); ret = HeapFree( heap, 0, ptr1 );
1
0
0
0
Paul Gofman : ntdll: Remove unused PTHREAD_STACK_MIN definition.
by Alexandre Julliard
13 Apr '22
13 Apr '22
Module: wine Branch: master Commit: 8c931c7129b2fb64de119d6ab5df413ab339fd9a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8c931c7129b2fb64de119d6a…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Mon Apr 11 13:26:32 2022 +0300 ntdll: Remove unused PTHREAD_STACK_MIN definition. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/thread.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index b8546edde87..503230e4634 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -71,10 +71,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread); WINE_DECLARE_DEBUG_CHANNEL(seh); -#ifndef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 16384 -#endif - static int nb_threads = 1; static inline int get_unix_exit_code( NTSTATUS status )
1
0
0
0
← Newer
1
...
57
58
59
60
61
62
63
...
103
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Results per page:
10
25
50
100
200