kernel32: create the intl sLanguage entries using LOCALE_SABBREVLANGNAME

Jeff Zaroyko jeffzaroyko at gmail.com
Tue Aug 25 04:24:45 CDT 2009


Fixes bug 15181.
-------------- next part --------------
From 6977d96691602f12d9182759122561cbcb8c3b62 Mon Sep 17 00:00:00 2001
From: Jeff Zaroyko <jeffz at jeffz.name>
Date: Tue, 25 Aug 2009 19:17:47 +1000
Subject: kernel32: create the intl sLanguage entries using LOCALE_SABBREVLANGNAME

The value of sLanguage as a profile or registry entry is not the
corresponding value for LOCALE_SLANGUAGE, but the corresponding
value for LOCALE_SABBREVLANGNAME.
---
 dlls/kernel32/locale.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index fa17689..bd3be1d 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -62,6 +62,7 @@ static const union cptable *mac_cptable;
 static const union cptable *unix_cptable;  /* NULL if UTF8 */
 
 static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName);
+static const WCHAR *get_locale_value_name( DWORD lctype );
 
 static const WCHAR szNlsKeyName[] = {
     'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
@@ -663,6 +664,7 @@ void LOCALE_InitRegistry(void)
     static const WCHAR lc_measurementW[] = { 'L','C','_','M','E','A','S','U','R','E','M','E','N','T',0 };
     static const WCHAR lc_telephoneW[] = { 'L','C','_','T','E','L','E','P','H','O','N','E',0 };
     static const WCHAR lc_paperW[] = { 'L','C','_','P','A','P','E','R',0};
+    static const WCHAR intlW[] = {'i','n','t','l',0 };
     static const struct
     {
         LPCWSTR name;
@@ -673,7 +675,6 @@ void LOCALE_InitRegistry(void)
         { maccpW, LOCALE_IDEFAULTMACCODEPAGE }
     };
     static const LCTYPE lc_messages_values[] = {
-      LOCALE_SLANGUAGE,
       LOCALE_SCOUNTRY,
       LOCALE_SLIST };
     static const LCTYPE lc_monetary_values[] = {
@@ -753,6 +754,14 @@ void LOCALE_InitRegistry(void)
         NtClose( nls_key );
     }
 
+    /* As a Profile entry and under Control Panel\International sLanguage is not LOCALE_SLANGUAGE
+       but instead appears to be LOCALE_SABBREVLANGNAME, yet GetLocaleInfo for LOCALE_SLANGUAGE
+       should indeed return the LOCALE_SLANGUAGE string. */
+    count = GetLocaleInfoW( lcid, LOCALE_SABBREVLANGNAME, bufferW, sizeof bufferW / sizeof(WCHAR) );
+    RtlInitUnicodeString( &nameW, get_locale_value_name( LOCALE_SLANGUAGE ));
+    NtSetValueKey( hkey, &nameW, 0, REG_SZ, bufferW, count * sizeof(WCHAR) );
+    GetLocaleInfoW( lcid, LOCALE_SABBREVLANGNAME, bufferW, sizeof bufferW / sizeof(WCHAR) );
+    WriteProfileStringW( intlW, get_locale_value_name( LOCALE_SLANGUAGE ), bufferW );
     NtClose( hkey );
 }
 
-- 
1.5.4.3


More information about the wine-patches mailing list