[ros-diffs] [ion] 19960: - Temporary fix for making locale switches possible. Patch by zebasoftis. Fixes bug 481.

ion at svn.reactos.com ion at svn.reactos.com
Thu Dec 8 01:52:17 CET 2005


- Temporary fix for making locale switches possible. Patch by
zebasoftis. Fixes bug 481.
Modified: trunk/reactos/lib/cpl/intl/locale.c
  _____  

Modified: trunk/reactos/lib/cpl/intl/locale.c
--- trunk/reactos/lib/cpl/intl/locale.c	2005-12-08 00:38:57 UTC (rev
19959)
+++ trunk/reactos/lib/cpl/intl/locale.c	2005-12-08 00:52:03 UTC (rev
19960)
@@ -96,7 +96,23 @@

 	DWORD ret;
 	TCHAR value[9];
 	DWORD valuesize;
+	WCHAR ACPPage[9];
+	WCHAR OEMPage[9];
 
+	ret = GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT),
LOCALE_IDEFAULTCODEPAGE, (WORD*)OEMPage, sizeof(OEMPage));
+	if (ret == 0)
+	{
+		MessageBoxW(NULL, L"Problem reading OEM code page",
L"Big Problem", MB_OK);
+		return;
+	}
+
+	GetLocaleInfoW(MAKELCID(lcid, SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE, (WORD*)ACPPage, sizeof(ACPPage));
+	if (ret == 0)
+	{
+		MessageBoxW(NULL, L"Problem reading ANSI code page",
L"Big Problem", MB_OK);
+		return;
+	}
+
 	ret = RegOpenKeyW(HKEY_CURRENT_USER, L"Control
Panel\\International", &localeKey);
 
 	if (ret != ERROR_SUCCESS)
@@ -112,6 +128,21 @@
 	RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value,
valuesize);
 	RegCloseKey(localeKey);
 
+	ret = RegOpenKeyW(HKEY_USERS, L".DEFAULT\\Control
Panel\\International", &localeKey);
+
+	if (ret != ERROR_SUCCESS)
+	{
+		// some serious error
+		MessageBoxW(NULL, L"Problem opening
HKU\\.DEFAULT\\Control Panel\\International key", L"Big Problem",
MB_OK);
+		return;
+	}
+
+	wsprintf(value, L"%04X", (DWORD)lcid);
+	valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
+
+	RegSetValueExW(localeKey, L"Locale", 0, REG_SZ, (BYTE *)value,
valuesize);
+	RegCloseKey(localeKey);
+
 	// Set language
 	ret = RegOpenKeyW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
 
@@ -123,7 +154,24 @@
 
 	RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value,
valuesize );
 	RegSetValueExW(langKey, L"InstallLanguage", 0, REG_SZ, (BYTE
*)value, valuesize );
+
 	RegCloseKey(langKey);
+
+
+	// Set language
+	ret = RegOpenKeyW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
+
+	if (ret != ERROR_SUCCESS)
+	{
+		MessageBoxW(NULL, L"Problem opening
HKLM\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage key", L"Big
Problem", MB_OK);
+		return;
+	}
+
+	RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage,
(wcslen(OEMPage) +1 ) * sizeof(WCHAR) );
+	RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage,
(wcslen(ACPPage) +1 ) * sizeof(WCHAR) );
+
+	RegCloseKey(langKey);
+
 }
 
 /* Property page dialog callback */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051208/6f892829/attachment.html


More information about the Ros-diffs mailing list