Author: ekohl
Date: Sat Sep 12 20:24:10 2015
New Revision: 69207
URL:
http://svn.reactos.org/svn/reactos?rev=69207&view=rev
Log:
[INTL]
Set the system default language and codepages.
CORE-10075
Modified:
trunk/reactos/dll/cpl/intl/advanced.c
trunk/reactos/dll/cpl/intl/generalp.c
Modified: trunk/reactos/dll/cpl/intl/advanced.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/advanced.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/intl/advanced.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/intl/advanced.c [iso-8859-1] Sat Sep 12 20:24:10 2015
@@ -213,7 +213,7 @@
EnumSystemLocales(LocalesEnumProc, LCID_SUPPORTED);
/* Select current locale */
- GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SLANGUAGE, langSel,
sizeof(langSel)/sizeof(TCHAR));
+ GetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SLANGUAGE, langSel,
sizeof(langSel)/sizeof(TCHAR));
SendMessage(hLangList, CB_SELECTSTRING, -1, (LPARAM)langSel);
}
@@ -281,6 +281,63 @@
SetupCloseInfFile(hFontInf);
}
+
+
+static
+VOID
+SaveSystemSettings(
+ LCID lcid)
+{
+ TCHAR ACPPage[9];
+ TCHAR OEMPage[9];
+ HKEY langKey;
+ DWORD ret;
+ WCHAR value[5];
+ DWORD valuesize;
+
+ ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage,
sizeof(OEMPage)/sizeof(TCHAR));
+ if (ret == 0)
+ {
+ PrintErrorMsgBox(IDS_ERROR_OEM_CODE_PAGE);
+ return;
+ }
+
+ ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE,
ACPPage, sizeof(ACPPage)/sizeof(TCHAR));
+ if (ret == 0)
+ {
+ PrintErrorMsgBox(IDS_ERROR_ANSI_CODE_PAGE);
+ return;
+ }
+
+ /* Set codepages */
+ ret = RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
+ if (ret != ERROR_SUCCESS)
+ {
+ PrintErrorMsgBox(IDS_ERROR_NLS_CODE_REG);
+ return;
+ }
+
+ RegSetValueEx(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage,
(_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
+ RegSetValueEx(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage,
(_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
+
+ RegCloseKey(langKey);
+
+
+ wsprintf(value, _T("%04hX"), LANGIDFROMLCID(lcid));
+ valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
+
+ /* Set language */
+ ret = RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
+ if (ret != ERROR_SUCCESS)
+ {
+ PrintErrorMsgBox(IDS_ERROR_NLS_KEY_REG);
+ return;
+ }
+
+ RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value,
valuesize);
+ RegCloseKey(langKey);
+}
+
/* Property page dialog callback */
INT_PTR CALLBACK
@@ -332,6 +389,7 @@
break;
SetNonUnicodeLang(hwndDlg, lcid);
+ SaveSystemSettings(lcid);
}
}
break;
Modified: trunk/reactos/dll/cpl/intl/generalp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/generalp.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] Sat Sep 12 20:24:10 2015
@@ -353,22 +353,6 @@
DWORD valuesize;
DWORD i;
-#if 0
- ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage,
sizeof(OEMPage)/sizeof(TCHAR));
- if (ret == 0)
- {
- PrintErrorMsgBox(IDS_ERROR_OEM_CODE_PAGE);
- return;
- }
-
- ret = GetLocaleInfo(MAKELCID(lcid, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE,
ACPPage, sizeof(ACPPage)/sizeof(TCHAR));
- if (ret == 0)
- {
- PrintErrorMsgBox(IDS_ERROR_ANSI_CODE_PAGE);
- return;
- }
-#endif
-
ret = RegOpenKeyExW(HKEY_CURRENT_USER, L"Control Panel\\International",
0, KEY_READ | KEY_WRITE, &localeKey);
if (ret != ERROR_SUCCESS)
@@ -405,47 +389,6 @@
/* Set the new locale for the current process */
NtSetDefaultLocale(TRUE, pGlobalData->lcid);
-#if 0
- ret = RegOpenKey(HKEY_USERS, _T(".DEFAULT\\Control Panel\\International"),
&localeKey);
- if (ret != ERROR_SUCCESS)
- {
- PrintErrorMsgBox(IDS_ERROR_DEF_INT_KEY_REG);
- return;
- }
-
- wsprintf(value, _T("%08X"), (DWORD)lcid);
- valuesize = (_tcslen(value) + 1) * sizeof(TCHAR);
-
- RegSetValueEx(localeKey, _T("Locale"), 0, REG_SZ, (BYTE *)value,
valuesize);
- RegCloseKey(localeKey);
-
- // Set language
- ret = RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"), &langKey);
- if (ret != ERROR_SUCCESS)
- {
- PrintErrorMsgBox(IDS_ERROR_NLS_KEY_REG);
- return;
- }
-
- RegSetValueEx(langKey, _T("Default"), 0, REG_SZ, (BYTE *)value, valuesize
);
- RegSetValueEx(langKey, _T("InstallLanguage"), 0, REG_SZ, (BYTE *)value,
valuesize );
-
- RegCloseKey(langKey);
-
-
- /* Set language */
- ret = RegOpenKey(HKEY_LOCAL_MACHINE,
_T("SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"), &langKey);
- if (ret != ERROR_SUCCESS)
- {
- PrintErrorMsgBox(IDS_ERROR_NLS_CODE_REG);
- return;
- }
-
- RegSetValueExW(langKey, _T("OEMCP"), 0, REG_SZ, (BYTE *)OEMPage,
(_tcslen(OEMPage) +1 ) * sizeof(TCHAR));
- RegSetValueExW(langKey, _T("ACP"), 0, REG_SZ, (BYTE *)ACPPage,
(_tcslen(ACPPage) +1 ) * sizeof(TCHAR));
-
- RegCloseKey(langKey);
-#endif
}
/* Location enumerate procedure */
@@ -660,7 +603,6 @@
}
AddNewKbLayoutsByLcid(pGlobalData->lcid);
- SetNonUnicodeLang(hwndDlg, pGlobalData->lcid);
}
}
break;