2007-09-02 20:42:08 +00:00
|
|
|
#include "intl.h"
|
2017-05-18 21:56:24 +00:00
|
|
|
#include <wingdi.h>
|
2007-09-02 20:42:08 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
#include <debug.h>
|
|
|
|
|
2008-02-24 10:56:35 +00:00
|
|
|
typedef struct CPStruct
|
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
UINT CodePage;
|
2017-05-18 21:56:24 +00:00
|
|
|
DWORD Flags;
|
2017-05-15 20:02:48 +00:00
|
|
|
WCHAR Name[MAX_PATH];
|
|
|
|
struct CPStruct *NextItem;
|
|
|
|
} CPAGE, *PCPAGE;
|
|
|
|
|
2017-05-18 21:56:24 +00:00
|
|
|
#define CODEPAGE_INSTALLED 0x00000001
|
|
|
|
#define CODEPAGE_NOT_REMOVEABLE 0x00000002
|
|
|
|
#define CODEPAGE_INSTALL 0x00000004
|
|
|
|
#define CODEPAGE_REMOVE 0x00000008
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
static PCPAGE PCPage = NULL;
|
2008-05-30 18:18:36 +00:00
|
|
|
static BOOL bSpain = FALSE;
|
|
|
|
static HWND hLangList;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
static BOOL
|
2017-05-15 20:02:48 +00:00
|
|
|
GetSupportedCP(
|
|
|
|
HINF hInf)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-18 21:56:24 +00:00
|
|
|
WCHAR szSection[MAX_PATH];
|
|
|
|
INFCONTEXT Context, Context2;
|
2017-05-15 20:02:48 +00:00
|
|
|
PCPAGE pCodePage;
|
2008-03-16 19:19:26 +00:00
|
|
|
CPINFOEX cpInfEx;
|
2017-05-15 20:02:48 +00:00
|
|
|
UINT uiCodePage;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
if (!SetupFindFirstLine(hInf,
|
|
|
|
L"CodePages",
|
|
|
|
NULL,
|
|
|
|
&Context))
|
|
|
|
return FALSE;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
for (;;)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
if (SetupGetIntField(&Context, 0, (PINT)&uiCodePage))
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
pCodePage = HeapAlloc(GetProcessHeap(), 0, sizeof(CPAGE));
|
|
|
|
if (pCodePage == NULL)
|
|
|
|
return FALSE;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
pCodePage->CodePage = uiCodePage;
|
2017-05-18 21:56:24 +00:00
|
|
|
pCodePage->Flags = 0;
|
2017-05-15 20:02:48 +00:00
|
|
|
(pCodePage->Name)[0] = UNICODE_NULL;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
if (GetCPInfoExW(uiCodePage, 0, &cpInfEx))
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
wcscpy(pCodePage->Name, cpInfEx.CodePageName);
|
2008-02-24 10:56:35 +00:00
|
|
|
}
|
2017-05-15 20:02:48 +00:00
|
|
|
else
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
SetupGetStringFieldW(&Context, 1, pCodePage->Name, MAX_PATH, NULL);
|
2008-02-24 10:56:35 +00:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
if (wcslen(pCodePage->Name) != 0)
|
|
|
|
{
|
|
|
|
pCodePage->NextItem = PCPage;
|
|
|
|
PCPage = pCodePage;
|
2017-06-07 14:10:43 +00:00
|
|
|
|
|
|
|
wsprintf(szSection, L"CODEPAGE_REMOVE_%d", uiCodePage);
|
|
|
|
|
|
|
|
if ((uiCodePage == GetACP()) ||
|
|
|
|
(uiCodePage == GetOEMCP()) ||
|
|
|
|
(!SetupFindFirstLineW(hInf, szSection, L"AddReg", &Context2)))
|
|
|
|
{
|
|
|
|
pCodePage->Flags |= CODEPAGE_NOT_REMOVEABLE;
|
|
|
|
}
|
2017-05-15 20:02:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, pCodePage);
|
|
|
|
}
|
2008-02-24 10:56:35 +00:00
|
|
|
}
|
2017-05-15 20:02:48 +00:00
|
|
|
|
|
|
|
if (!SetupFindNextLine(&Context, &Context))
|
|
|
|
break;
|
2008-02-24 10:56:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CALLBACK
|
2015-09-20 19:00:10 +00:00
|
|
|
InstalledCPProc(PWSTR lpStr)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
PCPAGE lpCP;
|
2008-02-24 10:56:35 +00:00
|
|
|
UINT uiCP;
|
|
|
|
|
|
|
|
lpCP = PCPage;
|
2015-09-20 19:00:10 +00:00
|
|
|
uiCP = _wtol(lpStr);
|
2008-05-30 18:18:36 +00:00
|
|
|
|
2008-02-24 10:56:35 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
if (!lpCP)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (lpCP->CodePage == uiCP)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-18 21:56:24 +00:00
|
|
|
lpCP->Flags |= CODEPAGE_INSTALLED;
|
2008-02-24 10:56:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-05-15 20:02:48 +00:00
|
|
|
|
2008-02-24 10:56:35 +00:00
|
|
|
lpCP = lpCP->NextItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
2008-05-30 18:18:36 +00:00
|
|
|
InitCodePagesList(HWND hwndDlg)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
PCPAGE pCodePage;
|
2008-02-24 10:56:35 +00:00
|
|
|
INT ItemIndex;
|
|
|
|
HWND hList;
|
2008-03-16 19:19:26 +00:00
|
|
|
LV_COLUMN column;
|
|
|
|
LV_ITEM item;
|
|
|
|
RECT ListRect;
|
2017-05-15 20:02:48 +00:00
|
|
|
HINF hIntlInf;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
hIntlInf = SetupOpenInfFileW(L"intl.inf", NULL, INF_STYLE_WIN4, NULL);
|
2008-05-30 18:18:36 +00:00
|
|
|
if (hIntlInf == INVALID_HANDLE_VALUE)
|
|
|
|
return;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
if (!SetupOpenAppendInfFile(NULL, hIntlInf, NULL))
|
|
|
|
{
|
|
|
|
SetupCloseInfFile(hIntlInf);
|
|
|
|
hIntlInf = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
if (!GetSupportedCP(hIntlInf))
|
2008-05-30 18:18:36 +00:00
|
|
|
return;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
SetupCloseInfFile(hIntlInf);
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
if (!EnumSystemCodePagesW(InstalledCPProc, CP_INSTALLED))
|
|
|
|
{
|
|
|
|
/* Hack: EnumSystemCodePages returns FALSE on successful completion! */
|
|
|
|
/* return; */
|
|
|
|
}
|
|
|
|
|
|
|
|
hList = GetDlgItem(hwndDlg, IDC_CONV_TABLES);
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
ZeroMemory(&column, sizeof(LV_COLUMN));
|
2017-05-15 20:02:48 +00:00
|
|
|
column.mask = LVCF_FMT | LVCF_WIDTH;
|
|
|
|
column.fmt = LVCFMT_LEFT;
|
2008-02-24 10:56:35 +00:00
|
|
|
GetClientRect(hList, &ListRect);
|
2017-05-15 20:02:48 +00:00
|
|
|
column.cx = ListRect.right - GetSystemMetrics(SM_CYHSCROLL);
|
|
|
|
ListView_InsertColumn(hList, 0, &column);
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
(VOID) ListView_SetExtendedListViewStyle(hList, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT);
|
2008-02-24 10:56:35 +00:00
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
pCodePage = PCPage;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
2017-05-15 20:02:48 +00:00
|
|
|
if (pCodePage == NULL)
|
|
|
|
break;
|
|
|
|
|
2008-02-24 10:56:35 +00:00
|
|
|
ZeroMemory(&item, sizeof(LV_ITEM));
|
2017-05-15 20:02:48 +00:00
|
|
|
item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE;
|
2008-02-24 10:56:35 +00:00
|
|
|
item.state = 0;
|
|
|
|
item.stateMask = LVIS_STATEIMAGEMASK;
|
2017-05-15 20:02:48 +00:00
|
|
|
item.pszText = pCodePage->Name;
|
|
|
|
item.lParam = (LPARAM)pCodePage;
|
2008-02-24 10:56:35 +00:00
|
|
|
|
|
|
|
ItemIndex = ListView_InsertItem(hList, &item);
|
2017-05-15 20:02:48 +00:00
|
|
|
if (ItemIndex != -1)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
2017-05-18 21:56:24 +00:00
|
|
|
if (pCodePage->Flags & CODEPAGE_INSTALLED)
|
2008-02-24 10:56:35 +00:00
|
|
|
{
|
|
|
|
ListView_SetItemState(hList, ItemIndex,
|
|
|
|
INDEXTOSTATEIMAGEMASK(LVIS_SELECTED),
|
|
|
|
LVIS_STATEIMAGEMASK);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ListView_SetItemState(hList, ItemIndex,
|
|
|
|
INDEXTOSTATEIMAGEMASK(LVIS_FOCUSED),
|
|
|
|
LVIS_STATEIMAGEMASK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
pCodePage = pCodePage->NextItem;
|
2008-02-24 10:56:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-30 18:18:36 +00:00
|
|
|
static BOOL CALLBACK
|
2015-09-20 19:00:10 +00:00
|
|
|
LocalesEnumProc(PWSTR lpLocale)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
|
|
|
LCID lcid;
|
2015-09-20 19:00:10 +00:00
|
|
|
WCHAR lang[255];
|
2008-05-30 18:18:36 +00:00
|
|
|
INT index;
|
|
|
|
BOOL bNoShow = FALSE;
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
lcid = wcstoul(lpLocale, NULL, 16);
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
if (lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH), SORT_DEFAULT) ||
|
|
|
|
lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT))
|
|
|
|
{
|
|
|
|
if (bSpain == FALSE)
|
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
LoadStringW(hApplet, IDS_SPAIN, lang, 255);
|
2008-05-30 18:18:36 +00:00
|
|
|
bSpain = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bNoShow = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
GetLocaleInfoW(lcid, LOCALE_SLANGUAGE, lang, sizeof(lang)/sizeof(WCHAR));
|
2008-05-30 18:18:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (bNoShow == FALSE)
|
|
|
|
{
|
2017-04-30 15:39:41 +00:00
|
|
|
index = SendMessageW(hLangList,
|
|
|
|
CB_ADDSTRING,
|
|
|
|
0,
|
|
|
|
(LPARAM)lang);
|
|
|
|
|
|
|
|
SendMessageW(hLangList,
|
|
|
|
CB_SETITEMDATA,
|
|
|
|
index,
|
|
|
|
(LPARAM)lcid);
|
2008-05-30 18:18:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
2015-10-10 13:54:00 +00:00
|
|
|
InitLanguagesList(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PGLOBALDATA pGlobalData)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
WCHAR langSel[255];
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
hLangList = GetDlgItem(hwndDlg, IDC_LANGUAGE_COMBO);
|
|
|
|
|
|
|
|
bSpain = FALSE;
|
2015-09-20 19:00:10 +00:00
|
|
|
EnumSystemLocalesW(LocalesEnumProc, LCID_SUPPORTED);
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
/* Select current locale */
|
2015-10-10 13:54:00 +00:00
|
|
|
GetLocaleInfoW(pGlobalData->SystemLCID, LOCALE_SLANGUAGE, langSel, sizeof(langSel)/sizeof(WCHAR));
|
2008-05-30 18:18:36 +00:00
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
SendMessageW(hLangList, CB_SELECTSTRING, -1, (LPARAM)langSel);
|
2008-05-30 18:18:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static VOID
|
|
|
|
GetCurrentDPI(LPTSTR szDPI)
|
|
|
|
{
|
|
|
|
DWORD dwType, dwSize, dwDPI, dwDefDPI = 0x00000060; // Default 96 DPI
|
|
|
|
HKEY hKey;
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontDPI", 0, NULL,
|
|
|
|
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
wcscpy(szDPI, L"96");
|
2008-05-30 18:18:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwType = REG_DWORD;
|
|
|
|
dwSize = sizeof(DWORD);
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
if (RegQueryValueExW(hKey, L"LogPixels", NULL, &dwType, (LPBYTE)&dwDPI, &dwSize) != ERROR_SUCCESS)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
if (RegSetValueExW(hKey, L"LogPixels", 0, REG_DWORD, (LPBYTE)&dwDefDPI, sizeof(DWORD)) == ERROR_SUCCESS)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
wcscpy(szDPI, L"96");
|
2008-05-30 18:18:36 +00:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2017-04-30 15:39:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
wsprintf(szDPI, L"%d", dwDPI);
|
|
|
|
}
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
static
|
2008-05-30 18:18:36 +00:00
|
|
|
VOID
|
2015-10-10 13:54:00 +00:00
|
|
|
SaveFontSubstitutionSettings(
|
|
|
|
HWND hwnd,
|
|
|
|
PGLOBALDATA pGlobalData)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
WCHAR szDefCP[5 + 1], szSection[MAX_PATH], szDPI[3 + 1];
|
2008-05-30 18:18:36 +00:00
|
|
|
HINF hFontInf;
|
|
|
|
UINT Count;
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, szDefCP, sizeof(szDefCP) / sizeof(WCHAR));
|
2008-05-30 18:18:36 +00:00
|
|
|
GetCurrentDPI(szDPI);
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
wsprintf(szSection, L"Font.CP%s.%s", szDefCP, szDPI);
|
2008-05-30 18:18:36 +00:00
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
hFontInf = SetupOpenInfFileW(L"font.inf", NULL, INF_STYLE_WIN4, NULL);
|
2008-05-30 18:18:36 +00:00
|
|
|
if (hFontInf == INVALID_HANDLE_VALUE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!SetupOpenAppendInfFile(NULL, hFontInf, NULL))
|
|
|
|
{
|
|
|
|
SetupCloseInfFile(hFontInf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-15 20:02:48 +00:00
|
|
|
Count = (UINT)SetupGetLineCount(hFontInf, szSection);
|
2017-04-30 15:39:41 +00:00
|
|
|
if (Count <= 0)
|
|
|
|
return;
|
2008-05-30 18:18:36 +00:00
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
if (!SetupInstallFromInfSectionW(hwnd, hFontInf, szSection, SPINST_REGISTRY & ~SPINST_FILES,
|
|
|
|
NULL, NULL, 0, NULL, NULL, NULL, NULL))
|
2017-04-30 15:39:41 +00:00
|
|
|
{
|
2020-04-24 14:27:07 +00:00
|
|
|
PrintErrorMsgBox(IDS_ERROR_UNICODE);
|
2017-04-30 15:39:41 +00:00
|
|
|
}
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
SetupCloseInfFile(hFontInf);
|
|
|
|
}
|
|
|
|
|
2015-09-12 20:24:10 +00:00
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
SaveFontLinkingSettings(
|
|
|
|
HWND hwnd,
|
|
|
|
PGLOBALDATA pGlobalData)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-12 20:24:10 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
SaveSystemSettings(
|
2015-10-10 13:54:00 +00:00
|
|
|
PGLOBALDATA pGlobalData)
|
2015-09-12 20:24:10 +00:00
|
|
|
{
|
2015-09-20 19:00:10 +00:00
|
|
|
WCHAR ACPPage[9];
|
|
|
|
WCHAR OEMPage[9];
|
2015-09-12 20:24:10 +00:00
|
|
|
HKEY langKey;
|
|
|
|
DWORD ret;
|
|
|
|
WCHAR value[5];
|
|
|
|
DWORD valuesize;
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
ret = GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTCODEPAGE, OEMPage, sizeof(OEMPage)/sizeof(WCHAR));
|
2015-09-12 20:24:10 +00:00
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
PrintErrorMsgBox(IDS_ERROR_OEM_CODE_PAGE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
ret = GetLocaleInfoW(MAKELCID(pGlobalData->SystemLCID, SORT_DEFAULT), LOCALE_IDEFAULTANSICODEPAGE, ACPPage, sizeof(ACPPage)/sizeof(WCHAR));
|
2015-09-12 20:24:10 +00:00
|
|
|
if (ret == 0)
|
|
|
|
{
|
|
|
|
PrintErrorMsgBox(IDS_ERROR_ANSI_CODE_PAGE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set codepages */
|
2015-09-20 19:00:10 +00:00
|
|
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", &langKey);
|
2015-09-12 20:24:10 +00:00
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
PrintErrorMsgBox(IDS_ERROR_NLS_CODE_REG);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
RegSetValueExW(langKey, L"OEMCP", 0, REG_SZ, (BYTE *)OEMPage, (wcslen(OEMPage) +1 ) * sizeof(WCHAR));
|
|
|
|
RegSetValueExW(langKey, L"ACP", 0, REG_SZ, (BYTE *)ACPPage, (wcslen(ACPPage) +1 ) * sizeof(WCHAR));
|
2015-09-12 20:24:10 +00:00
|
|
|
|
|
|
|
RegCloseKey(langKey);
|
|
|
|
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
wsprintf(value, L"%04hX", LANGIDFROMLCID(pGlobalData->SystemLCID));
|
2015-09-20 19:00:10 +00:00
|
|
|
valuesize = (wcslen(value) + 1) * sizeof(WCHAR);
|
2015-09-12 20:24:10 +00:00
|
|
|
|
|
|
|
/* Set language */
|
2015-09-20 19:00:10 +00:00
|
|
|
ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", &langKey);
|
2015-09-12 20:24:10 +00:00
|
|
|
if (ret != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
PrintErrorMsgBox(IDS_ERROR_NLS_KEY_REG);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-20 19:00:10 +00:00
|
|
|
RegSetValueExW(langKey, L"Default", 0, REG_SZ, (BYTE *)value, valuesize);
|
2015-09-12 20:24:10 +00:00
|
|
|
RegCloseKey(langKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-18 21:56:24 +00:00
|
|
|
LRESULT
|
|
|
|
ListViewCustomDraw(
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;
|
|
|
|
|
|
|
|
switch (lplvcd->nmcd.dwDrawStage)
|
|
|
|
{
|
|
|
|
case CDDS_PREPAINT:
|
|
|
|
return CDRF_NOTIFYITEMDRAW;
|
|
|
|
|
|
|
|
case CDDS_ITEMPREPAINT:
|
|
|
|
if (((PCPAGE)lplvcd->nmcd.lItemlParam)->Flags & CODEPAGE_NOT_REMOVEABLE)
|
|
|
|
{
|
2017-10-13 20:24:37 +00:00
|
|
|
lplvcd->clrText = GetSysColor(COLOR_GRAYTEXT);
|
2017-05-18 21:56:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-13 20:24:37 +00:00
|
|
|
lplvcd->clrText = GetSysColor(COLOR_WINDOWTEXT);
|
2017-05-18 21:56:24 +00:00
|
|
|
}
|
2017-10-13 20:24:37 +00:00
|
|
|
lplvcd->clrTextBk = GetSysColor(COLOR_WINDOW);
|
|
|
|
return CDRF_NEWFONT;
|
2017-05-18 21:56:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return CDRF_DODEFAULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-02 20:42:08 +00:00
|
|
|
/* Property page dialog callback */
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
AdvancedPageProc(HWND hwndDlg,
|
2007-09-05 14:24:45 +00:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2007-09-02 20:42:08 +00:00
|
|
|
{
|
2015-09-19 12:14:35 +00:00
|
|
|
PGLOBALDATA pGlobalData;
|
|
|
|
|
|
|
|
pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
|
|
|
switch (uMsg)
|
2007-09-05 14:24:45 +00:00
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2015-09-19 12:14:35 +00:00
|
|
|
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
InitLanguagesList(hwndDlg, pGlobalData);
|
2008-05-30 18:18:36 +00:00
|
|
|
InitCodePagesList(hwndDlg);
|
2015-09-19 12:14:35 +00:00
|
|
|
break;
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
|
|
|
case IDC_LANGUAGE_COMBO:
|
|
|
|
if (HIWORD(wParam) == CBN_SELCHANGE)
|
2015-09-19 12:14:35 +00:00
|
|
|
{
|
2015-10-10 13:54:00 +00:00
|
|
|
LCID lcid;
|
|
|
|
INT iIndex;
|
|
|
|
|
|
|
|
iIndex = SendMessage(hLangList, CB_GETCURSEL, 0, 0);
|
|
|
|
if (iIndex == CB_ERR)
|
|
|
|
break;
|
|
|
|
|
|
|
|
lcid = SendMessage(hLangList, CB_GETITEMDATA, iIndex, 0);
|
|
|
|
if (lcid == (LCID)CB_ERR)
|
|
|
|
break;
|
|
|
|
|
|
|
|
pGlobalData->SystemLCID = lcid;
|
|
|
|
|
2008-05-30 18:18:36 +00:00
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
2015-09-19 12:14:35 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_APPLY_CUR_USER_DEF_PROFILE:
|
|
|
|
if (HIWORD(wParam) == BN_CLICKED)
|
|
|
|
{
|
|
|
|
if (SendDlgItemMessageW(hwndDlg, IDC_APPLY_CUR_USER_DEF_PROFILE, BM_GETCHECK, 0, 0))
|
|
|
|
{
|
|
|
|
ResourceMessageBox(hwndDlg,
|
|
|
|
MB_OK | MB_ICONWARNING,
|
|
|
|
IDS_APPLY_DEFAULT_TITLE,
|
|
|
|
IDS_APPLY_DEFAULT_TEXT);
|
|
|
|
pGlobalData->bApplyToDefaultUser = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pGlobalData->bApplyToDefaultUser = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
|
|
|
}
|
|
|
|
break;
|
2008-05-30 18:18:36 +00:00
|
|
|
}
|
2015-09-19 12:14:35 +00:00
|
|
|
break;
|
2008-05-30 18:18:36 +00:00
|
|
|
|
|
|
|
case WM_NOTIFY:
|
2017-05-18 21:56:24 +00:00
|
|
|
if (((LPNMHDR)lParam)->code == PSN_APPLY)
|
2008-05-30 18:18:36 +00:00
|
|
|
{
|
2008-06-03 11:55:02 +00:00
|
|
|
PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
|
|
|
|
|
2015-10-10 13:54:00 +00:00
|
|
|
SaveSystemSettings(pGlobalData);
|
|
|
|
SaveFontSubstitutionSettings(hwndDlg, pGlobalData);
|
|
|
|
SaveFontLinkingSettings(hwndDlg, pGlobalData);
|
2008-05-30 18:18:36 +00:00
|
|
|
}
|
2017-05-18 21:56:24 +00:00
|
|
|
else if (((LPNMHDR)lParam)->idFrom == IDC_CONV_TABLES &&
|
|
|
|
((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
|
|
|
|
{
|
2018-02-27 21:48:32 +00:00
|
|
|
SetWindowLongPtr(hwndDlg,
|
|
|
|
DWLP_MSGRESULT,
|
|
|
|
(LONG_PTR)ListViewCustomDraw(lParam));
|
2017-05-18 21:56:24 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2017-04-30 15:39:41 +00:00
|
|
|
break;
|
2007-09-05 14:24:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2007-09-02 20:42:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|