ReactOS 0.4.16-dev-320-g3bd9ddc
languages.c
Go to the documentation of this file.
1#include "intl.h"
2
3#include <shellapi.h>
4#include <shlobj.h>
5#include <shlwapi.h>
6#include <strsafe.h>
7
8/* What is the uninstallation command line of "ReactOS JPN Package"? */
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}
38
39/* Is there any installed "ReactOS JPN Package"? */
41{
44}
45
46/* Property page dialog callback */
49 UINT uMsg,
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}
165
166/* EOF */
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#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
#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
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
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1177
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
Definition: path.c:506
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
struct _GLOBALDATA * PGLOBALDATA
INT_PTR CALLBACK LanguagesPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: languages.c:48
BOOL HasJapanesePackage(HWND hwnd)
Definition: languages.c:40
BOOL GetJapaneseUninstallCmdLine(HWND hwnd, LPWSTR pszCmdLine, SIZE_T cchCmdLine)
Definition: languages.c:9
#define error(str)
Definition: mkdosfs.c:1605
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
#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:2492
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2434
#define _countof(array)
Definition: sndvol32.h:70
LPCWSTR lpParameters
Definition: shellapi.h:334
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define DWLP_USER
Definition: winuser.h:875
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
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:1928
#define BST_CHECKED
Definition: winuser.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184