Author: akhaldi
Date: Sat Dec 19 10:55:49 2015
New Revision: 70401
URL: 
http://svn.reactos.org/svn/reactos?rev=70401&view=rev
Log:
[0.4.0] * Merge the default user locale fixes by Eric Kohl in revisions 70389, 70398 and
70400. CORE-5989
Modified:
    branches/ros-branch-0_4_0/   (props changed)
    branches/ros-branch-0_4_0/reactos/   (props changed)
    branches/ros-branch-0_4_0/reactos/base/setup/usetup/settings.c
    branches/ros-branch-0_4_0/reactos/boot/bootdata/hivedef.inf
    branches/ros-branch-0_4_0/reactos/dll/win32/syssetup/install.c
Propchange: branches/ros-branch-0_4_0/
------------------------------------------------------------------------------
--- svn:mergeinfo       (original)
+++ svn:mergeinfo       Sat Dec 19 10:55:49 2015
@@ -1 +1 @@
-/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70388
+/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400
Propchange: branches/ros-branch-0_4_0/reactos/
------------------------------------------------------------------------------
--- svn:mergeinfo       (original)
+++ svn:mergeinfo       Sat Dec 19 10:55:49 2015
@@ -20,4 +20,4 @@
/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567
 /branches/wlan-bringup:54809-54998
-/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70388
+/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400
Modified: branches/ros-branch-0_4_0/reactos/base/setup/usetup/settings.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/base/s…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/base/setup/usetup/settings.c      [iso-8859-1]
(original)
+++ branches/ros-branch-0_4_0/reactos/base/setup/usetup/settings.c      [iso-8859-1] Sat
Dec 19 10:55:49 2015
@@ -811,6 +811,43 @@
     if (LanguageId == NULL)
         return FALSE;
+    DPRINT("LanguageId: %S\n", LanguageId);
+
+    /* Open the default users locale key */
+    RtlInitUnicodeString(&KeyName,
+                         L"\\Registry\\User\\.DEFAULT\\Control
Panel\\International");
+
+    InitializeObjectAttributes(&ObjectAttributes,
+                               &KeyName,
+                               OBJ_CASE_INSENSITIVE,
+                               NULL,
+                               NULL);
+
+    Status =  NtOpenKey(&KeyHandle,
+                        KEY_SET_VALUE,
+                        &ObjectAttributes);
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
+        return FALSE;
+    }
+
+    /* Set default user locale */
+    RtlInitUnicodeString(&ValueName,
+                         L"Locale");
+    Status = NtSetValueKey(KeyHandle,
+                           &ValueName,
+                           0,
+                           REG_SZ,
+                           (PVOID)LanguageId,
+                           (wcslen(LanguageId) + 1) * sizeof(WCHAR));
+    NtClose(KeyHandle);
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
+        return FALSE;
+    }
+
     /* Skip first 4 zeroes */
     if (wcslen(LanguageId) >= 4)
         LanguageId += 4;
Modified: branches/ros-branch-0_4_0/reactos/boot/bootdata/hivedef.inf
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/boot/b…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/boot/bootdata/hivedef.inf [iso-8859-1] (original)
+++ branches/ros-branch-0_4_0/reactos/boot/bootdata/hivedef.inf [iso-8859-1] Sat Dec 19
10:55:49 2015
@@ -152,44 +152,7 @@
 ; International keys
 HKCU,"Control Panel\International",,0x00000012
-HKCU,"Control
Panel\International","Locale",0x00000000,"0409"
-HKCU,"Control Panel\International","iCalenderType",2,"1"
-HKCU,"Control Panel\International","iCountry",2,"1"
-HKCU,"Control Panel\International","iCurrDigits",2,"2"
-HKCU,"Control Panel\International","iCurrency",2,"0"
-HKCU,"Control Panel\International","iDate",2,"0"
-HKCU,"Control Panel\International","iDigits",2,"2"
-HKCU,"Control Panel\International","iFirstDayOfWeek",2,"6"
-HKCU,"Control Panel\International","iFirstDayOfYear",2,"0"
-HKCU,"Control Panel\International","iLZero",2,"1"
-HKCU,"Control Panel\International","iMeasure",2,"1"
-HKCU,"Control Panel\International","iNegCurr",2,"0"
-HKCU,"Control Panel\International","iNegNumber",2,"1"
-HKCU,"Control Panel\International","iTime",2,"0"
-HKCU,"Control Panel\International","iTimePrefix",2,"0"
-HKCU,"Control Panel\International","iTLZero",2,"0"
-HKCU,"Control Panel\International","NumShape",2,"1"
-HKCU,"Control Panel\International","s1159",2,"AM"
-HKCU,"Control Panel\International","s2359",2,"PM"
-HKCU,"Control Panel\International","sCountry",2,"United
States"
-HKCU,"Control Panel\International","sCurrency",2,"$"
-HKCU,"Control Panel\International","sDate",2,"/"
-HKCU,"Control Panel\International","sDecimal",2,"."
-HKCU,"Control Panel\International","sGrouping",2,"3;0"
-HKCU,"Control Panel\International","sLanguage",2,"ENU"
-HKCU,"Control Panel\International","sList",2,","
-HKCU,"Control Panel\International","sLongDate",2,"dddd, MMMM dd,
yyyy"
-HKCU,"Control Panel\International","sMonDecimalSep",2,"."
-HKCU,"Control Panel\International","sMonGrouping",2,"3;0"
-HKCU,"Control Panel\International","sMonThousandSep",2,","
-HKCU,"Control
Panel\International","sNativeDigits",2,"0123456789"
-HKCU,"Control Panel\International","sNegativeSign",2,"-"
-HKCU,"Control Panel\International","sPositiveSign",2,""
-HKCU,"Control
Panel\International","sShortDate",2,"M/d/yyyy"
-HKCU,"Control Panel\International","sThousand",2,","
-HKCU,"Control Panel\International","sTime",2,":"
-HKCU,"Control Panel\International","sTimeFormat",2,"h:mm:ss
tt"
-HKCU,"Control
Panel\International\Geo","Nation",0x00000000,"1"
+HKCU,"Control Panel\International\Geo",,0x00000012
 ; Cursors Schemes
 HKCU,"Control Panel\Cursors",,,"ReactOS Default"
Modified: branches/ros-branch-0_4_0/reactos/dll/win32/syssetup/install.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/dll/wi…
==============================================================================
--- branches/ros-branch-0_4_0/reactos/dll/win32/syssetup/install.c      [iso-8859-1]
(original)
+++ branches/ros-branch-0_4_0/reactos/dll/win32/syssetup/install.c      [iso-8859-1] Sat
Dec 19 10:55:49 2015
@@ -30,6 +30,7 @@
 #include <tchar.h>
 #include <wincon.h>
+#include <winnls.h>
 #include <winsvc.h>
 #include <userenv.h>
 #include <shlobj.h>
@@ -974,7 +975,117 @@
     return 0;
 }
-DWORD WINAPI
+
+static
+VOID
+InitializeDefaultUserLocale(VOID)
+{
+    WCHAR szBuffer[80];
+    PWSTR ptr;
+    HKEY hLocaleKey;
+    DWORD ret;
+    DWORD dwSize;
+    LCID lcid;
+    INT i;
+
+    struct {LCTYPE LCType; PWSTR pValue;} LocaleData[] = {
+        /* Number */
+        {LOCALE_SDECIMAL, L"sDecimal"},
+        {LOCALE_STHOUSAND, L"sThousand"},
+        {LOCALE_SNEGATIVESIGN, L"sNegativeSign"},
+        {LOCALE_SPOSITIVESIGN, L"sPositiveSign"},
+        {LOCALE_SGROUPING, L"sGrouping"},
+        {LOCALE_SLIST, L"sList"},
+        {LOCALE_SNATIVEDIGITS, L"sNativeDigits"},
+        {LOCALE_INEGNUMBER, L"iNegNumber"},
+        {LOCALE_IDIGITS, L"iDigits"},
+        {LOCALE_ILZERO, L"iLZero"},
+        {LOCALE_IMEASURE, L"iMeasure"},
+        {LOCALE_IDIGITSUBSTITUTION, L"NumShape"},
+
+        /* Currency */
+        {LOCALE_SCURRENCY, L"sCurrency"},
+        {LOCALE_SMONDECIMALSEP, L"sMonDecimalSep"},
+        {LOCALE_SMONTHOUSANDSEP, L"sMonThousandSep"},
+        {LOCALE_SMONGROUPING, L"sMonGrouping"},
+        {LOCALE_ICURRENCY, L"iCurrency"},
+        {LOCALE_INEGCURR, L"iNegCurr"},
+        {LOCALE_ICURRDIGITS, L"iCurrDigits"},
+
+        /* Time */
+        {LOCALE_STIMEFORMAT, L"sTimeFormat"},
+        {LOCALE_STIME, L"sTime"},
+        {LOCALE_S1159, L"s1159"},
+        {LOCALE_S2359, L"s2359"},
+        {LOCALE_ITIME, L"iTime"},
+        {LOCALE_ITIMEMARKPOSN, L"iTimePrefix"},
+        {LOCALE_ITLZERO, L"iTLZero"},
+
+        /* Date */
+        {LOCALE_SLONGDATE, L"sLongDate"},
+        {LOCALE_SSHORTDATE, L"sShortDate"},
+        {LOCALE_SDATE, L"sDate"},
+        {LOCALE_IFIRSTDAYOFWEEK, L"iFirstDayOfWeek"},
+        {LOCALE_IFIRSTWEEKOFYEAR, L"iFirstWeekOfYear"},
+        {LOCALE_IDATE, L"iDate"},
+        {LOCALE_ICALENDARTYPE, L"iCalendarType"},
+
+        /* Misc */
+        {LOCALE_SCOUNTRY, L"sCountry"},
+        {LOCALE_SLANGUAGE, L"sLanguage"},
+        {LOCALE_ICOUNTRY, L"iCountry"},
+        {0, NULL}};
+
+    ret = RegOpenKeyExW(HKEY_USERS,
+                        L".DEFAULT\\Control Panel\\International",
+                        0,
+                        KEY_READ | KEY_WRITE,
+                        &hLocaleKey);
+    if (ret != ERROR_SUCCESS)
+    {
+        return;
+    }
+
+    dwSize = 9 * sizeof(WCHAR);
+    ret = RegQueryValueExW(hLocaleKey,
+                           L"Locale",
+                           NULL,
+                           NULL,
+                           (PBYTE)szBuffer,
+                           &dwSize);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    lcid = (LCID)wcstoul(szBuffer, &ptr, 16);
+    if (lcid == 0)
+        goto done;
+
+    i = 0;
+    while (LocaleData[i].pValue != NULL)
+    {
+        if (GetLocaleInfo(lcid,
+                          LocaleData[i].LCType | LOCALE_NOUSEROVERRIDE,
+                          szBuffer,
+                          sizeof(szBuffer) / sizeof(WCHAR)))
+        {
+            RegSetValueExW(hLocaleKey,
+                           LocaleData[i].pValue,
+                           0,
+                           REG_SZ,
+                           (PBYTE)szBuffer,
+                           (wcslen(szBuffer) + 1) * sizeof(WCHAR));
+        }
+
+        i++;
+    }
+
+done:
+    RegCloseKey(hLocaleKey);
+}
+
+
+DWORD
+WINAPI
 InstallReactOS(HINSTANCE hInstance)
 {
     TCHAR szBuffer[MAX_PATH];
@@ -996,6 +1107,8 @@
     CreateTempDir(L"TEMP");
     CreateTempDir(L"TMP");
+
+    InitializeDefaultUserLocale();
     if (GetWindowsDirectory(szBuffer, sizeof(szBuffer) / sizeof(TCHAR)))
     {