X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Flib%2Fcpl%2Fintl%2Flocale.c;h=8c4692f621c5c8834233970c34456d833da9070d;hp=d0c4182aca42956fd1a8a9345919a987407050b5;hb=6e977a8fa8b905d37bc46554c67cc51f719df930;hpb=ba70f8d6f5495d329a8930c89752a262a99bd30c diff --git a/reactos/lib/cpl/intl/locale.c b/reactos/lib/cpl/intl/locale.c index d0c4182aca4..8c4692f621c 100644 --- a/reactos/lib/cpl/intl/locale.c +++ b/reactos/lib/cpl/intl/locale.c @@ -96,6 +96,22 @@ void SetNewLocale(LCID lcid) 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); @@ -112,6 +128,21 @@ void SetNewLocale(LCID lcid) 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 @@ void SetNewLocale(LCID lcid) 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 */