ReactOS 0.4.15-dev-8135-g1bc6c90
advanced.c File Reference
#include "intl.h"
#include <wingdi.h>
#include <debug.h>
Include dependency graph for advanced.c:

Go to the source code of this file.

Classes

struct  CPStruct
 

Macros

#define CODEPAGE_INSTALLED   0x00000001
 
#define CODEPAGE_NOT_REMOVEABLE   0x00000002
 
#define CODEPAGE_INSTALL   0x00000004
 
#define CODEPAGE_REMOVE   0x00000008
 

Typedefs

typedef struct CPStruct CPAGE
 
typedef struct CPStructPCPAGE
 

Functions

static BOOL GetSupportedCP (HINF hInf)
 
static BOOL CALLBACK InstalledCPProc (PWSTR lpStr)
 
static VOID InitCodePagesList (HWND hwndDlg)
 
static BOOL CALLBACK LocalesEnumProc (PWSTR lpLocale)
 
static VOID InitLanguagesList (HWND hwndDlg, PGLOBALDATA pGlobalData)
 
static VOID GetCurrentDPI (LPTSTR szDPI)
 
static VOID SaveFontSubstitutionSettings (HWND hwnd, PGLOBALDATA pGlobalData)
 
static VOID SaveFontLinkingSettings (HWND hwnd, PGLOBALDATA pGlobalData)
 
static VOID SaveSystemSettings (PGLOBALDATA pGlobalData)
 
LRESULT ListViewCustomDraw (LPARAM lParam)
 
INT_PTR CALLBACK AdvancedPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

static PCPAGE PCPage = NULL
 
static BOOL bSpain = FALSE
 
static HWND hLangList
 

Macro Definition Documentation

◆ CODEPAGE_INSTALL

#define CODEPAGE_INSTALL   0x00000004

Definition at line 16 of file advanced.c.

◆ CODEPAGE_INSTALLED

#define CODEPAGE_INSTALLED   0x00000001

Definition at line 14 of file advanced.c.

◆ CODEPAGE_NOT_REMOVEABLE

#define CODEPAGE_NOT_REMOVEABLE   0x00000002

Definition at line 15 of file advanced.c.

◆ CODEPAGE_REMOVE

#define CODEPAGE_REMOVE   0x00000008

Definition at line 17 of file advanced.c.

Typedef Documentation

◆ CPAGE

◆ PCPAGE

typedef struct CPStruct * PCPAGE

Function Documentation

◆ AdvancedPageProc()

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

Definition at line 422 of file advanced.c.

426{
427 PGLOBALDATA pGlobalData;
428
429 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
430
431 switch (uMsg)
432 {
433 case WM_INITDIALOG:
434 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
435 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
436
437 InitLanguagesList(hwndDlg, pGlobalData);
438 InitCodePagesList(hwndDlg);
439 break;
440
441 case WM_COMMAND:
442 switch (LOWORD(wParam))
443 {
446 {
447 LCID lcid;
448 INT iIndex;
449
450 iIndex = SendMessage(hLangList, CB_GETCURSEL, 0, 0);
451 if (iIndex == CB_ERR)
452 break;
453
454 lcid = SendMessage(hLangList, CB_GETITEMDATA, iIndex, 0);
455 if (lcid == (LCID)CB_ERR)
456 break;
457
458 pGlobalData->SystemLCID = lcid;
459
460 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
461 }
462 break;
463
465 if (HIWORD(wParam) == BN_CLICKED)
466 {
468 {
469 ResourceMessageBox(hwndDlg,
473 pGlobalData->bApplyToDefaultUser = TRUE;
474 }
475 else
476 {
477 pGlobalData->bApplyToDefaultUser = FALSE;
478 }
479
480 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
481 }
482 break;
483 }
484 break;
485
486 case WM_NOTIFY:
487 if (((LPNMHDR)lParam)->code == PSN_APPLY)
488 {
489 PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
490
491 SaveSystemSettings(pGlobalData);
492 SaveFontSubstitutionSettings(hwndDlg, pGlobalData);
493 SaveFontLinkingSettings(hwndDlg, pGlobalData);
494 }
495 else if (((LPNMHDR)lParam)->idFrom == IDC_CONV_TABLES &&
497 {
498 SetWindowLongPtr(hwndDlg,
501 return TRUE;
502 }
503 break;
504 }
505
506 return FALSE;
507}
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:282
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HWND hLangList
Definition: advanced.c:21
LRESULT ListViewCustomDraw(LPARAM lParam)
Definition: advanced.c:393
static VOID SaveFontLinkingSettings(HWND hwnd, PGLOBALDATA pGlobalData)
Definition: advanced.c:328
static VOID InitLanguagesList(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: advanced.c:237
static VOID SaveSystemSettings(PGLOBALDATA pGlobalData)
Definition: advanced.c:338
static VOID InitCodePagesList(HWND hwndDlg)
Definition: advanced.c:114
static VOID SaveFontSubstitutionSettings(HWND hwnd, PGLOBALDATA pGlobalData)
Definition: advanced.c:289
#define IDC_CONV_TABLES
Definition: resource.h:69
#define IDS_APPLY_DEFAULT_TITLE
Definition: resource.h:93
#define IDC_APPLY_CUR_USER_DEF_PROFILE
Definition: resource.h:68
#define IDC_LANGUAGE_COMBO
Definition: resource.h:53
#define IDS_APPLY_DEFAULT_TEXT
Definition: resource.h:94
struct _GLOBALDATA * PGLOBALDATA
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define WM_NOTIFY
Definition: richedit.h:61
DWORD LCID
Definition: nls.h:13
BOOL bApplyToDefaultUser
Definition: intl.h:116
LCID SystemLCID
Definition: intl.h:114
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:872
#define WM_COMMAND
Definition: winuser.h:1740
#define CB_ERR
Definition: winuser.h:2435
#define WM_INITDIALOG
Definition: winuser.h:1739
#define CBN_SELCHANGE
Definition: winuser.h:1979
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_GETITEMDATA
Definition: winuser.h:1950
#define SendMessage
Definition: winuser.h:5843
#define MB_OK
Definition: winuser.h:790
#define MB_ICONWARNING
Definition: winuser.h:786
HWND WINAPI GetParent(_In_ HWND)
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define BN_CLICKED
Definition: winuser.h:1925
#define CB_GETCURSEL
Definition: winuser.h:1943
#define BM_GETCHECK
Definition: winuser.h:1918

Referenced by Applet(), and SystemApplet().

◆ GetCurrentDPI()

static VOID GetCurrentDPI ( LPTSTR  szDPI)
static

Definition at line 255 of file advanced.c.

256{
257 DWORD dwType, dwSize, dwDPI, dwDefDPI = 0x00000060; // Default 96 DPI
258 HKEY hKey;
259
260 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI", 0, NULL,
262 {
263 wcscpy(szDPI, L"96");
264 return;
265 }
266
267 dwType = REG_DWORD;
268 dwSize = sizeof(DWORD);
269
270 if (RegQueryValueExW(hKey, L"LogPixels", NULL, &dwType, (LPBYTE)&dwDPI, &dwSize) != ERROR_SUCCESS)
271 {
272 if (RegSetValueExW(hKey, L"LogPixels", 0, REG_DWORD, (LPBYTE)&dwDefDPI, sizeof(DWORD)) == ERROR_SUCCESS)
273 {
274 wcscpy(szDPI, L"96");
276 return;
277 }
278 }
279 else
280 {
281 wsprintf(szDPI, L"%d", dwDPI);
282 }
283
285}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
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:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define wsprintf
Definition: winuser.h:5865

Referenced by SaveFontSubstitutionSettings().

◆ GetSupportedCP()

static BOOL GetSupportedCP ( HINF  hInf)
static

Definition at line 24 of file advanced.c.

26{
27 WCHAR szSection[MAX_PATH];
29 PCPAGE pCodePage;
30 CPINFOEX cpInfEx;
31 UINT uiCodePage;
32
33 if (!SetupFindFirstLine(hInf,
34 L"CodePages",
35 NULL,
36 &Context))
37 return FALSE;
38
39 for (;;)
40 {
41 if (SetupGetIntField(&Context, 0, (PINT)&uiCodePage))
42 {
43 pCodePage = HeapAlloc(GetProcessHeap(), 0, sizeof(CPAGE));
44 if (pCodePage == NULL)
45 return FALSE;
46
47 pCodePage->CodePage = uiCodePage;
48 pCodePage->Flags = 0;
49 (pCodePage->Name)[0] = UNICODE_NULL;
50
51 if (GetCPInfoExW(uiCodePage, 0, &cpInfEx))
52 {
53 wcscpy(pCodePage->Name, cpInfEx.CodePageName);
54 }
55 else
56 {
58 }
59
60 if (wcslen(pCodePage->Name) != 0)
61 {
62 pCodePage->NextItem = PCPage;
63 PCPage = pCodePage;
64
65 wsprintf(szSection, L"CODEPAGE_REMOVE_%d", uiCodePage);
66
67 if ((uiCodePage == GetACP()) ||
68 (uiCodePage == GetOEMCP()) ||
69 (!SetupFindFirstLineW(hInf, szSection, L"AddReg", &Context2)))
70 {
71 pCodePage->Flags |= CODEPAGE_NOT_REMOVEABLE;
72 }
73 }
74 else
75 {
76 HeapFree(GetProcessHeap(), 0, pCodePage);
77 }
78 }
79
81 break;
82 }
83
84 return TRUE;
85}
#define CODEPAGE_NOT_REMOVEABLE
Definition: advanced.c:15
static PCPAGE PCPage
Definition: advanced.c:19
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
UINT WINAPI GetACP(void)
Definition: locale.c:2020
BOOL WINAPI GetCPInfoExW(UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo)
Definition: locale.c:2219
UINT WINAPI GetOEMCP(void)
Definition: locale.c:2059
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int UINT
Definition: ndis.h:50
#define UNICODE_NULL
#define SetupFindFirstLine
Definition: setupapi.h:2624
UINT CodePage
Definition: advanced.c:8
WCHAR Name[MAX_PATH]
Definition: advanced.c:10
DWORD Flags
Definition: advanced.c:9
struct CPStruct * NextItem
Definition: advanced.c:11
CHAR CodePageName[MAX_PATH]
Definition: winnls.h:591
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1096
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:186
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:56
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:148
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:82
int * PINT
Definition: windef.h:177
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by InitCodePagesList().

◆ InitCodePagesList()

static VOID InitCodePagesList ( HWND  hwndDlg)
static

Definition at line 114 of file advanced.c.

115{
116 PCPAGE pCodePage;
117 INT ItemIndex;
118 HWND hList;
121 RECT ListRect;
122 HINF hIntlInf;
123
124 hIntlInf = SetupOpenInfFileW(L"intl.inf", NULL, INF_STYLE_WIN4, NULL);
125 if (hIntlInf == INVALID_HANDLE_VALUE)
126 return;
127
128 if (!SetupOpenAppendInfFile(NULL, hIntlInf, NULL))
129 {
130 SetupCloseInfFile(hIntlInf);
131 hIntlInf = NULL;
132 return;
133 }
134
135 if (!GetSupportedCP(hIntlInf))
136 return;
137
138 SetupCloseInfFile(hIntlInf);
139
141 {
142 /* Hack: EnumSystemCodePages returns FALSE on successful completion! */
143 /* return; */
144 }
145
146 hList = GetDlgItem(hwndDlg, IDC_CONV_TABLES);
147
148 ZeroMemory(&column, sizeof(LV_COLUMN));
149 column.mask = LVCF_FMT | LVCF_WIDTH;
150 column.fmt = LVCFMT_LEFT;
151 GetClientRect(hList, &ListRect);
152 column.cx = ListRect.right - GetSystemMetrics(SM_CYHSCROLL);
154
156
157 pCodePage = PCPage;
158
159 for (;;)
160 {
161 if (pCodePage == NULL)
162 break;
163
164 ZeroMemory(&item, sizeof(LV_ITEM));
166 item.state = 0;
167 item.stateMask = LVIS_STATEIMAGEMASK;
168 item.pszText = pCodePage->Name;
169 item.lParam = (LPARAM)pCodePage;
170
171 ItemIndex = ListView_InsertItem(hList, &item);
172 if (ItemIndex != -1)
173 {
174 if (pCodePage->Flags & CODEPAGE_INSTALLED)
175 {
176 ListView_SetItemState(hList, ItemIndex,
179 }
180 else
181 {
182 ListView_SetItemState(hList, ItemIndex,
185 }
186 }
187
188 pCodePage = pCodePage->NextItem;
189 }
190}
#define VOID
Definition: acefi.h:82
#define CODEPAGE_INSTALLED
Definition: advanced.c:14
static BOOL CALLBACK InstalledCPProc(PWSTR lpStr)
Definition: advanced.c:88
static BOOL GetSupportedCP(HINF hInf)
Definition: advanced.c:24
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
BOOL WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW lpfnCodePageEnum, DWORD flags)
Definition: locale.c:2294
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
#define INF_STYLE_WIN4
Definition: infsupp.h:41
HWND hList
Definition: livecd.c:10
static ATOM item
Definition: dde.c:856
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LV_ITEM
Definition: commctrl.h:2337
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2328
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define LV_COLUMN
Definition: commctrl.h:2547
#define SetupOpenAppendInfFile
Definition: setupapi.h:2651
LONG right
Definition: windef.h:308
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:45
#define ZeroMemory
Definition: winbase.h:1712
LONG_PTR LPARAM
Definition: windef.h:208
#define CP_INSTALLED
Definition: winnls.h:199
#define SM_CYHSCROLL
Definition: winuser.h:962
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by AdvancedPageProc().

◆ InitLanguagesList()

static VOID InitLanguagesList ( HWND  hwndDlg,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 237 of file advanced.c.

240{
241 WCHAR langSel[255];
242
244
245 bSpain = FALSE;
247
248 /* Select current locale */
249 GetLocaleInfoW(pGlobalData->SystemLCID, LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(WCHAR));
250
252}
static BOOL CALLBACK LocalesEnumProc(PWSTR lpLocale)
Definition: advanced.c:193
static BOOL bSpain
Definition: advanced.c:20
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: locale.c:2998
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1665
TCHAR langSel[255]
Definition: powercfg.c:24
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
#define LCID_SUPPORTED
Definition: winnls.h:202
#define CB_SELECTSTRING
Definition: winuser.h:1960
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by AdvancedPageProc().

◆ InstalledCPProc()

static BOOL CALLBACK InstalledCPProc ( PWSTR  lpStr)
static

Definition at line 88 of file advanced.c.

89{
90 PCPAGE lpCP;
91 UINT uiCP;
92
93 lpCP = PCPage;
94 uiCP = _wtol(lpStr);
95
96 for (;;)
97 {
98 if (!lpCP)
99 break;
100
101 if (lpCP->CodePage == uiCP)
102 {
103 lpCP->Flags |= CODEPAGE_INSTALLED;
104 break;
105 }
106
107 lpCP = lpCP->NextItem;
108 }
109
110 return TRUE;
111}
_Check_return_ _CRTIMP long __cdecl _wtol(_In_z_ const wchar_t *_Str)

Referenced by InitCodePagesList().

◆ ListViewCustomDraw()

LRESULT ListViewCustomDraw ( LPARAM  lParam)

Definition at line 393 of file advanced.c.

395{
397
398 switch (lplvcd->nmcd.dwDrawStage)
399 {
400 case CDDS_PREPAINT:
401 return CDRF_NOTIFYITEMDRAW;
402
404 if (((PCPAGE)lplvcd->nmcd.lItemlParam)->Flags & CODEPAGE_NOT_REMOVEABLE)
405 {
407 }
408 else
409 {
411 }
413 return CDRF_NEWFONT;
414 }
415
416 return CDRF_DODEFAULT;
417}
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define CDRF_DODEFAULT
Definition: commctrl.h:268
struct tagNMLVCUSTOMDRAW * LPNMLVCUSTOMDRAW
#define CDRF_NEWFONT
Definition: commctrl.h:269
#define CDDS_PREPAINT
Definition: commctrl.h:280
COLORREF clrTextBk
Definition: commctrl.h:3064
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3062
COLORREF clrText
Definition: commctrl.h:3063
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_GRAYTEXT
Definition: winuser.h:932
#define COLOR_WINDOW
Definition: winuser.h:918
#define COLOR_WINDOWTEXT
Definition: winuser.h:921

Referenced by AdvancedPageProc().

◆ LocalesEnumProc()

static BOOL CALLBACK LocalesEnumProc ( PWSTR  lpLocale)
static

Definition at line 193 of file advanced.c.

194{
195 LCID lcid;
196 WCHAR lang[255];
197 INT index;
198 BOOL bNoShow = FALSE;
199
200 lcid = wcstoul(lpLocale, NULL, 16);
201
204 {
205 if (bSpain == FALSE)
206 {
208 bSpain = TRUE;
209 }
210 else
211 {
212 bNoShow = TRUE;
213 }
214 }
215 else
216 {
217 GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
218 }
219
220 if (bNoShow == FALSE)
221 {
224 0,
225 (LPARAM)lang);
226
229 index,
230 (LPARAM)lcid);
231 }
232
233 return TRUE;
234}
#define index(s, c)
Definition: various.h:29
#define IDS_SPAIN
Definition: resource.h:32
HINSTANCE hApplet
Definition: access.c:17
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint index
Definition: glext.h:6031
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
#define SUBLANG_SPANISH
Definition: nls.h:336
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define CB_SETITEMDATA
Definition: winuser.h:1966
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_ADDSTRING
Definition: winuser.h:1936

Referenced by InitLanguagesList().

◆ SaveFontLinkingSettings()

static VOID SaveFontLinkingSettings ( HWND  hwnd,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 328 of file advanced.c.

331{
332 /* TODO */
333}

Referenced by AdvancedPageProc().

◆ SaveFontSubstitutionSettings()

static VOID SaveFontSubstitutionSettings ( HWND  hwnd,
PGLOBALDATA  pGlobalData 
)
static

Definition at line 289 of file advanced.c.

292{
293 WCHAR szDefCP[5 + 1], szSection[MAX_PATH], szDPI[3 + 1];
294 HINF hFontInf;
295 UINT Count;
296
297 GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, szDefCP, sizeof(szDefCP) / sizeof(WCHAR));
298 GetCurrentDPI(szDPI);
299
300 wsprintf(szSection, L"Font.CP%s.%s", szDefCP, szDPI);
301
302 hFontInf = SetupOpenInfFileW(L"font.inf", NULL, INF_STYLE_WIN4, NULL);
303 if (hFontInf == INVALID_HANDLE_VALUE)
304 return;
305
306 if (!SetupOpenAppendInfFile(NULL, hFontInf, NULL))
307 {
308 SetupCloseInfFile(hFontInf);
309 return;
310 }
311
312 Count = (UINT)SetupGetLineCount(hFontInf, szSection);
313 if (Count <= 0)
314 return;
315
316 if (!SetupInstallFromInfSectionW(hwnd, hFontInf, szSection, SPINST_REGISTRY & ~SPINST_FILES,
317 NULL, NULL, 0, NULL, NULL, NULL, NULL))
318 {
320 }
321
322 SetupCloseInfFile(hFontInf);
323}
static VOID GetCurrentDPI(LPTSTR szDPI)
Definition: advanced.c:255
#define IDS_ERROR_UNICODE
Definition: resource.h:91
BOOL WINAPI SetupInstallFromInfSectionW(HWND owner, HINF hinf, PCWSTR section, UINT flags, HKEY key_root, PCWSTR src_root, UINT copy_flags, PSP_FILE_CALLBACK_W callback, PVOID context, HDEVINFO devinfo, PSP_DEVINFO_DATA devinfo_data)
Definition: install.c:1327
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
int Count
Definition: noreturn.cpp:7
#define SPINST_REGISTRY
Definition: setupapi.h:590
#define SetupGetLineCount
Definition: setupapi.h:2633
#define SPINST_FILES
Definition: setupapi.h:592
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37

Referenced by AdvancedPageProc().

◆ SaveSystemSettings()

static VOID SaveSystemSettings ( PGLOBALDATA  pGlobalData)
static

Definition at line 338 of file advanced.c.

340{
341 WCHAR ACPPage[9];
342 WCHAR OEMPage[9];
343 HKEY langKey;
344 DWORD ret;
345 WCHAR value[5];
346 DWORD valuesize;
347
348 ret = GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage, sizeof(OEMPage)/sizeof(WCHAR));
349 if (ret == 0)
350 {
352 return;
353 }
354
355 ret = GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, ACPPage, sizeof(ACPPage)/sizeof(WCHAR));
356 if (ret == 0)
357 {
359 return;
360 }
361
362 /* Set codepages */
363 ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
364 if (ret != ERROR_SUCCESS)
365 {
367 return;
368 }
369
370 RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR));
371 RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR));
372
373 RegCloseKey(langKey);
374
375
376 wsprintf(value, L"%04hX", LANGIDFROMLCID(pGlobalData->SystemLCID));
377 valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
378
379 /* Set language */
380 ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
381 if (ret != ERROR_SUCCESS)
382 {
384 return;
385 }
386
387 RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize);
388 RegCloseKey(langKey);
389}
#define IDS_ERROR_NLS_CODE_REG
Definition: resource.h:85
#define IDS_ERROR_NLS_KEY_REG
Definition: resource.h:84
#define IDS_ERROR_ANSI_CODE_PAGE
Definition: resource.h:81
#define IDS_ERROR_OEM_CODE_PAGE
Definition: resource.h:86
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
#define REG_SZ
Definition: layer.c:22
#define LANGIDFROMLCID(l)
Definition: nls.h:18
Definition: pdh_main.c:94
int ret
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
unsigned char BYTE
Definition: xxhash.c:193

Referenced by AdvancedPageProc().

Variable Documentation

◆ bSpain

BOOL bSpain = FALSE
static

Definition at line 20 of file advanced.c.

Referenced by InitLanguagesList(), and LocalesEnumProc().

◆ hLangList

HWND hLangList
static

Definition at line 21 of file advanced.c.

Referenced by AdvancedPageProc(), InitLanguagesList(), and LocalesEnumProc().

◆ PCPage

PCPAGE PCPage = NULL
static

Definition at line 19 of file advanced.c.

Referenced by GetSupportedCP(), InitCodePagesList(), and InstalledCPProc().