- Apply patch from GedMurphy
authorDmitry Chapyshev <dmitry@reactos.org>
Mon, 7 Jan 2008 21:08:02 +0000 (21:08 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Mon, 7 Jan 2008 21:08:02 +0000 (21:08 +0000)
svn path=/trunk/; revision=31654

reactos/dll/win32/syssetup/wizard.c

index 357cd0e..58bd218 100644 (file)
@@ -817,27 +817,19 @@ WriteUserLocale(VOID)
   HKEY hKey;
   LCID lcid;
   TCHAR Locale[12];
-  DWORD dwDisp;
-  LONG ret = ERROR_SUCCESS;
 
   lcid = GetSystemDefaultLCID();
 
-  if (GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, (WORD*)Locale, sizeof(Locale)) != 0)
+  if (GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_ILANGUAGE, Locale, sizeof(Locale) / sizeof(Locale[0])) != 0)
   {
-    if (RegOpenKey(HKEY_CURRENT_USER, L"Control Panel\\International", &hKey) != ERROR_SUCCESS)
+    if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\International"),
+                       0, NULL, REG_OPTION_NON_VOLATILE,
+                       KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
     {
-      ret = RegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Control Panel\\International", 
-                           0, NULL, REG_OPTION_NON_VOLATILE,
-                           KEY_WRITE, NULL, &hKey, &dwDisp);
-    }
-
-    if (ret == ERROR_SUCCESS)
-    {
-       RegSetValueEx(hKey, L"Locale", 0, REG_SZ, (LPBYTE)Locale, (DWORD)(lstrlen(Locale)+1));
+       RegSetValueEx(hKey, _T("Locale"), 0, REG_SZ, (LPBYTE)Locale, (_tcslen(Locale)+1) * sizeof(TCHAR));
+       RegCloseKey(hKey);
     }
   }
-
-  RegCloseKey(hKey);
 }
 
 static INT_PTR CALLBACK