From ee2780fe5fcaa1cb9dbb34d7ecb0d2de1a4b46d0 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 20 Sep 2015 19:34:51 +0000 Subject: [PATCH] [INTL] Implement a save routine for the GeoID. Stores the current GeoID in the default user profile too, if required. CORE-10172 #resolve svn path=/trunk/; revision=69309 --- reactos/dll/cpl/intl/generalp.c | 72 ++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/reactos/dll/cpl/intl/generalp.c b/reactos/dll/cpl/intl/generalp.c index 1d17c56aaf9..dcd9babe36b 100644 --- a/reactos/dll/cpl/intl/generalp.c +++ b/reactos/dll/cpl/intl/generalp.c @@ -475,6 +475,76 @@ CreateLocationsList(HWND hWnd) return userGeoID; } +VOID +SaveGeoID( + PGLOBALDATA pGlobalData) +{ + HKEY hGeoKey; + WCHAR value[15]; + DWORD valuesize; + DWORD ret; + + wsprintf(value, L"%lu", (DWORD)pGlobalData->geoid); + valuesize = (wcslen(value) + 1) * sizeof(WCHAR); + + if (pGlobalData->bApplyToDefaultUser) + { + ret = RegOpenKeyExW(HKEY_USERS, + L".DEFAULT\\Control Panel\\International\\Geo", + 0, + KEY_WRITE, + &hGeoKey); + if (ret != ERROR_SUCCESS) + { + PrintErrorMsgBox(IDS_ERROR_DEF_INT_KEY_REG); + return; + } + + ret = RegSetValueExW(hGeoKey, + L"Nation", + 0, + REG_SZ, + (PBYTE)value, + valuesize); + + RegFlushKey(hGeoKey); + RegCloseKey(hGeoKey); + + if (ret != ERROR_SUCCESS) + { + PrintErrorMsgBox(IDS_ERROR_INT_KEY_REG); + return; + } + } + + ret = RegOpenKeyExW(HKEY_CURRENT_USER, + L"Control Panel\\International\\Geo", + 0, + KEY_WRITE, + &hGeoKey); + if (ret != ERROR_SUCCESS) + { + PrintErrorMsgBox(IDS_ERROR_INT_KEY_REG); + return; + } + + ret = RegSetValueExW(hGeoKey, + L"Nation", + 0, + REG_SZ, + (PBYTE)value, + valuesize); + + RegFlushKey(hGeoKey); + RegCloseKey(hGeoKey); + + if (ret != ERROR_SUCCESS) + { + PrintErrorMsgBox(IDS_ERROR_INT_KEY_REG); + return; + } +} + DWORD VerifyUnattendLCID(HWND hwndDlg) { @@ -630,7 +700,7 @@ GeneralPageProc(HWND hwndDlg, /* Set new GEO ID */ if (pGlobalData->fGeoIdChanged == TRUE) { - SetUserGeoID(pGlobalData->geoid); + SaveGeoID(pGlobalData); pGlobalData->fGeoIdChanged = FALSE; }