mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 11:08:51 +00:00
[CPL:INTL] Use Japanese package for Far-East files (#4834)
Implement IDC_INST_FILES_FOR_ASIAN checkbox action. It will install/uninstall "ReactOS JPN Package" in Japanese ReactOS. JIRA issue: CORE-12748
This commit is contained in:
parent
1a1a8a8303
commit
94c8f271c9
2 changed files with 75 additions and 29 deletions
|
@ -24,6 +24,6 @@ add_library(intl MODULE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/intl.def)
|
${CMAKE_CURRENT_BINARY_DIR}/intl.def)
|
||||||
|
|
||||||
set_module_type(intl cpl UNICODE)
|
set_module_type(intl cpl UNICODE)
|
||||||
add_importlibs(intl user32 comctl32 advapi32 setupapi shell32 msvcrt kernel32 ntdll)
|
add_importlibs(intl user32 comctl32 advapi32 setupapi shlwapi shell32 msvcrt kernel32 ntdll)
|
||||||
add_pch(intl intl.h SOURCE)
|
add_pch(intl intl.h SOURCE)
|
||||||
add_cd_file(TARGET intl DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET intl DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -1,15 +1,46 @@
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
|
||||||
/* Is there any Japanese input method? */
|
/* What is the uninstallation command line of "ReactOS JPN Package"? */
|
||||||
BOOL HasJapaneseIME(VOID)
|
BOOL GetJapaneseUninstallCmdLine(HWND hwnd, LPWSTR pszCmdLine, SIZE_T cchCmdLine)
|
||||||
{
|
{
|
||||||
WCHAR szImePath[MAX_PATH];
|
HKEY hKey;
|
||||||
GetSystemDirectoryW(szImePath, _countof(szImePath));
|
LONG error;
|
||||||
StringCchCatW(szImePath, _countof(szImePath), L"\\mzimeja.ime");
|
DWORD dwSize;
|
||||||
return GetFileAttributesW(szImePath) != INVALID_FILE_ATTRIBUTES;
|
|
||||||
|
pszCmdLine[0] = UNICODE_NULL;
|
||||||
|
|
||||||
|
error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
|
||||||
|
L"{80F03D6E-0549-4202-BE81-FF583F56A7A8}_is1",
|
||||||
|
0,
|
||||||
|
KEY_READ,
|
||||||
|
&hKey);
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
dwSize = cchCmdLine * sizeof(WCHAR);
|
||||||
|
error = RegQueryValueExW(hKey, L"UninstallString", NULL, NULL, (LPBYTE)pszCmdLine, &dwSize);
|
||||||
|
if (error != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pszCmdLine[cchCmdLine - 1] = UNICODE_NULL;
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is there any installed "ReactOS JPN Package"? */
|
||||||
|
BOOL HasJapanesePackage(HWND hwnd)
|
||||||
|
{
|
||||||
|
WCHAR szPath[MAX_PATH];
|
||||||
|
return GetJapaneseUninstallCmdLine(hwnd, szPath, _countof(szPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Property page dialog callback */
|
/* Property page dialog callback */
|
||||||
|
@ -40,9 +71,8 @@ LanguagesPageProc(HWND hwndDlg,
|
||||||
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
||||||
{
|
{
|
||||||
case LANG_JAPANESE:
|
case LANG_JAPANESE:
|
||||||
if (HasJapaneseIME())
|
if (HasJapanesePackage(hwndDlg))
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
|
||||||
CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
|
CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -82,32 +112,48 @@ LanguagesPageProc(HWND hwndDlg,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY)
|
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) /* Apply changes */
|
||||||
{
|
{
|
||||||
/* Apply changes */
|
/* EAST ASIAN specific */
|
||||||
if (IsDlgButtonChecked(hwndDlg, IDC_INST_FILES_FOR_ASIAN) == BST_CHECKED)
|
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
||||||
{
|
{
|
||||||
/* EAST ASIAN specific */
|
case LANG_JAPANESE:
|
||||||
switch (PRIMARYLANGID(GetUserDefaultLangID()))
|
if (IsDlgButtonChecked(hwndDlg, IDC_INST_FILES_FOR_ASIAN) == BST_CHECKED)
|
||||||
{
|
{
|
||||||
case LANG_JAPANESE:
|
if (!HasJapanesePackage(hwndDlg))
|
||||||
if (HasJapaneseIME())
|
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_INST_FILES_FOR_ASIAN), FALSE);
|
/* Install now */
|
||||||
CheckDlgButton(hwndDlg, IDC_INST_FILES_FOR_ASIAN, BST_CHECKED);
|
ShellExecuteW(hwndDlg, NULL, L"rapps.exe", L"/INSTALL jpn-package",
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShellExecuteW(hwndDlg, NULL, L"rapps.exe", L"/INSTALL mzimeja",
|
|
||||||
NULL, SW_SHOWNORMAL);
|
NULL, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WCHAR szUninstall[MAX_PATH];
|
||||||
|
if (GetJapaneseUninstallCmdLine(hwndDlg, szUninstall, _countof(szUninstall)))
|
||||||
|
{
|
||||||
|
/* Go to arguments of command line */
|
||||||
|
PWCHAR pchArgs = PathGetArgsW(szUninstall);
|
||||||
|
if (pchArgs && *pchArgs)
|
||||||
|
{
|
||||||
|
--pchArgs;
|
||||||
|
/* pchArgs pointer is inside szUninstall,
|
||||||
|
* so we have to split both strings */
|
||||||
|
*pchArgs = UNICODE_NULL;
|
||||||
|
++pchArgs;
|
||||||
|
}
|
||||||
|
PathUnquoteSpacesW(szUninstall);
|
||||||
|
|
||||||
case LANG_CHINESE: /* Not supported yet */
|
/* Uninstall now */
|
||||||
case LANG_KOREAN: /* Not supported yet */
|
ShellExecuteW(hwndDlg, NULL, szUninstall, pchArgs, NULL, SW_SHOWNORMAL);
|
||||||
default:
|
}
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
case LANG_CHINESE: /* Not supported yet */
|
||||||
|
case LANG_KOREAN: /* Not supported yet */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
|
PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
|
||||||
|
|
Loading…
Reference in a new issue