ReactOS 0.4.15-dev-8241-g63935f8
languages.c File Reference
#include "intl.h"
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <strsafe.h>
Include dependency graph for languages.c:

Go to the source code of this file.

Functions

BOOL GetJapaneseUninstallCmdLine (HWND hwnd, LPWSTR pszCmdLine, SIZE_T cchCmdLine)
 
BOOL HasJapanesePackage (HWND hwnd)
 
INT_PTR CALLBACK LanguagesPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ GetJapaneseUninstallCmdLine()

BOOL GetJapaneseUninstallCmdLine ( HWND  hwnd,
LPWSTR  pszCmdLine,
SIZE_T  cchCmdLine 
)

Definition at line 9 of file languages.c.

10{
11 HKEY hKey;
12 LONG error;
14
15 pszCmdLine[0] = UNICODE_NULL;
16
18 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
19 L"{80F03D6E-0549-4202-BE81-FF583F56A7A8}_is1",
20 0,
22 &hKey);
23 if (error != ERROR_SUCCESS)
24 return FALSE;
25
26 dwSize = cchCmdLine * sizeof(WCHAR);
27 error = RegQueryValueExW(hKey, L"UninstallString", NULL, NULL, (LPBYTE)pszCmdLine, &dwSize);
28 if (error != ERROR_SUCCESS)
29 {
31 return FALSE;
32 }
33
34 pszCmdLine[cchCmdLine - 1] = UNICODE_NULL;
36 return TRUE;
37}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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
#define error(str)
Definition: mkdosfs.c:1605
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by HasJapanesePackage(), and LanguagesPageProc().

◆ HasJapanesePackage()

BOOL HasJapanesePackage ( HWND  hwnd)

Definition at line 40 of file languages.c.

41{
44}
#define MAX_PATH
Definition: compat.h:34
BOOL GetJapaneseUninstallCmdLine(HWND hwnd, LPWSTR pszCmdLine, SIZE_T cchCmdLine)
Definition: languages.c:9
LPCWSTR szPath
Definition: env.c:37
#define _countof(array)
Definition: sndvol32.h:70
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by LanguagesPageProc().

◆ LanguagesPageProc()

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

Definition at line 48 of file languages.c.

52{
53 SHELLEXECUTEINFOW shInputDll;
54 PGLOBALDATA pGlobalData;
55
56 pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
57
58 switch (uMsg)
59 {
60 case WM_INITDIALOG:
61 pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
62 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
63
64 if (!pGlobalData->bIsUserAdmin)
65 {
68 }
69
70 /* EAST ASIAN specific */
72 {
73 case LANG_JAPANESE:
74 if (HasJapanesePackage(hwndDlg))
75 {
77 }
78 break;
79
80 case LANG_CHINESE: /* Not supported yet */
81 case LANG_KOREAN: /* Not supported yet */
82 default:
84 break;
85 }
86 break;
87
88 case WM_COMMAND:
89 switch (LOWORD(wParam))
90 {
91 /* If "detail" button pressed */
93 if (HIWORD(wParam) == BN_CLICKED)
94 {
95 memset(&shInputDll, 0x0, sizeof(SHELLEXECUTEINFOW));
96 shInputDll.cbSize = sizeof(shInputDll);
97 shInputDll.hwnd = hwndDlg;
98 shInputDll.lpVerb = L"open";
99 shInputDll.lpFile = L"RunDll32.exe";
100 shInputDll.lpParameters = L"shell32.dll,Control_RunDLL input.dll";
101 if (ShellExecuteExW(&shInputDll) == 0)
102 {
104 }
105 }
106 break;
107
109 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
110 break;
111 }
112 break;
113
114 case WM_NOTIFY:
115 if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) /* Apply changes */
116 {
117 /* EAST ASIAN specific */
119 {
120 case LANG_JAPANESE:
122 {
123 if (!HasJapanesePackage(hwndDlg))
124 {
125 /* Install now */
126 ShellExecuteW(hwndDlg, NULL, L"rapps.exe", L"/INSTALL jpn-package",
128 }
129 }
130 else
131 {
132 WCHAR szUninstall[MAX_PATH];
133 if (GetJapaneseUninstallCmdLine(hwndDlg, szUninstall, _countof(szUninstall)))
134 {
135 /* Go to arguments of command line */
136 PWCHAR pchArgs = PathGetArgsW(szUninstall);
137 if (pchArgs && *pchArgs)
138 {
139 --pchArgs;
140 /* pchArgs pointer is inside szUninstall,
141 * so we have to split both strings */
142 *pchArgs = UNICODE_NULL;
143 ++pchArgs;
144 }
145 PathUnquoteSpacesW(szUninstall);
146
147 /* Uninstall now */
148 ShellExecuteW(hwndDlg, NULL, szUninstall, pchArgs, NULL, SW_SHOWNORMAL);
149 }
150 }
151 break;
152
153 case LANG_CHINESE: /* Not supported yet */
154 case LANG_KOREAN: /* Not supported yet */
155 default:
156 break;
157 }
158
159 PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg);
160 }
161 break;
162 }
163 return FALSE;
164}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDC_DETAIL_BUTTON
Definition: resource.h:52
#define IDC_INST_FILES_FOR_RTOL_LANG
Definition: resource.h:66
#define IDS_ERROR_INPUT_DLL
Definition: resource.h:90
#define IDC_INST_FILES_FOR_ASIAN
Definition: resource.h:67
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1176
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
Definition: path.c:506
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
struct _GLOBALDATA * PGLOBALDATA
BOOL HasJapanesePackage(HWND hwnd)
Definition: languages.c:40
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#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 WM_NOTIFY
Definition: richedit.h:61
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
#define memset(x, y, z)
Definition: compat.h:39
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2486
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2428
BOOL bIsUserAdmin
Definition: intl.h:122
LPCWSTR lpParameters
Definition: shellapi.h:333
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
#define SW_SHOWNORMAL
Definition: winuser.h:770
#define DWLP_USER
Definition: winuser.h:872
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetParent(_In_ HWND)
#define BN_CLICKED
Definition: winuser.h:1925
#define BST_CHECKED
Definition: winuser.h:197

Referenced by Applet().