ReactOS  0.4.15-dev-1184-g23e04ae
generalp.c File Reference
#include "intl.h"
#include <debug.h>
Include dependency graph for generalp.c:

Go to the source code of this file.

Macros

#define SAMPLE_NUMBER   L"123456789"
 
#define NUM_SHEETS   4
 
#define MAX_FIELD_DIG_SAMPLES   3
 

Functions

static BOOL CALLBACK GeneralPropertyPageLocalesEnumProc (LPTSTR lpLocale)
 
static VOID UpdateLocaleSample (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID CreateLanguagesList (HWND hwnd)
 
BOOL LoadCurrentLocale (PGLOBALDATA pGlobalData)
 
VOID SetNewLocale (PGLOBALDATA pGlobalData, LCID lcid)
 
static VOID SaveUserLocale (PGLOBALDATA pGlobalData, HKEY hLocaleKey)
 
VOID SaveCurrentLocale (PGLOBALDATA pGlobalData)
 
BOOL CALLBACK LocationsEnumProc (GEOID gId)
 
static GEOID CreateLocationsList (HWND hWnd)
 
VOID SaveGeoID (PGLOBALDATA pGlobalData)
 
DWORD VerifyUnattendLCID (HWND hwndDlg)
 
static VOID InitPropSheetPage (PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc, PGLOBALDATA pGlobalData)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
INT_PTR APIENTRY CustomizeLocalePropertySheet (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
INT_PTR CALLBACK GeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

HWND hList
 
HWND hLocaleList
 
HWND hGeoList
 
BOOL isSpain = FALSE
 
GROUPINGDATA GroupingFormats [MAX_GROUPINGFORMATS]
 

Macro Definition Documentation

◆ MAX_FIELD_DIG_SAMPLES

#define MAX_FIELD_DIG_SAMPLES   3

Definition at line 36 of file generalp.c.

◆ NUM_SHEETS

#define NUM_SHEETS   4

Definition at line 34 of file generalp.c.

◆ SAMPLE_NUMBER

#define SAMPLE_NUMBER   L"123456789"

Definition at line 32 of file generalp.c.

Function Documentation

◆ CreateLanguagesList()

static VOID CreateLanguagesList ( HWND  hwnd)
static

Definition at line 167 of file generalp.c.

168 {
169  WCHAR langSel[255];
170 
171  hList = hwnd;
172  isSpain = FALSE;
174 
175  /* Select current locale */
176  /* or should it be System and not user? */
178 
181  -1,
182  (LPARAM)langSel);
183 }
TCHAR langSel[255]
Definition: powercfg.c:24
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
BOOL isSpain
Definition: generalp.c:41
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:768
static BOOL CALLBACK GeneralPropertyPageLocalesEnumProc(LPTSTR lpLocale)
Definition: generalp.c:52
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define FALSE
Definition: types.h:117
HWND hList
Definition: generalp.c:39
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1604
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CB_SELECTSTRING
Definition: winuser.h:1942
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LCID_SUPPORTED
Definition: winnls.h:199

Referenced by GeneralPageProc().

◆ CreateLocationsList()

static GEOID CreateLocationsList ( HWND  hWnd)
static

Definition at line 1184 of file generalp.c.

1185 {
1186  GEOID userGeoID;
1187  WCHAR loc[MAX_STR_SIZE];
1188 
1189  hGeoList = hWnd;
1190 
1192 
1193  /* Select current location */
1194  userGeoID = GetUserGeoID(GEOCLASS_NATION);
1195  GetGeoInfoW(userGeoID,
1197  loc,
1198  MAX_STR_SIZE,
1200 
1203  (WPARAM) -1,
1204  (LPARAM)loc);
1205 
1206  return userGeoID;
1207 }
HWND hWnd
Definition: settings.c:17
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
Definition: lang.c:3283
LONG_PTR LPARAM
Definition: windef.h:208
HWND hGeoList
Definition: generalp.c:40
#define MAX_STR_SIZE
Definition: hdwwiz.h:21
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3549
#define CB_SELECTSTRING
Definition: winuser.h:1942
#define LANG_SYSTEM_DEFAULT
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD GEOID
Definition: winnls.h:518
BOOL CALLBACK LocationsEnumProc(GEOID gId)
Definition: generalp.c:1160
GEOID WINAPI GetUserGeoID(GEOCLASS GeoClass)
Definition: lang.c:3344

Referenced by GeneralPageProc().

◆ CustomizeLocalePropertySheet()

INT_PTR APIENTRY CustomizeLocalePropertySheet ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)

Definition at line 1346 of file generalp.c.

1349 {
1350  PROPSHEETPAGEW PsPage[NUM_SHEETS + 1];
1351  PROPSHEETHEADERW psh;
1352  WCHAR Caption[MAX_STR_SIZE];
1353 
1354  LoadStringW(hApplet, IDS_CUSTOMIZE_TITLE, Caption, sizeof(Caption) / sizeof(TCHAR));
1355 
1356  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
1357  psh.dwSize = sizeof(PROPSHEETHEADER);
1359  psh.hwndParent = hwndDlg;
1360  psh.hInstance = hApplet;
1362  psh.pszCaption = Caption;
1363  psh.nPages = (sizeof(PsPage) / sizeof(PROPSHEETPAGE)) - 1;
1364  psh.nStartPage = 0;
1365  psh.ppsp = PsPage;
1366  psh.pfnCallback = PropSheetProc;
1367 
1368  InitPropSheetPage(&PsPage[0], IDD_NUMBERSPAGE, NumbersPageProc, pGlobalData);
1369  InitPropSheetPage(&PsPage[1], IDD_CURRENCYPAGE, CurrencyPageProc, pGlobalData);
1370  InitPropSheetPage(&PsPage[2], IDD_TIMEPAGE, TimePageProc, pGlobalData);
1371  InitPropSheetPage(&PsPage[3], IDD_DATEPAGE, DatePageProc, pGlobalData);
1372 
1373  if (IsSortPageNeeded(pGlobalData->UserLCID))
1374  {
1375  psh.nPages++;
1376  InitPropSheetPage(&PsPage[4], IDD_SORTPAGE, SortPageProc, pGlobalData);
1377  }
1378 
1379  return PropertySheetW(&psh);
1380 }
HWND hwndParent
Definition: prsht.h:295
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDD_DATEPAGE
Definition: resource.h:11
LPCPROPSHEETPAGEW ppsp
Definition: prsht.h:308
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: generalp.c:1328
#define IDD_NUMBERSPAGE
Definition: resource.h:10
#define NUM_SHEETS
Definition: generalp.c:34
#define ZeroMemory
Definition: winbase.h:1648
HINSTANCE hApplet
Definition: access.c:17
#define IDD_CURRENCYPAGE
Definition: resource.h:14
static VOID InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc, PGLOBALDATA pGlobalData)
Definition: generalp.c:1312
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDC_CPLICON
Definition: resource.h:7
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IDS_CUSTOMIZE_TITLE
Definition: resource.h:75
#define PSH_USEICONID
Definition: prsht.h:42
LPCWSTR pszCaption
Definition: prsht.h:301
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
#define PROPSHEETHEADER
Definition: prsht.h:392
INT_PTR CALLBACK CurrencyPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: currency.c:351
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
#define MAX_STR_SIZE
Definition: hdwwiz.h:21
INT_PTR CALLBACK TimePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: time.c:220
INT_PTR CALLBACK SortPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: sort.c:147
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDD_TIMEPAGE
Definition: resource.h:16
HINSTANCE hInstance
Definition: prsht.h:296
LPCWSTR pszIcon
Definition: prsht.h:299
DWORD dwSize
Definition: prsht.h:293
INT_PTR CALLBACK NumbersPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: numbers.c:581
DWORD dwFlags
Definition: prsht.h:294
#define IDD_SORTPAGE
Definition: resource.h:15
INT_PTR CALLBACK DatePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: date.c:544
#define PSH_PROPSHEETPAGE
Definition: prsht.h:43
#define PROPSHEETPAGE
Definition: prsht.h:389
BOOL IsSortPageNeeded(LCID lcid)
Definition: sort.c:32
LCID UserLCID
Definition: intl.h:113
UINT nStartPage
Definition: prsht.h:304

Referenced by GeneralPageProc().

◆ GeneralPageProc()

INT_PTR CALLBACK GeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1385 of file generalp.c.

1389 {
1390  PGLOBALDATA pGlobalData;
1391 
1392  pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
1393 
1394  switch (uMsg)
1395  {
1396  case WM_INITDIALOG:
1397  pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
1398  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
1399 
1400  if (pGlobalData)
1401  {
1402  LoadCurrentLocale(pGlobalData);
1403 
1405  UpdateLocaleSample(hwndDlg, pGlobalData);
1406  pGlobalData->geoid = CreateLocationsList(GetDlgItem(hwndDlg, IDC_LOCATION_COMBO));
1408  {
1409  if (VerifyUnattendLCID(hwndDlg))
1410  {
1411  SetNewLocale(pGlobalData, UnattendLCID);
1412  SaveCurrentLocale(pGlobalData);
1413  PostQuitMessage(0);
1414  }
1415  else
1416  {
1417  DPRINT1("VerifyUnattendLCID failed\n");
1418  }
1419  return TRUE;
1420  }
1421  }
1422  break;
1423 
1424  case WM_COMMAND:
1425  switch (LOWORD(wParam))
1426  {
1427  case IDC_LANGUAGELIST:
1428  if (HIWORD(wParam) == CBN_SELCHANGE)
1429  {
1430  LCID NewLcid;
1431  INT iCurSel;
1432 
1433  iCurSel = SendMessage(hList,
1434  CB_GETCURSEL,
1435  0,
1436  0);
1437  if (iCurSel == CB_ERR)
1438  break;
1439 
1440  NewLcid = SendMessage(hList,
1442  iCurSel,
1443  0);
1444  if (NewLcid == (LCID)CB_ERR)
1445  break;
1446 
1447  SetNewLocale(pGlobalData, NewLcid);
1448  UpdateLocaleSample(hwndDlg, pGlobalData);
1449  pGlobalData->bUserLocaleChanged = TRUE;
1450 
1451  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1452  }
1453  break;
1454 
1455  case IDC_LOCATION_COMBO:
1456  if (HIWORD(wParam) == CBN_SELCHANGE)
1457  {
1458  GEOID NewGeoID;
1459  INT iCurSel;
1460 
1461  iCurSel = SendMessage(GetDlgItem(hwndDlg, IDC_LOCATION_COMBO),
1462  CB_GETCURSEL,
1463  0,
1464  0);
1465  if (iCurSel == CB_ERR)
1466  break;
1467 
1468  NewGeoID = SendMessage(GetDlgItem(hwndDlg, IDC_LOCATION_COMBO),
1470  iCurSel,
1471  0);
1472  if (NewGeoID == (GEOID)CB_ERR)
1473  break;
1474 
1475  pGlobalData->geoid = NewGeoID;
1476  pGlobalData->bGeoIdChanged = TRUE;
1477 
1478  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1479  }
1480  break;
1481 
1482  case IDC_SETUP_BUTTON:
1483  if (CustomizeLocalePropertySheet(GetParent(hwndDlg), pGlobalData) > 0)
1484  {
1485  UpdateLocaleSample(hwndDlg, pGlobalData);
1486  pGlobalData->bUserLocaleChanged = TRUE;
1487  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1488  }
1489  break;
1490  }
1491  break;
1492 
1493  case WM_NOTIFY:
1494  if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
1495  {
1496  /* Apply changes */
1497  PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
1498 
1499  /* Set new locale */
1500  if (pGlobalData->bUserLocaleChanged == TRUE)
1501  {
1502  SaveCurrentLocale(pGlobalData);
1503  pGlobalData->bUserLocaleChanged = FALSE;
1504  }
1505 
1506  /* Set new GEO ID */
1507  if (pGlobalData->bGeoIdChanged == TRUE)
1508  {
1509  SaveGeoID(pGlobalData);
1510  pGlobalData->bGeoIdChanged = FALSE;
1511  }
1512 
1513  AddNewKbLayoutsByLcid(pGlobalData->UserLCID);
1514 
1515  /* Post WM_WININICHANGE messages to system */
1517  }
1518  break;
1519  }
1520 
1521  return FALSE;
1522 }
BOOL LoadCurrentLocale(PGLOBALDATA pGlobalData)
Definition: generalp.c:187
DWORD IsUnattendedSetupEnabled
Definition: intl.c:41
struct _GLOBALDATA * PGLOBALDATA
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1932
DWORD UnattendLCID
Definition: intl.c:42
BOOL bUserLocaleChanged
Definition: intl.h:115
#define IDC_LANGUAGELIST
Definition: resource.h:15
DWORD LCID
Definition: nls.h:13
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1925
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
HWND hList
Definition: generalp.c:39
static VOID CreateLanguagesList(HWND hwnd)
Definition: generalp.c:167
VOID SaveCurrentLocale(PGLOBALDATA pGlobalData)
Definition: generalp.c:1110
VOID AddNewKbLayoutsByLcid(LCID Lcid)
Definition: kblayouts.c:189
#define LPPROPSHEETPAGE
Definition: prsht.h:390
static VOID UpdateLocaleSample(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: generalp.c:103
#define WM_WININICHANGE
Definition: winuser.h:1612
#define IDC_SETUP_BUTTON
Definition: resource.h:24
VOID SetNewLocale(PGLOBALDATA pGlobalData, LCID lcid)
Definition: generalp.c:572
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
BOOL bGeoIdChanged
Definition: intl.h:119
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
INT_PTR APIENTRY CustomizeLocalePropertySheet(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: generalp.c:1346
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
DWORD VerifyUnattendLCID(HWND hwndDlg)
Definition: generalp.c:1280
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
HWND WINAPI GetParent(_In_ HWND)
GEOID geoid
Definition: intl.h:118
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define CBN_SELCHANGE
Definition: winuser.h:1961
DWORD GEOID
Definition: winnls.h:518
#define DPRINT1
Definition: precomp.h:8
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SendMessage
Definition: winuser.h:5818
#define HIWORD(l)
Definition: typedefs.h:247
#define IDC_LOCATION_COMBO
Definition: resource.h:51
VOID SaveGeoID(PGLOBALDATA pGlobalData)
Definition: generalp.c:1210
#define GetWindowLongPtr
Definition: treelist.c:73
#define HWND_BROADCAST
Definition: winuser.h:1190
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
static GEOID CreateLocationsList(HWND hWnd)
Definition: generalp.c:1184
#define WM_NOTIFY
Definition: richedit.h:61
LCID UserLCID
Definition: intl.h:113

◆ GeneralPropertyPageLocalesEnumProc()

static BOOL CALLBACK GeneralPropertyPageLocalesEnumProc ( LPTSTR  lpLocale)
static

Definition at line 52 of file generalp.c.

53 {
54  LCID lcid;
55  WCHAR lang[255];
56  INT index;
57  BOOL bNoShow = FALSE;
58 
59  lcid = wcstoul(lpLocale, NULL, 16);
60 
61  /* Display only languages with installed support */
62  if (!IsValidLocale(lcid, LCID_INSTALLED))
63  return TRUE;
64 
67  {
68  if (isSpain == FALSE)
69  {
71  isSpain = TRUE;
72  }
73  else
74  {
75  bNoShow = TRUE;
76  }
77  }
78  else
79  {
80  GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
81  }
82 
83  if (bNoShow == FALSE)
84  {
87  0,
88  (LPARAM)lang);
89 
92  index,
93  (LPARAM)lcid);
94  }
95 
96  return TRUE;
97 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define MAKELCID(lgid, srtid)
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
#define TRUE
Definition: types.h:120
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
BOOL isSpain
Definition: generalp.c:41
HINSTANCE hApplet
Definition: access.c:17
DWORD LCID
Definition: nls.h:13
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define LCID_INSTALLED
Definition: winnls.h:198
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define IDS_SPAIN
Definition: resource.h:32
#define FALSE
Definition: types.h:117
HWND hList
Definition: generalp.c:39
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
static const WCHAR lang[]
Definition: wbemdisp.c:287
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1548
#define index(s, c)
Definition: various.h:29
#define SUBLANG_SPANISH
Definition: nls.h:336
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123

Referenced by CreateLanguagesList().

◆ InitPropSheetPage()

static VOID InitPropSheetPage ( PROPSHEETPAGEW psp,
WORD  idDlg,
DLGPROC  DlgProc,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 1312 of file generalp.c.

1317 {
1318  ZeroMemory(psp, sizeof(PROPSHEETPAGEW));
1319  psp->dwSize = sizeof(PROPSHEETPAGEW);
1320  psp->dwFlags = PSP_DEFAULT;
1321  psp->hInstance = hApplet;
1323  psp->pfnDlgProc = DlgProc;
1324  psp->lParam = (LPARAM)pGlobalData;
1325 }
WORD idDlg
Definition: desk.c:110
#define MAKEINTRESOURCE
Definition: winuser.h:591
LPCWSTR pszTemplate
Definition: prsht.h:218
#define ZeroMemory
Definition: winbase.h:1648
HINSTANCE hApplet
Definition: access.c:17
DWORD dwSize
Definition: prsht.h:214
DLGPROC pfnDlgProc
Definition: prsht.h:226
struct _PROPSHEETPAGEW PROPSHEETPAGEW
LONG_PTR LPARAM
Definition: windef.h:208
#define PSP_DEFAULT
Definition: prsht.h:22
LPARAM lParam
Definition: prsht.h:227
HINSTANCE hInstance
Definition: prsht.h:216
DLGPROC DlgProc
Definition: desk.c:111
DWORD dwFlags
Definition: prsht.h:215

Referenced by CustomizeLocalePropertySheet().

◆ LoadCurrentLocale()

BOOL LoadCurrentLocale ( PGLOBALDATA  pGlobalData)

Definition at line 187 of file generalp.c.

189 {
190  WCHAR szBuffer[16];
191  PWSTR ptr;
192  HKEY hLocaleKey;
193  DWORD ret;
194  DWORD dwSize;
195 
197  L"Control Panel\\International",
198  0,
199  KEY_READ,
200  &hLocaleKey);
201  if (ret != ERROR_SUCCESS)
202  {
204  return FALSE;
205  }
206 
207  dwSize = 9 * sizeof(WCHAR);
208  RegQueryValueExW(hLocaleKey,
209  L"Locale",
210  NULL,
211  NULL,
212  (PBYTE)szBuffer,
213  &dwSize);
214  pGlobalData->UserLCID = (LCID)wcstoul(szBuffer, &ptr, 16);
215 
216  /* Number */
217  dwSize = MAX_NUMDECIMALSEP * sizeof(WCHAR);
218  RegQueryValueExW(hLocaleKey,
219  L"sDecimal",
220  NULL,
221  NULL,
222  (PBYTE)pGlobalData->szNumDecimalSep,
223  &dwSize);
224 
225  dwSize = MAX_NUMTHOUSANDSEP * sizeof(WCHAR);
226  RegQueryValueExW(hLocaleKey,
227  L"sThousand",
228  NULL,
229  NULL,
230  (PBYTE)pGlobalData->szNumThousandSep,
231  &dwSize);
232 
233  dwSize = MAX_NUMNEGATIVESIGN * sizeof(WCHAR);
234  RegQueryValueExW(hLocaleKey,
235  L"sNegativeSign",
236  NULL,
237  NULL,
238  (PBYTE)pGlobalData->szNumNegativeSign,
239  &dwSize);
240 
241  dwSize = MAX_NUMPOSITIVESIGN * sizeof(WCHAR);
242  RegQueryValueExW(hLocaleKey,
243  L"sPositiveSign",
244  NULL,
245  NULL,
246  (PBYTE)pGlobalData->szNumPositiveSign,
247  &dwSize);
248 
249  dwSize = MAX_NUMLISTSEP * sizeof(WCHAR);
250  RegQueryValueExW(hLocaleKey,
251  L"sList",
252  NULL,
253  NULL,
254  (PBYTE)pGlobalData->szNumListSep,
255  &dwSize);
256 
257  dwSize = MAX_NUMNATIVEDIGITS * sizeof(WCHAR);
258  RegQueryValueExW(hLocaleKey,
259  L"sNativeDigits",
260  NULL,
261  NULL,
262  (PBYTE)pGlobalData->szNumNativeDigits,
263  &dwSize);
264 
265  pGlobalData->nNumNegFormat = 0;
266  dwSize = 16 * sizeof(WCHAR);
267  if (RegQueryValueExW(hLocaleKey,
268  L"iNegNumber",
269  NULL,
270  NULL,
271  (PBYTE)szBuffer,
272  &dwSize) == ERROR_SUCCESS)
273  pGlobalData->nNumNegFormat = _wtoi(szBuffer);
274 
275  pGlobalData->nNumDigits = 0;
276  dwSize = 16 * sizeof(WCHAR);
277  if (RegQueryValueExW(hLocaleKey,
278  L"iDigits",
279  NULL,
280  NULL,
281  (PBYTE)szBuffer,
282  &dwSize) == ERROR_SUCCESS)
283  pGlobalData->nNumDigits = _wtoi(szBuffer);
284 
285  pGlobalData->nNumLeadingZero = 0;
286  dwSize = 16 * sizeof(WCHAR);
287  if (RegQueryValueExW(hLocaleKey,
288  L"iLZero",
289  NULL,
290  NULL,
291  (PBYTE)szBuffer,
292  &dwSize) == ERROR_SUCCESS)
293  pGlobalData->nNumLeadingZero = _wtoi(szBuffer);
294 
295  pGlobalData->nNumMeasure = 0;
296  dwSize = 16 * sizeof(WCHAR);
297  if (RegQueryValueExW(hLocaleKey,
298  L"iMeasure",
299  NULL,
300  NULL,
301  (PBYTE)szBuffer,
302  &dwSize) == ERROR_SUCCESS)
303  pGlobalData->nNumMeasure = _wtoi(szBuffer);
304 
305  pGlobalData->nNumShape = 0;
306  dwSize = 16 * sizeof(WCHAR);
307  if (RegQueryValueExW(hLocaleKey,
308  L"NumShape",
309  NULL,
310  NULL,
311  (PBYTE)szBuffer,
312  &dwSize) == ERROR_SUCCESS)
313  pGlobalData->nNumShape = _wtoi(szBuffer);
314 
315  pGlobalData->nNumGrouping = 0;
316  dwSize = 16 * sizeof(WCHAR);
317  if (RegQueryValueExW(hLocaleKey,
318  L"sGrouping",
319  NULL,
320  NULL,
321  (PBYTE)szBuffer,
322  &dwSize) == ERROR_SUCCESS)
323  {
324  pGlobalData->nNumGrouping = 0;
325  if (szBuffer[0] == L'3')
326  {
327  if ((szBuffer[1] == L';') &&
328  (szBuffer[2] == L'2'))
329  pGlobalData->nNumGrouping = 2;
330  else
331  pGlobalData->nNumGrouping = 1;
332  }
333  }
334 
335  /* Currency */
336  dwSize = MAX_CURRSYMBOL * sizeof(WCHAR);
337  RegQueryValueExW(hLocaleKey,
338  L"sCurrency",
339  NULL,
340  NULL,
341  (PBYTE)pGlobalData->szCurrSymbol,
342  &dwSize);
343 
344  dwSize = MAX_CURRDECIMALSEP * sizeof(WCHAR);
345  RegQueryValueExW(hLocaleKey,
346  L"sMonDecimalSep",
347  NULL,
348  NULL,
349  (PBYTE)pGlobalData->szCurrDecimalSep,
350  &dwSize);
351 
352  dwSize = MAX_CURRTHOUSANDSEP * sizeof(WCHAR);
353  RegQueryValueExW(hLocaleKey,
354  L"sMonThousandSep",
355  NULL,
356  NULL,
357  (PBYTE)pGlobalData->szCurrThousandSep,
358  &dwSize);
359 
360  pGlobalData->nCurrGrouping = 0;
361  dwSize = 16 * sizeof(WCHAR);
362  if (RegQueryValueExW(hLocaleKey,
363  L"sMonGrouping",
364  NULL,
365  NULL,
366  (PBYTE)szBuffer,
367  &dwSize) == ERROR_SUCCESS)
368  {
369  pGlobalData->nCurrGrouping = 0;
370  if (szBuffer[0] == L'3')
371  {
372  if ((szBuffer[1] == L';') &&
373  (szBuffer[2] == L'2'))
374  pGlobalData->nCurrGrouping = 2;
375  else
376  pGlobalData->nCurrGrouping = 1;
377  }
378  }
379 
380  pGlobalData->nCurrPosFormat = 0;
381  dwSize = 16 * sizeof(WCHAR);
382  if (RegQueryValueExW(hLocaleKey,
383  L"iCurrency",
384  NULL,
385  NULL,
386  (PBYTE)szBuffer,
387  &dwSize) == ERROR_SUCCESS)
388  pGlobalData->nCurrPosFormat = _wtoi(szBuffer);
389 
390  pGlobalData->nCurrNegFormat = 0;
391  dwSize = 16 * sizeof(WCHAR);
392  if (RegQueryValueExW(hLocaleKey,
393  L"iNegCurr",
394  NULL,
395  NULL,
396  (PBYTE)szBuffer,
397  &dwSize) == ERROR_SUCCESS)
398  pGlobalData->nCurrNegFormat = _wtoi(szBuffer);
399 
400  pGlobalData->nCurrDigits = 0;
401  dwSize = 16 * sizeof(WCHAR);
402  if (RegQueryValueExW(hLocaleKey,
403  L"iCurrDigits",
404  NULL,
405  NULL,
406  (PBYTE)szBuffer,
407  &dwSize) == ERROR_SUCCESS)
408  pGlobalData->nCurrDigits = _wtoi(szBuffer);
409 
410  /* Time */
411  dwSize = MAX_TIMEFORMAT * sizeof(WCHAR);
412  RegQueryValueExW(hLocaleKey,
413  L"sTimeFormat",
414  NULL,
415  NULL,
416  (PBYTE)pGlobalData->szTimeFormat,
417  &dwSize);
418 
419  dwSize = MAX_TIMESEPARATOR * sizeof(WCHAR);
420  RegQueryValueExW(hLocaleKey,
421  L"sTime",
422  NULL,
423  NULL,
424  (PBYTE)pGlobalData->szTimeSep,
425  &dwSize);
426 
427  dwSize = MAX_TIMEAMSYMBOL * sizeof(WCHAR);
428  RegQueryValueExW(hLocaleKey,
429  L"s1159",
430  NULL,
431  NULL,
432  (PBYTE)pGlobalData->szTimeAM,
433  &dwSize);
434 
435  dwSize = MAX_TIMEPMSYMBOL * sizeof(WCHAR);
436  RegQueryValueExW(hLocaleKey,
437  L"s2359",
438  NULL,
439  NULL,
440  (PBYTE)pGlobalData->szTimePM,
441  &dwSize);
442 
443  pGlobalData->nTime = 0;
444  dwSize = 16 * sizeof(WCHAR);
445  if (RegQueryValueExW(hLocaleKey,
446  L"iTime",
447  NULL,
448  NULL,
449  (PBYTE)szBuffer,
450  &dwSize) == ERROR_SUCCESS)
451  pGlobalData->nTime = _wtoi(szBuffer);
452 
453  pGlobalData->nTimePrefix = 0;
454  dwSize = 16 * sizeof(WCHAR);
455  if (RegQueryValueExW(hLocaleKey,
456  L"iTimePrefix",
457  NULL,
458  NULL,
459  (PBYTE)szBuffer,
460  &dwSize) == ERROR_SUCCESS)
461  pGlobalData->nTimePrefix = _wtoi(szBuffer);
462 
463  pGlobalData->nTimeLeadingZero = 0;
464  dwSize = 16 * sizeof(WCHAR);
465  if (RegQueryValueExW(hLocaleKey,
466  L"iTLZero",
467  NULL,
468  NULL,
469  (PBYTE)szBuffer,
470  &dwSize) == ERROR_SUCCESS)
471  pGlobalData->nTimeLeadingZero = _wtoi(szBuffer);
472 
473  /* Date */
474  dwSize = MAX_LONGDATEFORMAT * sizeof(WCHAR);
475  RegQueryValueExW(hLocaleKey,
476  L"sLongDate",
477  NULL,
478  NULL,
479  (PBYTE)pGlobalData->szLongDateFormat,
480  &dwSize);
481 
482  dwSize = MAX_SHORTDATEFORMAT * sizeof(WCHAR);
483  RegQueryValueExW(hLocaleKey,
484  L"sShortDate",
485  NULL,
486  NULL,
487  (PBYTE)pGlobalData->szShortDateFormat,
488  &dwSize);
489 
490  dwSize = MAX_DATESEPARATOR * sizeof(WCHAR);
491  RegQueryValueExW(hLocaleKey,
492  L"sDate",
493  NULL,
494  NULL,
495  (PBYTE)pGlobalData->szDateSep,
496  &dwSize);
497 
498  pGlobalData->nFirstDayOfWeek = 0;
499  dwSize = 16 * sizeof(WCHAR);
500  if (RegQueryValueExW(hLocaleKey,
501  L"iFirstDayOfWeek",
502  NULL,
503  NULL,
504  (PBYTE)szBuffer,
505  &dwSize) == ERROR_SUCCESS)
506  pGlobalData->nFirstDayOfWeek = _wtoi(szBuffer);
507 
508  pGlobalData->nFirstWeekOfYear = 0;
509  dwSize = 16 * sizeof(WCHAR);
510  if (RegQueryValueExW(hLocaleKey,
511  L"iFirstWeekOfYear",
512  NULL,
513  NULL,
514  (PBYTE)szBuffer,
515  &dwSize) == ERROR_SUCCESS)
516  pGlobalData->nFirstWeekOfYear = _wtoi(szBuffer);
517 
518  pGlobalData->nDate = 0;
519  dwSize = 16 * sizeof(WCHAR);
520  if (RegQueryValueExW(hLocaleKey,
521  L"iDate",
522  NULL,
523  NULL,
524  (PBYTE)szBuffer,
525  &dwSize) == ERROR_SUCCESS)
526  pGlobalData->nDate = _wtoi(szBuffer);
527 
528  pGlobalData->nCalendarType = 0;
529  dwSize = 16 * sizeof(WCHAR);
530  if (RegQueryValueExW(hLocaleKey,
531  L"iCalendarType",
532  NULL,
533  NULL,
534  (PBYTE)szBuffer,
535  &dwSize) == ERROR_SUCCESS)
536  pGlobalData->nCalendarType = _wtoi(szBuffer);
537 
538  /* Misc */
539  dwSize = MAX_MISCCOUNTRY * sizeof(WCHAR);
540  RegQueryValueExW(hLocaleKey,
541  L"sCountry",
542  NULL,
543  NULL,
544  (PBYTE)pGlobalData->szMiscCountry,
545  &dwSize);
546 
547  dwSize = MAX_MISCLANGUAGE * sizeof(WCHAR);
548  RegQueryValueExW(hLocaleKey,
549  L"sLanguage",
550  NULL,
551  NULL,
552  (PBYTE)pGlobalData->szMiscLanguage,
553  &dwSize);
554 
555  pGlobalData->nMiscCountry = 0;
556  dwSize = 16 * sizeof(WCHAR);
557  if (RegQueryValueExW(hLocaleKey,
558  L"iCountry",
559  NULL,
560  NULL,
561  (PBYTE)szBuffer,
562  &dwSize) == ERROR_SUCCESS)
563  pGlobalData->nMiscCountry = _wtoi(szBuffer);
564 
565  RegCloseKey(hLocaleKey);
566 
567  return TRUE;
568 }
WCHAR szCurrSymbol[MAX_CURRSYMBOL]
Definition: intl.h:81
#define ERROR_SUCCESS
Definition: deptool.c:10
INT nCalendarType
Definition: intl.h:105
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define MAX_NUMNEGATIVESIGN
Definition: intl.h:28
uint16_t * PWSTR
Definition: typedefs.h:56
#define HKEY_CURRENT_USER
Definition: winreg.h:11
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
INT nCurrNegFormat
Definition: intl.h:85
WCHAR szTimeFormat[MAX_TIMEFORMAT]
Definition: intl.h:90
#define IDS_ERROR_INT_KEY_REG
Definition: resource.h:82
#define MAX_NUMDECIMALSEP
Definition: intl.h:26
INT nNumNegFormat
Definition: intl.h:73
DWORD LCID
Definition: nls.h:13
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
WCHAR szTimeAM[MAX_TIMEAMSYMBOL]
Definition: intl.h:92
#define MAX_NUMTHOUSANDSEP
Definition: intl.h:27
#define MAX_SHORTDATEFORMAT
Definition: intl.h:43
INT nFirstDayOfWeek
Definition: intl.h:102
WCHAR szTimeSep[MAX_TIMESEPARATOR]
Definition: intl.h:91
WCHAR szMiscLanguage[MAX_MISCLANGUAGE]
Definition: intl.h:110
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
WCHAR szMiscCountry[MAX_MISCCOUNTRY]
Definition: intl.h:109
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
#define MAX_TIMESEPARATOR
Definition: intl.h:39
INT nNumLeadingZero
Definition: intl.h:75
smooth NULL
Definition: ftsmooth.c:416
INT nTimeLeadingZero
Definition: intl.h:96
WCHAR szDateSep[MAX_DATESEPARATOR]
Definition: intl.h:101
#define MAX_TIMEFORMAT
Definition: intl.h:38
WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN]
Definition: intl.h:65
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]
Definition: intl.h:82
INT nCurrGrouping
Definition: intl.h:87
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT]
Definition: intl.h:99
INT nTimePrefix
Definition: intl.h:95
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
INT nNumGrouping
Definition: intl.h:76
#define MAX_CURRSYMBOL
Definition: intl.h:33
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR szNumListSep[MAX_NUMLISTSEP]
Definition: intl.h:72
#define MAX_DATESEPARATOR
Definition: intl.h:45
unsigned long DWORD
Definition: ntddk_ex.h:95
INT nDate
Definition: intl.h:104
INT nNumShape
Definition: intl.h:78
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
int ret
static const WCHAR L[]
Definition: oid.c:1250
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]
Definition: intl.h:83
#define MAX_MISCLANGUAGE
Definition: intl.h:49
INT nNumMeasure
Definition: intl.h:77
INT nNumDigits
Definition: intl.h:74
#define MAX_TIMEPMSYMBOL
Definition: intl.h:41
INT nCurrPosFormat
Definition: intl.h:84
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT]
Definition: intl.h:100
WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]
Definition: intl.h:66
INT nTime
Definition: intl.h:94
#define MAX_CURRTHOUSANDSEP
Definition: intl.h:35
#define MAX_MISCCOUNTRY
Definition: intl.h:48
#define MAX_CURRDECIMALSEP
Definition: intl.h:34
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define MAX_TIMEAMSYMBOL
Definition: intl.h:40
INT nCurrDigits
Definition: intl.h:86
INT nFirstWeekOfYear
Definition: intl.h:103
#define MAX_NUMLISTSEP
Definition: intl.h:30
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:52
#define MAX_NUMNATIVEDIGITS
Definition: intl.h:31
BYTE * PBYTE
Definition: pedump.c:66
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define MAX_LONGDATEFORMAT
Definition: intl.h:44
WCHAR szTimePM[MAX_TIMEPMSYMBOL]
Definition: intl.h:93
#define MAX_NUMPOSITIVESIGN
Definition: intl.h:29
LCID UserLCID
Definition: intl.h:113
INT nMiscCountry
Definition: intl.h:111

Referenced by GeneralPageProc().

◆ LocationsEnumProc()

BOOL CALLBACK LocationsEnumProc ( GEOID  gId)

Definition at line 1160 of file generalp.c.

1161 {
1162  WCHAR loc[MAX_STR_SIZE];
1163  INT index;
1164 
1166  return TRUE;
1167 
1169  CB_ADDSTRING,
1170  0,
1171  (LPARAM)loc);
1172 
1175  index,
1176  (LPARAM)gId);
1177 
1178  return TRUE;
1179 }
#define CB_SETITEMDATA
Definition: winuser.h:1948
#define TRUE
Definition: types.h:120
#define INT
Definition: polytest.cpp:20
int32_t INT
Definition: typedefs.h:58
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
HWND hGeoList
Definition: generalp.c:40
#define MAX_STR_SIZE
Definition: hdwwiz.h:21
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3549
#define index(s, c)
Definition: various.h:29
#define LANG_SYSTEM_DEFAULT
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CreateLocationsList().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 1328 of file generalp.c.

1329 {
1330  // NOTE: This callback is needed to set large icon correctly.
1331  HICON hIcon;
1332  switch (uMsg)
1333  {
1334  case PSCB_INITIALIZED:
1335  {
1337  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
1338  break;
1339  }
1340  }
1341  return 0;
1342 }
static HICON
Definition: imagelist.c:84
HINSTANCE hApplet
Definition: access.c:17
#define IDC_CPLICON
Definition: resource.h:7
LONG_PTR LPARAM
Definition: windef.h:208
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by CustomizeLocalePropertySheet().

◆ SaveCurrentLocale()

VOID SaveCurrentLocale ( PGLOBALDATA  pGlobalData)

Definition at line 1110 of file generalp.c.

1112 {
1113  HKEY hLocaleKey;
1114  DWORD ret;
1115 
1116  if (pGlobalData->bApplyToDefaultUser)
1117  {
1119  L".DEFAULT\\Control Panel\\International",
1120  0,
1121  KEY_WRITE,
1122  &hLocaleKey);
1123  if (ret != ERROR_SUCCESS)
1124  {
1126  return;
1127  }
1128 
1129  SaveUserLocale(pGlobalData, hLocaleKey);
1130 
1131  /* Flush and close the locale key */
1132  RegFlushKey(hLocaleKey);
1133  RegCloseKey(hLocaleKey);
1134  }
1135 
1137  L"Control Panel\\International",
1138  0,
1139  KEY_WRITE,
1140  &hLocaleKey);
1141  if (ret != ERROR_SUCCESS)
1142  {
1144  return;
1145  }
1146 
1147  SaveUserLocale(pGlobalData, hLocaleKey);
1148 
1149  /* Flush and close the locale key */
1150  RegFlushKey(hLocaleKey);
1151  RegCloseKey(hLocaleKey);
1152 
1153  /* Set the new locale for the current process */
1154  NtSetDefaultLocale(TRUE, pGlobalData->UserLCID);
1155 }
#define HKEY_USERS
Definition: winreg.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define IDS_ERROR_INT_KEY_REG
Definition: resource.h:82
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2974
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define KEY_WRITE
Definition: nt_native.h:1031
#define IDS_ERROR_DEF_INT_KEY_REG
Definition: resource.h:83
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:203
unsigned long DWORD
Definition: ntddk_ex.h:95
static VOID SaveUserLocale(PGLOBALDATA pGlobalData, HKEY hLocaleKey)
Definition: generalp.c:803
int ret
static const WCHAR L[]
Definition: oid.c:1250
BOOL bApplyToDefaultUser
Definition: intl.h:116
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:52
LCID UserLCID
Definition: intl.h:113

Referenced by GeneralPageProc().

◆ SaveGeoID()

VOID SaveGeoID ( PGLOBALDATA  pGlobalData)

Definition at line 1210 of file generalp.c.

1212 {
1213  HKEY hGeoKey;
1214  WCHAR value[15];
1215  DWORD valuesize;
1216  DWORD ret;
1217 
1218  wsprintf(value, L"%lu", (DWORD)pGlobalData->geoid);
1219  valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
1220 
1221  if (pGlobalData->bApplyToDefaultUser)
1222  {
1224  L".DEFAULT\\Control Panel\\International\\Geo",
1225  0,
1226  KEY_WRITE,
1227  &hGeoKey);
1228  if (ret != ERROR_SUCCESS)
1229  {
1231  return;
1232  }
1233 
1234  ret = RegSetValueExW(hGeoKey,
1235  L"Nation",
1236  0,
1237  REG_SZ,
1238  (PBYTE)value,
1239  valuesize);
1240 
1241  RegFlushKey(hGeoKey);
1242  RegCloseKey(hGeoKey);
1243 
1244  if (ret != ERROR_SUCCESS)
1245  {
1247  return;
1248  }
1249  }
1250 
1252  L"Control Panel\\International\\Geo",
1253  0,
1254  KEY_WRITE,
1255  &hGeoKey);
1256  if (ret != ERROR_SUCCESS)
1257  {
1259  return;
1260  }
1261 
1262  ret = RegSetValueExW(hGeoKey,
1263  L"Nation",
1264  0,
1265  REG_SZ,
1266  (PBYTE)value,
1267  valuesize);
1268 
1269  RegFlushKey(hGeoKey);
1270  RegCloseKey(hGeoKey);
1271 
1272  if (ret != ERROR_SUCCESS)
1273  {
1275  return;
1276  }
1277 }
#define HKEY_USERS
Definition: winreg.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define IDS_ERROR_INT_KEY_REG
Definition: resource.h:82
LONG WINAPI RegFlushKey(HKEY hKey)
Definition: reg.c:2974
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define IDS_ERROR_DEF_INT_KEY_REG
Definition: resource.h:83
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const WCHAR L[]
Definition: oid.c:1250
BOOL bApplyToDefaultUser
Definition: intl.h:116
GEOID geoid
Definition: intl.h:118
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define wsprintf
Definition: winuser.h:5840
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:52
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22

Referenced by GeneralPageProc().

◆ SaveUserLocale()

static VOID SaveUserLocale ( PGLOBALDATA  pGlobalData,
HKEY  hLocaleKey 
)
static

Definition at line 803 of file generalp.c.

806 {
807  WCHAR szBuffer[16];
808 
809  wsprintf(szBuffer, L"%08lx", (DWORD)pGlobalData->UserLCID);
810  RegSetValueExW(hLocaleKey,
811  L"Locale",
812  0,
813  REG_SZ,
814  (PBYTE)szBuffer,
815  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
816 
817  /* Number */
818  RegSetValueExW(hLocaleKey,
819  L"sDecimal",
820  0,
821  REG_SZ,
822  (PBYTE)pGlobalData->szNumDecimalSep,
823  (wcslen(pGlobalData->szNumDecimalSep) + 1) * sizeof(WCHAR));
824 
825  RegSetValueExW(hLocaleKey,
826  L"sThousand",
827  0,
828  REG_SZ,
829  (PBYTE)pGlobalData->szNumThousandSep,
830  (wcslen(pGlobalData->szNumThousandSep) + 1) * sizeof(WCHAR));
831 
832  RegSetValueExW(hLocaleKey,
833  L"sNegativeSign",
834  0,
835  REG_SZ,
836  (PBYTE)pGlobalData->szNumNegativeSign,
837  (wcslen(pGlobalData->szNumNegativeSign) + 1) * sizeof(WCHAR));
838 
839  RegSetValueExW(hLocaleKey,
840  L"sPositiveSign",
841  0,
842  REG_SZ,
843  (PBYTE)pGlobalData->szNumPositiveSign,
844  (wcslen(pGlobalData->szNumPositiveSign) + 1) * sizeof(WCHAR));
845 
846  RegSetValueExW(hLocaleKey,
847  L"sGrouping",
848  0,
849  REG_SZ,
851  (wcslen(GroupingFormats[pGlobalData->nNumGrouping].pszString) + 1) * sizeof(WCHAR));
852 
853  RegSetValueExW(hLocaleKey,
854  L"sList",
855  0,
856  REG_SZ,
857  (PBYTE)pGlobalData->szNumListSep,
858  (wcslen(pGlobalData->szNumListSep) + 1) * sizeof(WCHAR));
859 
860  RegSetValueExW(hLocaleKey,
861  L"sNativeDigits",
862  0,
863  REG_SZ,
864  (PBYTE)pGlobalData->szNumNativeDigits,
865  (wcslen(pGlobalData->szNumNativeDigits) + 1) * sizeof(WCHAR));
866 
867  _itow(pGlobalData->nNumNegFormat,
868  szBuffer, DECIMAL_RADIX);
869  RegSetValueExW(hLocaleKey,
870  L"iNegNumber",
871  0,
872  REG_SZ,
873  (PBYTE)szBuffer,
874  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
875 
876  _itow(pGlobalData->nNumDigits,
877  szBuffer, DECIMAL_RADIX);
878  RegSetValueExW(hLocaleKey,
879  L"iDigits",
880  0,
881  REG_SZ,
882  (PBYTE)szBuffer,
883  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
884 
885  _itow(pGlobalData->nNumLeadingZero,
886  szBuffer, DECIMAL_RADIX);
887  RegSetValueExW(hLocaleKey,
888  L"iLZero",
889  0,
890  REG_SZ,
891  (PBYTE)szBuffer,
892  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
893 
894  _itow(pGlobalData->nNumMeasure,
895  szBuffer, DECIMAL_RADIX);
896  RegSetValueExW(hLocaleKey,
897  L"iMeasure",
898  0,
899  REG_SZ,
900  (PBYTE)szBuffer,
901  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
902 
903  _itow(pGlobalData->nNumShape,
904  szBuffer, DECIMAL_RADIX);
905  RegSetValueExW(hLocaleKey,
906  L"NumShape",
907  0,
908  REG_SZ,
909  (PBYTE)szBuffer,
910  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
911 
912  /* Currency */
913  RegSetValueExW(hLocaleKey,
914  L"sCurrency",
915  0,
916  REG_SZ,
917  (PBYTE)pGlobalData->szCurrSymbol,
918  (wcslen(pGlobalData->szCurrSymbol) + 1) * sizeof(WCHAR));
919 
920  RegSetValueExW(hLocaleKey,
921  L"sMonDecimalSep",
922  0,
923  REG_SZ,
924  (PBYTE)pGlobalData->szCurrDecimalSep,
925  (wcslen(pGlobalData->szCurrDecimalSep) + 1) * sizeof(WCHAR));
926 
927  RegSetValueExW(hLocaleKey,
928  L"sMonThousandSep",
929  0,
930  REG_SZ,
931  (PBYTE)pGlobalData->szCurrThousandSep,
932  (wcslen(pGlobalData->szCurrThousandSep) + 1) * sizeof(WCHAR));
933 
934  RegSetValueExW(hLocaleKey,
935  L"sMonGrouping",
936  0,
937  REG_SZ,
939  (wcslen(GroupingFormats[pGlobalData->nCurrGrouping].pszString) + 1) * sizeof(WCHAR));
940 
941  _itow(pGlobalData->nCurrPosFormat,
942  szBuffer, DECIMAL_RADIX);
943  RegSetValueExW(hLocaleKey,
944  L"iCurrency",
945  0,
946  REG_SZ,
947  (PBYTE)szBuffer,
948  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
949 
950  _itow(pGlobalData->nCurrNegFormat,
951  szBuffer, DECIMAL_RADIX);
952  RegSetValueExW(hLocaleKey,
953  L"iNegCurr",
954  0,
955  REG_SZ,
956  (PBYTE)szBuffer,
957  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
958 
959  _itow(pGlobalData->nCurrDigits,
960  szBuffer, DECIMAL_RADIX);
961  RegSetValueExW(hLocaleKey,
962  L"iCurrDigits",
963  0,
964  REG_SZ,
965  (PBYTE)szBuffer,
966  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
967 
968  /* Time */
969  RegSetValueExW(hLocaleKey,
970  L"sTimeFormat",
971  0,
972  REG_SZ,
973  (PBYTE)pGlobalData->szTimeFormat,
974  (wcslen(pGlobalData->szTimeFormat) + 1) * sizeof(WCHAR));
975 
976  RegSetValueExW(hLocaleKey,
977  L"sTime",
978  0,
979  REG_SZ,
980  (PBYTE)pGlobalData->szTimeSep,
981  (wcslen(pGlobalData->szTimeSep) + 1) * sizeof(WCHAR));
982 
983  RegSetValueExW(hLocaleKey,
984  L"s1159",
985  0,
986  REG_SZ,
987  (PBYTE)pGlobalData->szTimeAM,
988  (wcslen(pGlobalData->szTimeAM) + 1) * sizeof(WCHAR));
989 
990  RegSetValueExW(hLocaleKey,
991  L"s2359",
992  0,
993  REG_SZ,
994  (PBYTE)pGlobalData->szTimePM,
995  (wcslen(pGlobalData->szTimePM) + 1) * sizeof(WCHAR));
996 
997  _itow(pGlobalData->nTime,
998  szBuffer, DECIMAL_RADIX);
999  RegSetValueExW(hLocaleKey,
1000  L"iTime",
1001  0,
1002  REG_SZ,
1003  (PBYTE)szBuffer,
1004  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1005 
1006  _itow(pGlobalData->nTimePrefix,
1007  szBuffer, DECIMAL_RADIX);
1008  RegSetValueExW(hLocaleKey,
1009  L"iTimePrefix",
1010  0,
1011  REG_SZ,
1012  (PBYTE)szBuffer,
1013  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1014 
1015  _itow(pGlobalData->nTimeLeadingZero,
1016  szBuffer, DECIMAL_RADIX);
1017  RegSetValueExW(hLocaleKey,
1018  L"iTLZero",
1019  0,
1020  REG_SZ,
1021  (PBYTE)szBuffer,
1022  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1023 
1024  /* Date */
1025  RegSetValueExW(hLocaleKey,
1026  L"sLongDate",
1027  0,
1028  REG_SZ,
1029  (PBYTE)pGlobalData->szLongDateFormat,
1030  (wcslen(pGlobalData->szLongDateFormat) + 1) * sizeof(WCHAR));
1031 
1032  RegSetValueExW(hLocaleKey,
1033  L"sShortDate",
1034  0,
1035  REG_SZ,
1036  (PBYTE)pGlobalData->szShortDateFormat,
1037  (wcslen(pGlobalData->szShortDateFormat) + 1) * sizeof(WCHAR));
1038 
1039  RegSetValueExW(hLocaleKey,
1040  L"sDate",
1041  0,
1042  REG_SZ,
1043  (PBYTE)pGlobalData->szDateSep,
1044  (wcslen(pGlobalData->szDateSep) + 1) * sizeof(WCHAR));
1045 
1046  _itow(pGlobalData->nFirstDayOfWeek,
1047  szBuffer, DECIMAL_RADIX);
1048  RegSetValueExW(hLocaleKey,
1049  L"iFirstDayOfWeek",
1050  0,
1051  REG_SZ,
1052  (PBYTE)szBuffer,
1053  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1054 
1055  _itow(pGlobalData->nFirstWeekOfYear,
1056  szBuffer, DECIMAL_RADIX);
1057  RegSetValueExW(hLocaleKey,
1058  L"iFirstWeekOfYear",
1059  0,
1060  REG_SZ,
1061  (PBYTE)szBuffer,
1062  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1063 
1064  _itow(pGlobalData->nDate,
1065  szBuffer, DECIMAL_RADIX);
1066  RegSetValueExW(hLocaleKey,
1067  L"iDate",
1068  0,
1069  REG_SZ,
1070  (PBYTE)szBuffer,
1071  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1072 
1073  _itow(pGlobalData->nCalendarType,
1074  szBuffer, DECIMAL_RADIX);
1075  RegSetValueExW(hLocaleKey,
1076  L"iCalendarType",
1077  0,
1078  REG_SZ,
1079  (PBYTE)szBuffer,
1080  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1081 
1082  /* Misc */
1083  RegSetValueExW(hLocaleKey,
1084  L"sCountry",
1085  0,
1086  REG_SZ,
1087  (PBYTE)pGlobalData->szMiscCountry,
1088  (wcslen(pGlobalData->szMiscCountry) + 1) * sizeof(WCHAR));
1089 
1090  RegSetValueExW(hLocaleKey,
1091  L"sLanguage",
1092  0,
1093  REG_SZ,
1094  (PBYTE)pGlobalData->szMiscLanguage,
1095  (wcslen(pGlobalData->szMiscLanguage) + 1) * sizeof(WCHAR));
1096 
1097  _itow(pGlobalData->nMiscCountry,
1098  szBuffer, DECIMAL_RADIX);
1099  RegSetValueExW(hLocaleKey,
1100  L"iCountry",
1101  0,
1102  REG_SZ,
1103  (PBYTE)szBuffer,
1104  (wcslen(szBuffer) + 1) * sizeof(WCHAR));
1105 }
WCHAR szCurrSymbol[MAX_CURRSYMBOL]
Definition: intl.h:81
INT nCalendarType
Definition: intl.h:105
INT nCurrNegFormat
Definition: intl.h:85
WCHAR szTimeFormat[MAX_TIMEFORMAT]
Definition: intl.h:90
INT nNumNegFormat
Definition: intl.h:73
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
_CRTIMP wchar_t *__cdecl _itow(_In_ int _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
WCHAR szTimeAM[MAX_TIMEAMSYMBOL]
Definition: intl.h:92
INT nFirstDayOfWeek
Definition: intl.h:102
WCHAR szTimeSep[MAX_TIMESEPARATOR]
Definition: intl.h:91
WCHAR szMiscLanguage[MAX_MISCLANGUAGE]
Definition: intl.h:110
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
WCHAR szMiscCountry[MAX_MISCCOUNTRY]
Definition: intl.h:109
PWSTR pszString
Definition: intl.h:128
INT nNumLeadingZero
Definition: intl.h:75
INT nTimeLeadingZero
Definition: intl.h:96
WCHAR szDateSep[MAX_DATESEPARATOR]
Definition: intl.h:101
WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN]
Definition: intl.h:65
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]
Definition: intl.h:82
INT nCurrGrouping
Definition: intl.h:87
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT]
Definition: intl.h:99
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
INT nTimePrefix
Definition: intl.h:95
INT nNumGrouping
Definition: intl.h:76
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR szNumListSep[MAX_NUMLISTSEP]
Definition: intl.h:72
unsigned long DWORD
Definition: ntddk_ex.h:95
INT nDate
Definition: intl.h:104
INT nNumShape
Definition: intl.h:78
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
GROUPINGDATA GroupingFormats[MAX_GROUPINGFORMATS]
Definition: generalp.c:44
static const WCHAR L[]
Definition: oid.c:1250
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]
Definition: intl.h:83
INT nNumMeasure
Definition: intl.h:77
INT nNumDigits
Definition: intl.h:74
#define DECIMAL_RADIX
Definition: intl.h:19
INT nCurrPosFormat
Definition: intl.h:84
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT]
Definition: intl.h:100
WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]
Definition: intl.h:66
INT nTime
Definition: intl.h:94
INT nCurrDigits
Definition: intl.h:86
INT nFirstWeekOfYear
Definition: intl.h:103
#define wsprintf
Definition: winuser.h:5840
BYTE * PBYTE
Definition: pedump.c:66
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
WCHAR szTimePM[MAX_TIMEPMSYMBOL]
Definition: intl.h:93
LCID UserLCID
Definition: intl.h:113
INT nMiscCountry
Definition: intl.h:111
#define REG_SZ
Definition: layer.c:22

Referenced by SaveCurrentLocale().

◆ SetNewLocale()

VOID SetNewLocale ( PGLOBALDATA  pGlobalData,
LCID  lcid 
)

Definition at line 572 of file generalp.c.

575 {
576  WCHAR szBuffer[16];
577 
578  pGlobalData->UserLCID = lcid;
579 
580  /* Number */
581  GetLocaleInfo(lcid,
583  pGlobalData->szNumDecimalSep,
585 
586  GetLocaleInfo(lcid,
588  pGlobalData->szNumThousandSep,
590 
591  GetLocaleInfo(lcid,
593  pGlobalData->szNumNegativeSign,
595 
596  GetLocaleInfo(lcid,
598  pGlobalData->szNumPositiveSign,
600 
601  GetLocaleInfo(lcid,
603  pGlobalData->szNumListSep,
605 
606  GetLocaleInfo(lcid,
608  pGlobalData->szNumNativeDigits,
610 
611  GetLocaleInfo(lcid,
613  szBuffer,
614  sizeof(szBuffer) / sizeof(WCHAR));
615  pGlobalData->nNumNegFormat = _wtoi(szBuffer);
616 
617  GetLocaleInfo(lcid,
619  szBuffer,
620  sizeof(szBuffer) / sizeof(WCHAR));
621  pGlobalData->nNumDigits = _wtoi(szBuffer);
622 
623  GetLocaleInfo(lcid,
625  szBuffer,
626  sizeof(szBuffer) / sizeof(WCHAR));
627  pGlobalData->nNumLeadingZero = _wtoi(szBuffer);
628 
629  GetLocaleInfo(lcid,
631  szBuffer,
632  sizeof(szBuffer) / sizeof(WCHAR));
633  pGlobalData->nNumMeasure = _wtoi(szBuffer);
634 
635  GetLocaleInfo(lcid,
636  LOCALE_IDIGITSUBSTITUTION | LOCALE_NOUSEROVERRIDE,
637  szBuffer,
638  sizeof(szBuffer) / sizeof(WCHAR));
639  pGlobalData->nNumShape = _wtoi(szBuffer);
640 
641  GetLocaleInfo(lcid,
643  szBuffer,
644  sizeof(szBuffer) / sizeof(WCHAR));
645  pGlobalData->nNumGrouping = 0;
646  if (szBuffer[0] == L'3')
647  {
648  if ((szBuffer[1] == L';') &&
649  (szBuffer[2] == L'2'))
650  pGlobalData->nNumGrouping = 2;
651  else
652  pGlobalData->nNumGrouping = 1;
653  }
654 
655  /* Currency */
656  GetLocaleInfo(lcid,
658  pGlobalData->szCurrSymbol,
660 
661  GetLocaleInfo(lcid,
663  pGlobalData->szCurrDecimalSep,
665 
666  GetLocaleInfo(lcid,
668  pGlobalData->szCurrThousandSep,
670 
671  GetLocaleInfo(lcid,
673  szBuffer,
674  sizeof(szBuffer) / sizeof(WCHAR));
675  pGlobalData->nCurrGrouping = 0;
676  if (szBuffer[0] == L'3')
677  {
678  if ((szBuffer[1] == L';') &&
679  (szBuffer[2] == L'2'))
680  pGlobalData->nCurrGrouping = 2;
681  else
682  pGlobalData->nCurrGrouping = 1;
683  }
684 
685  GetLocaleInfo(lcid,
687  szBuffer,
688  sizeof(szBuffer) / sizeof(WCHAR));
689  pGlobalData->nCurrPosFormat = _wtoi(szBuffer);
690 
691  GetLocaleInfo(lcid,
693  szBuffer,
694  sizeof(szBuffer) / sizeof(WCHAR));
695  pGlobalData->nCurrNegFormat = _wtoi(szBuffer);
696 
697  GetLocaleInfo(lcid,
699  szBuffer,
700  sizeof(szBuffer) / sizeof(WCHAR));
701  pGlobalData->nCurrDigits = _wtoi(szBuffer);
702 
703  /* Time */
704  GetLocaleInfo(lcid,
706  pGlobalData->szTimeFormat,
708 
709  GetLocaleInfo(lcid,
711  pGlobalData->szTimeSep,
713 
714  GetLocaleInfo(lcid,
716  pGlobalData->szTimeAM,
718 
719  GetLocaleInfo(lcid,
721  pGlobalData->szTimePM,
723 
724  GetLocaleInfo(lcid,
726  szBuffer,
727  sizeof(szBuffer) / sizeof(WCHAR));
728  pGlobalData->nTime = _wtoi(szBuffer);
729 
730  GetLocaleInfo(lcid,
732  szBuffer,
733  sizeof(szBuffer) / sizeof(WCHAR));
734  pGlobalData->nTimePrefix = _wtoi(szBuffer);
735 
736  GetLocaleInfo(lcid,
738  szBuffer,
739  sizeof(szBuffer) / sizeof(WCHAR));
740  pGlobalData->nTimeLeadingZero = _wtoi(szBuffer);
741 
742  /* Date */
743  GetLocaleInfo(lcid,
745  pGlobalData->szLongDateFormat,
747 
748  GetLocaleInfo(lcid,
750  pGlobalData->szShortDateFormat,
752 
753  GetLocaleInfo(lcid,
755  pGlobalData->szDateSep,
757 
758  GetLocaleInfo(lcid,
760  szBuffer,
761  sizeof(szBuffer) / sizeof(WCHAR));
762  pGlobalData->nFirstDayOfWeek = _wtoi(szBuffer);
763 
764  GetLocaleInfo(lcid,
766  szBuffer,
767  sizeof(szBuffer) / sizeof(WCHAR));
768  pGlobalData->nFirstWeekOfYear = _wtoi(szBuffer);
769 
770  GetLocaleInfo(lcid,
772  szBuffer,
773  sizeof(szBuffer) / sizeof(WCHAR));
774  pGlobalData->nDate = _wtoi(szBuffer);
775 
776  GetLocaleInfo(lcid,
778  szBuffer,
779  sizeof(szBuffer) / sizeof(WCHAR));
780  pGlobalData->nCalendarType = _wtoi(szBuffer);
781 
782  /* Misc */
783  GetLocaleInfo(lcid,
785  pGlobalData->szMiscCountry,
787 
788  GetLocaleInfo(lcid,
790  pGlobalData->szMiscLanguage,
792 
793  GetLocaleInfo(lcid,
795  szBuffer,
796  sizeof(szBuffer) / sizeof(WCHAR));
797  pGlobalData->nMiscCountry = _wtoi(szBuffer);
798 }
#define LOCALE_SGROUPING
Definition: winnls.h:44
WCHAR szCurrSymbol[MAX_CURRSYMBOL]
Definition: intl.h:81
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
INT nCalendarType
Definition: intl.h:105
#define MAX_NUMNEGATIVESIGN
Definition: intl.h:28
#define LOCALE_IDATE
Definition: winnls.h:63
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
INT nCurrNegFormat
Definition: intl.h:85
#define GetLocaleInfo
Definition: winnls.h:1183
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
WCHAR szTimeFormat[MAX_TIMEFORMAT]
Definition: intl.h:90
#define LOCALE_ILZERO
Definition: winnls.h:46
#define MAX_NUMDECIMALSEP
Definition: intl.h:26
INT nNumNegFormat
Definition: intl.h:73
WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]
Definition: intl.h:71
#define LOCALE_IMEASURE
Definition: winnls.h:41
WCHAR szTimeAM[MAX_TIMEAMSYMBOL]
Definition: intl.h:92
#define MAX_NUMTHOUSANDSEP
Definition: intl.h:27
#define LOCALE_SCURRENCY
Definition: winnls.h:49
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
#define MAX_SHORTDATEFORMAT
Definition: intl.h:43
INT nFirstDayOfWeek
Definition: intl.h:102
WCHAR szTimeSep[MAX_TIMESEPARATOR]
Definition: intl.h:91
WCHAR szMiscLanguage[MAX_MISCLANGUAGE]
Definition: intl.h:110
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
#define LOCALE_STHOUSAND
Definition: winnls.h:43
WCHAR szMiscCountry[MAX_MISCCOUNTRY]
Definition: intl.h:109
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define MAX_TIMESEPARATOR
Definition: intl.h:39
#define LOCALE_INEGCURR
Definition: winnls.h:57
INT nNumLeadingZero
Definition: intl.h:75
#define LOCALE_SDECIMAL
Definition: winnls.h:42
INT nTimeLeadingZero
Definition: intl.h:96
WCHAR szDateSep[MAX_DATESEPARATOR]
Definition: intl.h:101
#define MAX_TIMEFORMAT
Definition: intl.h:38
#define LOCALE_STIME
Definition: winnls.h:59
WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN]
Definition: intl.h:65
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]
Definition: intl.h:82
INT nCurrGrouping
Definition: intl.h:87
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT]
Definition: intl.h:99
#define LOCALE_ICURRENCY
Definition: winnls.h:56
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
INT nTimePrefix
Definition: intl.h:95
INT nNumGrouping
Definition: intl.h:76
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_SDATE
Definition: winnls.h:58
#define MAX_CURRSYMBOL
Definition: intl.h:33
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR szNumListSep[MAX_NUMLISTSEP]
Definition: intl.h:72
#define MAX_DATESEPARATOR
Definition: intl.h:45
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
INT nDate
Definition: intl.h:104
INT nNumShape
Definition: intl.h:78
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_ITLZERO
Definition: winnls.h:68
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
static const WCHAR L[]
Definition: oid.c:1250
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]
Definition: intl.h:83
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define MAX_MISCLANGUAGE
Definition: intl.h:49
INT nNumMeasure
Definition: intl.h:77
INT nNumDigits
Definition: intl.h:74
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define MAX_TIMEPMSYMBOL
Definition: intl.h:41
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
INT nCurrPosFormat
Definition: intl.h:84
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT]
Definition: intl.h:100
WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]
Definition: intl.h:66
#define LOCALE_ITIME
Definition: winnls.h:65
INT nTime
Definition: intl.h:94
#define MAX_CURRTHOUSANDSEP
Definition: intl.h:35
#define MAX_MISCCOUNTRY
Definition: intl.h:48
#define LOCALE_SLIST
Definition: winnls.h:40
#define MAX_CURRDECIMALSEP
Definition: intl.h:34
#define LOCALE_SCOUNTRY
Definition: winnls.h:31
#define MAX_TIMEAMSYMBOL
Definition: intl.h:40
INT nCurrDigits
Definition: intl.h:86
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
INT nFirstWeekOfYear
Definition: intl.h:103
#define MAX_NUMLISTSEP
Definition: intl.h:30
#define MAX_NUMNATIVEDIGITS
Definition: intl.h:31
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
#define MAX_LONGDATEFORMAT
Definition: intl.h:44
WCHAR szTimePM[MAX_TIMEPMSYMBOL]
Definition: intl.h:93
#define MAX_NUMPOSITIVESIGN
Definition: intl.h:29
LCID UserLCID
Definition: intl.h:113
INT nMiscCountry
Definition: intl.h:111

Referenced by GeneralPageProc().

◆ UpdateLocaleSample()

static VOID UpdateLocaleSample ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 103 of file generalp.c.

106 {
108  NUMBERFMT NumberFormat;
109  CURRENCYFMTW CurrencyFormat;
110 
111  NumberFormat.NumDigits = pGlobalData->nNumDigits;
112  NumberFormat.LeadingZero = pGlobalData->nNumLeadingZero;
113  NumberFormat.Grouping = GroupingFormats[pGlobalData->nNumGrouping].nInteger;
114  NumberFormat.lpDecimalSep = pGlobalData->szNumDecimalSep;
115  NumberFormat.lpThousandSep = pGlobalData->szNumThousandSep;
116  NumberFormat.NegativeOrder = pGlobalData->nNumNegFormat;
117 
118  CurrencyFormat.NumDigits = pGlobalData->nCurrDigits;
119  CurrencyFormat.LeadingZero = pGlobalData->nNumLeadingZero;
120  CurrencyFormat.Grouping = GroupingFormats[pGlobalData->nCurrGrouping].nInteger;
121  CurrencyFormat.lpDecimalSep = pGlobalData->szCurrDecimalSep;
122  CurrencyFormat.lpThousandSep = pGlobalData->szCurrThousandSep;
123  CurrencyFormat.NegativeOrder = pGlobalData->nCurrNegFormat;
124  CurrencyFormat.PositiveOrder = pGlobalData->nCurrPosFormat;
125  CurrencyFormat.lpCurrencySymbol = pGlobalData->szCurrSymbol;
126 
127  /* Get number format sample */
128  GetNumberFormatW(pGlobalData->UserLCID, 0, SAMPLE_NUMBER,
129  &NumberFormat,
134 
135  /* Get monetary format sample */
136  GetCurrencyFormatW(pGlobalData->UserLCID, 0, SAMPLE_NUMBER,
137  &CurrencyFormat,
142 
143  /* Get time format sample */
144  GetTimeFormatW(pGlobalData->UserLCID, 0, NULL,
145  pGlobalData->szTimeFormat,
150 
151  /* Get short date format sample */
152  GetDateFormatW(pGlobalData->UserLCID, 0, NULL,
153  pGlobalData->szShortDateFormat,
157 
158  /* Get long date sample */
159  GetDateFormatW(pGlobalData->UserLCID, 0, NULL,
160  pGlobalData->szLongDateFormat,
164 }
WCHAR szCurrSymbol[MAX_CURRSYMBOL]
Definition: intl.h:81
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
Definition: scsi.h:4071
UINT PositiveOrder
Definition: winnls.h:615
#define IDC_TIMESAMPLE_EDIT
Definition: resource.h:21
UINT Grouping
Definition: winnls.h:611
UINT NegativeOrder
Definition: winnls.h:614
UINT LeadingZero
Definition: winnls.h:610
INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const CURRENCYFMTW *lpFormat, LPWSTR lpCurrencyStr, int cchOut)
Definition: lcformat.c:1564
INT nCurrNegFormat
Definition: intl.h:85
#define IDC_NUMSAMPLE_EDIT
Definition: resource.h:19
WCHAR szTimeFormat[MAX_TIMEFORMAT]
Definition: intl.h:90
#define ZeroMemory
Definition: winbase.h:1648
INT nNumNegFormat
Definition: intl.h:73
LPWSTR lpThousandSep
Definition: winnls.h:613
#define IDC_SHORTTIMESAMPLE_EDIT
Definition: resource.h:22
WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]
Definition: intl.h:70
INT nNumLeadingZero
Definition: intl.h:75
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]
Definition: intl.h:82
#define WM_SETTEXT
Definition: winuser.h:1599
#define IDC_FULLTIMESAMPLE_EDIT
Definition: resource.h:23
INT nCurrGrouping
Definition: intl.h:87
#define MAX_SAMPLES_STR_SIZE
Definition: intl.h:24
WCHAR szLongDateFormat[MAX_LONGDATEFORMAT]
Definition: intl.h:99
UINT LeadingZero
Definition: winnls.h:632
INT nNumGrouping
Definition: intl.h:76
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]
Definition: intl.h:69
GROUPINGDATA GroupingFormats[MAX_GROUPINGFORMATS]
Definition: generalp.c:44
LPWSTR lpDecimalSep
Definition: winnls.h:612
WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]
Definition: intl.h:83
INT nNumDigits
Definition: intl.h:74
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
UINT NumDigits
Definition: winnls.h:631
LPWSTR lpCurrencySymbol
Definition: winnls.h:616
INT nCurrPosFormat
Definition: intl.h:84
WCHAR szShortDateFormat[MAX_SHORTDATEFORMAT]
Definition: intl.h:100
LPSTR lpThousandSep
Definition: winnls.h:635
#define IDC_MONEYSAMPLE_EDIT
Definition: resource.h:20
UINT NumDigits
Definition: winnls.h:609
LPSTR lpDecimalSep
Definition: winnls.h:634
INT nCurrDigits
Definition: intl.h:86
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198
UINT nInteger
Definition: intl.h:127
UINT Grouping
Definition: winnls.h:633
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
#define SAMPLE_NUMBER
Definition: generalp.c:32
UINT NegativeOrder
Definition: winnls.h:636
LCID UserLCID
Definition: intl.h:113

Referenced by GeneralPageProc().

◆ VerifyUnattendLCID()

DWORD VerifyUnattendLCID ( HWND  hwndDlg)

Definition at line 1280 of file generalp.c.

1281 {
1282  LRESULT lCount, lIndex, lResult;
1283 
1284  lCount = SendMessage(hList, CB_GETCOUNT, (WPARAM)0, (LPARAM)0);
1285  if (lCount == CB_ERR)
1286  {
1287  return 0;
1288  }
1289 
1290  for (lIndex = 0; lIndex < lCount; lIndex++)
1291  {
1292  lResult = SendMessage(hList, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0);
1293  if (lResult == CB_ERR)
1294  {
1295  continue;
1296  }
1297 
1298  if (lResult == (LRESULT)UnattendLCID)
1299  {
1300  SendMessage(hList, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0);
1301  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1302  return 1;
1303  }
1304  }
1305 
1306  return 0;
1307 }
#define CB_GETITEMDATA
Definition: winuser.h:1932
DWORD UnattendLCID
Definition: intl.c:42
UINT_PTR WPARAM
Definition: windef.h:207
HWND hList
Definition: generalp.c:39
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_ERR
Definition: winuser.h:2410
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define CB_SETCURSEL
Definition: winuser.h:1943
HWND WINAPI GetParent(_In_ HWND)
#define SendMessage
Definition: winuser.h:5818
#define CB_GETCOUNT
Definition: winuser.h:1924
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by GeneralPageProc().

Variable Documentation

◆ GroupingFormats

Initial value:
=
{
{0, L"0;0"},
{3, L"3;0"},
{32, L"3;2;0"}
}
static const WCHAR L[]
Definition: oid.c:1250

Definition at line 44 of file generalp.c.

Referenced by InitDigitGroupCB(), SaveUserLocale(), UpdateExamples(), UpdateLocaleSample(), and UpdateNumSamples().

◆ hGeoList

HWND hGeoList

Definition at line 40 of file generalp.c.

Referenced by CreateLocationsList(), and LocationsEnumProc().

◆ hList

◆ hLocaleList

HWND hLocaleList

Definition at line 40 of file generalp.c.

◆ isSpain

BOOL isSpain = FALSE

Definition at line 41 of file generalp.c.

Referenced by CreateLanguagesList(), and GeneralPropertyPageLocalesEnumProc().