ReactOS  0.4.15-dev-3017-g1d9542d
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  {
444  case IDC_LANGUAGE_COMBO:
445  if (HIWORD(wParam) == CBN_SELCHANGE)
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 }
struct _GLOBALDATA * PGLOBALDATA
static VOID SaveFontSubstitutionSettings(HWND hwnd, PGLOBALDATA pGlobalData)
Definition: advanced.c:289
#define TRUE
Definition: types.h:120
#define CB_GETITEMDATA
Definition: winuser.h:1932
#define IDC_CONV_TABLES
Definition: resource.h:69
DWORD LCID
Definition: nls.h:13
#define PSN_APPLY
Definition: prsht.h:117
static VOID InitLanguagesList(HWND hwndDlg, PGLOBALDATA pGlobalData)
Definition: advanced.c:237
static VOID SaveFontLinkingSettings(HWND hwnd, PGLOBALDATA pGlobalData)
Definition: advanced.c:328
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 DWLP_MSGRESULT
Definition: winuser.h:864
#define MB_ICONWARNING
Definition: winuser.h:780
#define IDC_APPLY_CUR_USER_DEF_PROFILE
Definition: resource.h:68
#define FALSE
Definition: types.h:117
#define IDC_LANGUAGE_COMBO
Definition: resource.h:53
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define BM_GETCHECK
Definition: winuser.h:1900
static VOID InitCodePagesList(HWND hwndDlg)
Definition: advanced.c:114
#define CB_ERR
Definition: winuser.h:2410
#define IDS_APPLY_DEFAULT_TEXT
Definition: resource.h:94
LCID SystemLCID
Definition: intl.h:114
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:282
#define IDS_APPLY_DEFAULT_TITLE
Definition: resource.h:93
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define BN_CLICKED
Definition: winuser.h:1907
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND hLangList
Definition: advanced.c:21
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
Definition: inflate.c:139
BOOL bApplyToDefaultUser
Definition: intl.h:116
HWND WINAPI GetParent(_In_ HWND)
static VOID SaveSystemSettings(PGLOBALDATA pGlobalData)
Definition: advanced.c:338
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define MB_OK
Definition: winuser.h:784
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define SendMessage
Definition: winuser.h:5818
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtr
Definition: treelist.c:73
LRESULT ListViewCustomDraw(LPARAM lParam)
Definition: advanced.c:393
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

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");
275  RegCloseKey(hKey);
276  return;
277  }
278  }
279  else
280  {
281  wsprintf(szDPI, L"%d", dwDPI);
282  }
283 
284  RegCloseKey(hKey);
285 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD
Definition: nt_native.h:44
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:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
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
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
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
FxAutoRegKey hKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define NULL
Definition: types.h:112
#define wsprintf
Definition: winuser.h:5840
#define REG_DWORD
Definition: sdbapi.c:596
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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  {
57  SetupGetStringFieldW(&Context, 1, pCodePage->Name, MAX_PATH, NULL);
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 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
struct CPStruct * NextItem
Definition: advanced.c:11
static PCPAGE PCPage
Definition: advanced.c:19
#define SetupFindFirstLine
Definition: setupapi.h:2619
#define TRUE
Definition: types.h:120
WCHAR Name[MAX_PATH]
Definition: advanced.c:10
UINT CodePage
Definition: advanced.c:8
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
UINT WINAPI GetACP(VOID)
Definition: nls.c:2180
DWORD Flags
Definition: advanced.c:9
int * PINT
Definition: windef.h:177
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define CODEPAGE_NOT_REMOVEABLE
Definition: advanced.c:15
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
CHAR CodePageName[MAX_PATH]
Definition: winnls.h:591
static const WCHAR L[]
Definition: oid.c:1250
_In_ PNET_PNP_EVENT _In_ PTDI_PNP_CONTEXT _In_ PTDI_PNP_CONTEXT Context2
Definition: tdikrnl.h:1094
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct tagContext Context
Definition: acpixf.h:1034
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
BOOL WINAPI GetCPInfoExW(UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx)
Definition: nls.c:1969
#define wsprintf
Definition: winuser.h:5840
#define HeapFree(x, y, z)
Definition: compat.h:594
UINT WINAPI GetOEMCP(VOID)
Definition: nls.c:2195
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

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;
120  LV_ITEM item;
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));
165  item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
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 }
BOOL WINAPI EnumSystemCodePagesW(CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags)
Definition: lang.c:3231
#define LV_ITEM
Definition: commctrl.h:2337
#define SM_CYHSCROLL
Definition: winuser.h:952
#define LVCF_WIDTH
Definition: commctrl.h:2587
struct CPStruct * NextItem
Definition: advanced.c:11
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define SetupOpenAppendInfFile
Definition: setupapi.h:2646
static PCPAGE PCPage
Definition: advanced.c:19
WCHAR Name[MAX_PATH]
Definition: advanced.c:10
#define LV_COLUMN
Definition: commctrl.h:2547
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define IDC_CONV_TABLES
Definition: resource.h:69
#define ZeroMemory
Definition: winbase.h:1664
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
#define LVIF_TEXT
Definition: commctrl.h:2309
#define CODEPAGE_INSTALLED
Definition: advanced.c:14
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define LVIS_SELECTED
Definition: commctrl.h:2319
LONG_PTR LPARAM
Definition: windef.h:208
DWORD Flags
Definition: advanced.c:9
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
static BOOL GetSupportedCP(HINF hInf)
Definition: advanced.c:24
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2328
int WINAPI GetSystemMetrics(_In_ int)
static BOOL CALLBACK InstalledCPProc(PWSTR lpStr)
Definition: advanced.c:88
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
static const WCHAR L[]
Definition: oid.c:1250
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define VOID
Definition: acefi.h:82
#define CP_INSTALLED
Definition: winnls.h:199
HWND hList
Definition: livecd.c:10
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2586
static ATOM item
Definition: dde.c:856
#define NULL
Definition: types.h:112
#define LVIF_PARAM
Definition: commctrl.h:2311
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVIS_FOCUSED
Definition: commctrl.h:2318

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 }
TCHAR langSel[255]
Definition: powercfg.c:24
#define LOCALE_SLANGUAGE
Definition: winnls.h:26
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define FALSE
Definition: types.h:117
#define IDC_LANGUAGE_COMBO
Definition: resource.h:53
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
Definition: lang.c:1604
LCID SystemLCID
Definition: intl.h:114
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HWND hLangList
Definition: advanced.c:21
#define CB_SELECTSTRING
Definition: winuser.h:1942
static BOOL CALLBACK LocalesEnumProc(PWSTR lpLocale)
Definition: advanced.c:193
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL bSpain
Definition: advanced.c:20
#define LCID_SUPPORTED
Definition: winnls.h:202

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 }
struct CPStruct * NextItem
Definition: advanced.c:11
static PCPAGE PCPage
Definition: advanced.c:19
#define TRUE
Definition: types.h:120
UINT CodePage
Definition: advanced.c:8
#define CODEPAGE_INSTALLED
Definition: advanced.c:14
DWORD Flags
Definition: advanced.c:9
unsigned int UINT
Definition: ndis.h:50
_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 
403  case CDDS_ITEMPREPAINT:
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
struct tagNMLVCUSTOMDRAW * LPNMLVCUSTOMDRAW
#define COLOR_WINDOW
Definition: winuser.h:908
DWORD WINAPI GetSysColor(_In_ int)
COLORREF clrText
Definition: commctrl.h:3063
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3062
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define CODEPAGE_NOT_REMOVEABLE
Definition: advanced.c:15
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define COLOR_GRAYTEXT
Definition: winuser.h:922
#define CDRF_NEWFONT
Definition: commctrl.h:269
COLORREF clrTextBk
Definition: commctrl.h:3064
LPARAM lParam
Definition: combotst.c:139

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  {
223  CB_ADDSTRING,
224  0,
225  (LPARAM)lang);
226 
229  index,
230  (LPARAM)lcid);
231  }
232 
233  return TRUE;
234 }
#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
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
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CB_ADDSTRING
Definition: winuser.h:1918
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
static HWND hLangList
Definition: advanced.c:21
#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 NULL
Definition: types.h:112
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_SPANISH
Definition: nls.h:123
static BOOL bSpain
Definition: advanced.c:20

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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static VOID GetCurrentDPI(LPTSTR szDPI)
Definition: advanced.c:255
#define MAKELCID(lgid, srtid)
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define SetupOpenAppendInfFile
Definition: setupapi.h:2646
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
#define IDS_ERROR_UNICODE
Definition: resource.h:91
#define SPINST_REGISTRY
Definition: setupapi.h:585
#define SPINST_FILES
Definition: setupapi.h:587
int Count
Definition: noreturn.cpp:7
LCID SystemLCID
Definition: intl.h:114
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
#define MAX_PATH
Definition: compat.h:34
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
static const WCHAR L[]
Definition: oid.c:1250
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define SetupGetLineCount
Definition: setupapi.h:2628
#define wsprintf
Definition: winuser.h:5840
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51

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 LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
#define MAKELCID(lgid, srtid)
Definition: pdh_main.c:93
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDS_ERROR_ANSI_CODE_PAGE
Definition: resource.h:81
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define IDS_ERROR_NLS_KEY_REG
Definition: resource.h:84
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
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_NLS_CODE_REG
Definition: resource.h:85
LCID SystemLCID
Definition: intl.h:114
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_DEFAULT
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define LANGIDFROMLCID(l)
Definition: nls.h:18
unsigned char BYTE
Definition: xxhash.c:193
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37
#define IDS_ERROR_OEM_CODE_PAGE
Definition: resource.h:86
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define wsprintf
Definition: winuser.h:5840
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

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().