winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 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
1138 discussions
Start a n
N
ew thread
Alexandre Julliard : kernelbase: Reimplement EnumUILanguages() using the locale.nls data.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 1f70f72b29b08a6ff085581f900959bc4458816e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1f70f72b29b08a6ff085581f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 16:57:15 2022 +0100 kernelbase: Reimplement EnumUILanguages() using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/locale.c | 4 ++++ dlls/kernelbase/locale.c | 54 ++++++++++++++++++++++++++++++-------------- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 2bc368c8bc1..d30a771c2c2 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -3849,6 +3849,10 @@ static void test_EnumUILanguageA(void) } ok(ret, "Expected ret != 0, got %d, error %ld\n", ret, GetLastError()); + SetLastError(0xdeadbeef); + ret = pEnumUILanguagesA(luilocale_proc1A, MUI_LANGUAGE_NAME, 0); + ok(ret, "Expected ret != 0, got %d, error %ld\n", ret, GetLastError()); + enumCount = 0; SetLastError(ERROR_SUCCESS); ret = pEnumUILanguagesA(luilocale_proc2A, 0, 0); diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index faa7b657adc..0fd6d393eba 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -3111,38 +3111,58 @@ BOOL WINAPI DECLSPEC_HOTPATCH Internal_EnumTimeFormats( TIMEFMT_ENUMPROCW proc, BOOL WINAPI DECLSPEC_HOTPATCH Internal_EnumUILanguages( UILANGUAGE_ENUMPROCW proc, DWORD flags, LONG_PTR param, BOOL unicode ) { - WCHAR name[10]; - DWORD name_len, type, index = 0; - HKEY key; + WCHAR nameW[LOCALE_NAME_MAX_LENGTH]; + char nameA[LOCALE_NAME_MAX_LENGTH]; + DWORD i; if (!proc) { SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } - if (flags & ~MUI_LANGUAGE_ID) + if (flags & ~(MUI_LANGUAGE_ID | MUI_LANGUAGE_NAME)) { SetLastError( ERROR_INVALID_FLAGS ); return FALSE; } - if (RegOpenKeyExW( nls_key, L"Locale", 0, KEY_READ, &key )) return FALSE; - - for (;;) + for (i = 0; i < locale_table->nb_lcnames; i++) { - name_len = ARRAY_SIZE(name); - if (RegEnumValueW( key, index++, name, &name_len, NULL, &type, NULL, NULL )) break; - if (type != REG_SZ) continue; - if (!wcstoul( name, NULL, 16 )) continue; - if (!unicode) + if (!lcnames_index[i].name) continue; /* skip invariant locale */ + if (lcnames_index[i].id & 0x80000000) continue; /* skip aliases */ + if (!get_locale_data( lcnames_index[i].idx )->inotneutral) continue; /* skip neutral locales */ + if (!SORTIDFROMLCID( lcnames_index[i].id ) != !(flags & LCID_ALTERNATE_SORTS)) + continue; /* skip alternate sorts */ + if (flags & MUI_LANGUAGE_NAME) { - char nameA[10]; - WideCharToMultiByte( CP_ACP, 0, name, -1, nameA, sizeof(nameA), NULL, NULL ); - if (!((UILANGUAGE_ENUMPROCA)proc)( nameA, param )) break; + const WCHAR *str = locale_strings + lcnames_index[i].name; + + if (unicode) + { + memcpy( nameW, str + 1, (*str + 1) * sizeof(WCHAR) ); + if (!proc( nameW, param )) break; + } + else + { + WideCharToMultiByte( CP_ACP, 0, str + 1, -1, nameA, sizeof(nameA), NULL, NULL ); + if (!((UILANGUAGE_ENUMPROCA)proc)( nameA, param )) break; + } + } + else + { + if (lcnames_index[i].id == LOCALE_CUSTOM_UNSPECIFIED) continue; /* skip locales with no lcid */ + if (unicode) + { + swprintf( nameW, ARRAY_SIZE(nameW), L"%04lx", lcnames_index[i].id ); + if (!proc( nameW, param )) break; + } + else + { + sprintf( nameA, "%04x", lcnames_index[i].id ); + if (!((UILANGUAGE_ENUMPROCA)proc)( nameA, param )) break; + } } - else if (!proc( name, param )) break; } - RegCloseKey( key ); return TRUE; }
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement LocaleNameToLCID() using the locale.nls data.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: e74b0dc880a49985a912d54073cf4cf093c5c595 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e74b0dc880a49985a912d540…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 16:52:42 2022 +0100 kernelbase: Reimplement LocaleNameToLCID() using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index db9466fdd58..faa7b657adc 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -5596,10 +5596,15 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringW( LCID lcid, DWORD flags, const WCHAR * LCID WINAPI DECLSPEC_HOTPATCH LocaleNameToLCID( const WCHAR *name, DWORD flags ) { LCID lcid; + const NLS_LOCALE_DATA *locale = get_locale_by_name( name, &lcid ); - if (!name) return GetUserDefaultLCID(); - if (!set_ntstatus( RtlLocaleNameToLcid( name, &lcid, 2 ))) return 0; - if (!(flags & LOCALE_ALLOW_NEUTRAL_NAMES)) lcid = ConvertDefaultLocale( lcid ); + if (!locale) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + if (!(flags & LOCALE_ALLOW_NEUTRAL_NAMES) && !locale->inotneutral) + lcid = locale->idefaultlanguage; return lcid; }
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement ConvertDefaultLocale() using the locale.nls data.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 17c353a3bb47691a00157418ec71fb1126d2333c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=17c353a3bb47691a00157418…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 16:51:11 2022 +0100 kernelbase: Reimplement ConvertDefaultLocale() using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index a17942f4e9c..db9466fdd58 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -3318,44 +3318,7 @@ INT WINAPI DECLSPEC_HOTPATCH CompareStringOrdinal( const WCHAR *str1, INT len1, */ LCID WINAPI DECLSPEC_HOTPATCH ConvertDefaultLocale( LCID lcid ) { - switch (lcid) - { - case LOCALE_INVARIANT: - return lcid; /* keep as-is */ - case LOCALE_SYSTEM_DEFAULT: - return GetSystemDefaultLCID(); - case LOCALE_USER_DEFAULT: - case LOCALE_NEUTRAL: - return GetUserDefaultLCID(); - case MAKELANGID( LANG_CHINESE, SUBLANG_NEUTRAL ): - case MAKELANGID( LANG_CHINESE, 0x1e ): - return MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED ); - case MAKELANGID( LANG_CHINESE, 0x1f ): - return MAKELANGID( LANG_CHINESE, SUBLANG_CHINESE_HONGKONG ); - case LANG_SERBIAN_NEUTRAL: - return MAKELANGID( LANG_SERBIAN, SUBLANG_SERBIAN_SERBIA_LATIN ); - case MAKELANGID( LANG_SPANISH, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_SPANISH, SUBLANG_SPANISH_MODERN ); - case MAKELANGID( LANG_IRISH, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_IRISH, SUBLANG_IRISH_IRELAND ); - case MAKELANGID( LANG_BENGALI, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_BENGALI, SUBLANG_BENGALI_BANGLADESH ); - case MAKELANGID( LANG_SINDHI, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_SINDHI, SUBLANG_SINDHI_AFGHANISTAN ); - case MAKELANGID( LANG_INUKTITUT, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_INUKTITUT, SUBLANG_INUKTITUT_CANADA_LATIN ); - case MAKELANGID( LANG_TAMAZIGHT, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_TAMAZIGHT, SUBLANG_TAMAZIGHT_ALGERIA_LATIN ); - case MAKELANGID( LANG_FULAH, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_FULAH, SUBLANG_FULAH_SENEGAL ); - case MAKELANGID( LANG_TIGRINYA, SUBLANG_NEUTRAL ): - return MAKELANGID( LANG_TIGRINYA, SUBLANG_TIGRINYA_ERITREA ); - default: - /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */ - if (SUBLANGID(lcid) == SUBLANG_NEUTRAL && SORTIDFROMLCID(lcid) == SORT_DEFAULT) - lcid = MAKELANGID( PRIMARYLANGID(lcid), SUBLANG_DEFAULT ); - break; - } + get_locale_by_id( &lcid, 0 ); return lcid; }
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement IsValidLocale() using the locale.nls data.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 0263494bec987dea94f8c1a3b9ea43a2364dda2e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0263494bec987dea94f8c1a3…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 16:49:43 2022 +0100 kernelbase: Reimplement IsValidLocale() using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 70 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 318fe24d10a..a17942f4e9c 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -580,6 +580,8 @@ static const NLS_LOCALE_LCID_INDEX *lcids_index; static const NLS_LOCALE_LCNAME_INDEX *lcnames_index; static const NLS_LOCALE_HEADER *locale_table; static const WCHAR *locale_strings; +static const NLS_LOCALE_DATA *system_locale; +static const NLS_LOCALE_DATA *user_locale; static CPTABLEINFO codepages[128]; static unsigned int nb_codepages; @@ -729,6 +731,13 @@ done: } +static const NLS_LOCALE_DATA *get_locale_data( UINT idx ) +{ + ULONG offset = locale_table->locales_offset + idx * locale_table->locale_size; + return (const NLS_LOCALE_DATA *)((const char *)locale_table + offset); +} + + static int compare_locale_names( const WCHAR *n1, const WCHAR *n2 ) { for (;;) @@ -761,6 +770,61 @@ static const NLS_LOCALE_LCNAME_INDEX *find_lcname_entry( const WCHAR *name ) } +static const NLS_LOCALE_LCID_INDEX *find_lcid_entry( LCID lcid ) +{ + int min = 0, max = locale_table->nb_lcids - 1; + + while (min <= max) + { + int pos = (min + max) / 2; + if (lcid < lcids_index[pos].id) max = pos - 1; + else if (lcid > lcids_index[pos].id) min = pos + 1; + else return &lcids_index[pos]; + } + return NULL; +} + + +static const NLS_LOCALE_DATA *get_locale_by_name( const WCHAR *name, LCID *lcid ) +{ + const NLS_LOCALE_LCNAME_INDEX *entry; + + if (name == LOCALE_NAME_USER_DEFAULT) + { + *lcid = user_lcid; + return user_locale; + } + if (!(entry = find_lcname_entry( name ))) return NULL; + *lcid = entry->id; + return get_locale_data( entry->idx ); +} + + +static const NLS_LOCALE_DATA *get_locale_by_id( LCID *lcid, DWORD flags ) +{ + const NLS_LOCALE_LCID_INDEX *entry; + const NLS_LOCALE_DATA *locale; + + switch (*lcid) + { + case LOCALE_SYSTEM_DEFAULT: + *lcid = system_lcid; + return system_locale; + case LOCALE_NEUTRAL: + case LOCALE_USER_DEFAULT: + case LOCALE_CUSTOM_DEFAULT: + *lcid = user_lcid; + return user_locale; + default: + if (!(entry = find_lcid_entry( *lcid ))) return NULL; + locale = get_locale_data( entry->idx ); + if (!(flags & LOCALE_ALLOW_NEUTRAL_NAMES) && !locale->inotneutral) + locale = get_locale_by_name( locale_strings + locale->ssortlocale + 1, lcid ); + return locale; + } +} + + /*********************************************************************** * init_locale */ @@ -779,6 +843,8 @@ void init_locale(void) load_locale_nls(); NtQueryDefaultLocale( FALSE, &system_lcid ); NtQueryDefaultLocale( FALSE, &user_lcid ); + system_locale = get_locale_by_id( &system_lcid, 0 ); + user_locale = get_locale_by_id( &user_lcid, 0 ); if (GetEnvironmentVariableW( L"WINEUNIXCP", bufferW, ARRAY_SIZE(bufferW) )) unix_cp = wcstoul( bufferW, NULL, 10 ); @@ -5211,9 +5277,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLanguageGroup( LGRPID id, DWORD flags ) */ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLocale( LCID lcid, DWORD flags ) { - /* check if language is registered in the kernel32 resources */ - return FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, - ULongToPtr( (LOCALE_ILANGUAGE >> 4) + 1 ), LANGIDFROMLCID(lcid)) != 0; + return !!get_locale_by_id( &lcid, LOCALE_ALLOW_NEUTRAL_NAMES ); }
1
0
0
0
Alexandre Julliard : kernelbase: Reimplement IsValidLocaleName() using the locale.nls data.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: da125003e6cf5522c1f97246c96c3a754b5b4f66 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=da125003e6cf5522c1f97246…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 16:45:24 2022 +0100 kernelbase: Reimplement IsValidLocaleName() using the locale.nls data. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index cb5441f755e..318fe24d10a 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -729,6 +729,38 @@ done: } +static int compare_locale_names( const WCHAR *n1, const WCHAR *n2 ) +{ + for (;;) + { + WCHAR ch1 = *n1++; + WCHAR ch2 = *n2++; + if (ch1 >= 'a' && ch1 <= 'z') ch1 -= 'a' - 'A'; + else if (ch1 == '_') ch1 = '-'; + if (ch2 >= 'a' && ch2 <= 'z') ch2 -= 'a' - 'A'; + else if (ch2 == '_') ch2 = '-'; + if (!ch1 || ch1 != ch2) return ch1 - ch2; + } +} + + +static const NLS_LOCALE_LCNAME_INDEX *find_lcname_entry( const WCHAR *name ) +{ + int min = 0, max = locale_table->nb_lcnames - 1; + + while (min <= max) + { + int res, pos = (min + max) / 2; + const WCHAR *str = locale_strings + lcnames_index[pos].name; + res = compare_locale_names( name, str + 1 ); + if (res < 0) max = pos - 1; + else if (res > 0) min = pos + 1; + else return &lcnames_index[pos]; + } + return NULL; +} + + /*********************************************************************** * init_locale */ @@ -5190,9 +5222,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLocale( LCID lcid, DWORD flags ) */ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLocaleName( const WCHAR *locale ) { - LCID lcid; - - return !RtlLocaleNameToLcid( locale, &lcid, 2 ); + if (locale == LOCALE_NAME_USER_DEFAULT) return FALSE; + return !!find_lcname_entry( locale ); }
1
0
0
0
Alexandre Julliard : kernelbase: Load the locale.nls file at startup.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: fffbe3fcaef9c2b0e3814305b212a95188c1b0c2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fffbe3fcaef9c2b0e3814305…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 24 10:33:41 2022 +0100 kernelbase: Load the locale.nls file at startup. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernelbase/locale.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 9ef8fbe8f44..cb5441f755e 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -571,9 +571,15 @@ 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; static HKEY nls_key; static HKEY tz_key; +static const NLS_LOCALE_LCID_INDEX *lcids_index; +static const NLS_LOCALE_LCNAME_INDEX *lcnames_index; +static const NLS_LOCALE_HEADER *locale_table; +static const WCHAR *locale_strings; static CPTABLEINFO codepages[128]; static unsigned int nb_codepages; @@ -620,6 +626,30 @@ static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION locale_section = { &critsect_debug, -1, 0, 0, 0, 0 }; +static void load_locale_nls(void) +{ + struct + { + UINT ctypes; + UINT unknown1; + UINT unknown2; + UINT unknown3; + UINT locales; + UINT charmaps; + UINT geoids; + UINT scripts; + } *header; + LCID lcid; + LARGE_INTEGER dummy; + + RtlGetLocaleFileMappingAddress( (void **)&header, &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); + locale_strings = (const WCHAR *)((char *)locale_table + locale_table->strings_offset); +} + + static void init_sortkeys( DWORD *ptr ) { WORD *ctype; @@ -707,7 +737,6 @@ void init_locale(void) UINT ansi_cp = 0, oem_cp = 0; USHORT *ansi_ptr, *oem_ptr; void *sort_ptr; - LCID user_lcid; WCHAR bufferW[LOCALE_NAME_MAX_LENGTH]; DYNAMIC_TIME_ZONE_INFORMATION timezone; GEOID geoid = GEOID_NOT_AVAILABLE; @@ -715,6 +744,10 @@ void init_locale(void) SIZE_T size; HKEY hkey; + load_locale_nls(); + NtQueryDefaultLocale( FALSE, &system_lcid ); + NtQueryDefaultLocale( FALSE, &user_lcid ); + if (GetEnvironmentVariableW( L"WINEUNIXCP", bufferW, ARRAY_SIZE(bufferW) )) unix_cp = wcstoul( bufferW, NULL, 10 ); @@ -775,7 +808,6 @@ void init_locale(void) /* Update registry contents if the user locale has changed. * This simulates the action of the Windows control panel. */ - user_lcid = GetUserDefaultLCID(); count = sizeof(bufferW); if (!RegQueryValueExW( intl_key, L"Locale", NULL, NULL, (BYTE *)bufferW, &count )) { @@ -4671,9 +4703,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetStringTypeExW( LCID locale, DWORD type, const W */ LCID WINAPI DECLSPEC_HOTPATCH GetSystemDefaultLCID(void) { - LCID lcid; - NtQueryDefaultLocale( FALSE, &lcid ); - return lcid; + return system_lcid; } @@ -4820,9 +4850,7 @@ done: */ LCID WINAPI DECLSPEC_HOTPATCH GetUserDefaultLCID(void) { - LCID lcid; - NtQueryDefaultLocale( TRUE, &lcid ); - return lcid; + return user_lcid; }
1
0
0
0
Eric Pouech : ntdll/tests: Finalize migration to long types.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 55b45d00efeb8330c6cf87ab9feb74050df50de3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=55b45d00efeb8330c6cf87ab…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 24 09:57:52 2022 +0100 ntdll/tests: Finalize migration to long types. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/Makefile.in | 1 - dlls/ntdll/tests/atom.c | 1 - dlls/ntdll/tests/change.c | 1 - dlls/ntdll/tests/directory.c | 1 - dlls/ntdll/tests/env.c | 1 - dlls/ntdll/tests/error.c | 1 - dlls/ntdll/tests/exception.c | 1 - dlls/ntdll/tests/file.c | 1 - dlls/ntdll/tests/info.c | 1 - dlls/ntdll/tests/large_int.c | 1 - dlls/ntdll/tests/om.c | 1 - dlls/ntdll/tests/path.c | 1 - dlls/ntdll/tests/pipe.c | 1 - dlls/ntdll/tests/port.c | 1 - dlls/ntdll/tests/reg.c | 1 - dlls/ntdll/tests/rtl.c | 1 - dlls/ntdll/tests/rtlbitmap.c | 1 - dlls/ntdll/tests/rtlstr.c | 1 - dlls/ntdll/tests/string.c | 1 - dlls/ntdll/tests/sync.c | 1 - dlls/ntdll/tests/thread.c | 1 - dlls/ntdll/tests/threadpool.c | 1 - dlls/ntdll/tests/time.c | 1 - dlls/ntdll/tests/virtual.c | 1 - dlls/ntdll/tests/wow64.c | 1 - 25 files changed, 25 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=55b45d00efeb8330c6cf…
1
0
0
0
Eric Pouech : ntdll/tests: Enable compilation with long types in wow64.c.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 6df7b22406585c2220625c7e2b613cd9c0e39674 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6df7b22406585c2220625c7e…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 24 08:35:36 2022 +0100 ntdll/tests: Enable compilation with long types in wow64.c. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/wow64.c | 327 ++++++++++++++++++++++++----------------------- 1 file changed, 164 insertions(+), 163 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=6df7b22406585c222062…
1
0
0
0
Eric Pouech : ntdll/tests: Enable compilation with long types in virtual.c.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: c4507729cabe490028e807cd8e61f58543db439c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c4507729cabe490028e807cd…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 24 08:35:32 2022 +0100 ntdll/tests: Enable compilation with long types in virtual.c. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/virtual.c | 313 +++++++++++++++++++++++---------------------- 1 file changed, 157 insertions(+), 156 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=c4507729cabe490028e8…
1
0
0
0
Eric Pouech : ntdll/tests: Enable compilation with long types in time.c.
by Alexandre Julliard
24 Mar '22
24 Mar '22
Module: wine Branch: master Commit: 19bc52602f4137d42c750ce8d2c4ed263b2382f9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=19bc52602f4137d42c750ce8…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 24 08:35:27 2022 +0100 ntdll/tests: Enable compilation with long types in time.c. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/time.c | 89 +++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 44 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=19bc52602f4137d42c75…
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
114
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
104
105
106
107
108
109
110
111
112
113
114
Results per page:
10
25
50
100
200