Alexandre Julliard : kernel32: Create the Nls\CodePage key one element at a time.

Alexandre Julliard julliard at winehq.org
Mon Mar 1 09:27:37 CST 2010


Module: wine
Branch: master
Commit: ea3f48ff112175ae2a9e2367098ee2d182a9eb2d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ea3f48ff112175ae2a9e2367098ee2d182a9eb2d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  1 14:06:08 2010 +0100

kernel32: Create the Nls\CodePage key one element at a time.

---

 dlls/kernel32/locale.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 277f55c..7a141b2 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -74,12 +74,6 @@ static const WCHAR szLocaleKeyName[] = {
     'C','o','n','t','r','o','l','\\','N','l','s','\\','L','o','c','a','l','e',0
 };
 
-static const WCHAR szCodepageKeyName[] = {
-    'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
-    'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
-    'C','o','n','t','r','o','l','\\','N','l','s','\\','C','o','d','e','p','a','g','e',0
-};
-
 static const WCHAR szLangGroupsKeyName[] = {
     'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
     'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
@@ -774,11 +768,26 @@ void LOCALE_InitRegistry(void)
 
     if (locale_update_registry( hkey, lc_ctypeW, lcid_LC_CTYPE, NULL, 0 ))
     {
+        static const WCHAR codepageW[] =
+            {'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
+             'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
+             'C','o','n','t','r','o','l','\\','N','l','s','\\','C','o','d','e','p','a','g','e',0};
+
         OBJECT_ATTRIBUTES attr;
         HANDLE nls_key;
+        DWORD len = 14;
 
-        RtlInitUnicodeString( &nameW, szCodepageKeyName );
+        RtlInitUnicodeString( &nameW, codepageW );
         InitializeObjectAttributes( &attr, &nameW, 0, 0, NULL );
+        while (codepageW[len])
+        {
+            nameW.Length = len * sizeof(WCHAR);
+            if (NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) break;
+            NtClose( nls_key );
+            len++;
+            while (codepageW[len] && codepageW[len] != '\\') len++;
+        }
+        nameW.Length = len * sizeof(WCHAR);
         if (!NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
         {
             for (i = 0; i < sizeof(update_cp_values)/sizeof(update_cp_values[0]); i++)




More information about the wine-cvs mailing list