ReactOS  0.4.15-dev-5606-gf34e425
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;
13  DWORD dwSize;
14 
15  pszCmdLine[0] = UNICODE_NULL;
16 
18  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
19  L"{80F03D6E-0549-4202-BE81-FF583F56A7A8}_is1",
20  0,
21  KEY_READ,
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,
50  WPARAM wParam,
51  LPARAM lParam)
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 */
92  case IDC_DETAIL_BUTTON:
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 */
struct _GLOBALDATA * PGLOBALDATA
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDS_ERROR_INPUT_DLL
Definition: resource.h:90
BOOL HasJapanesePackage(HWND hwnd)
Definition: languages.c:40
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error(str)
Definition: mkdosfs.c:1605
GLint x0
Definition: linetemp.h:95
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define CALLBACK
Definition: compat.h:35
#define IDC_INST_FILES_FOR_RTOL_LANG
Definition: resource.h:66
INT_PTR CALLBACK LanguagesPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: languages.c:48
UINT_PTR WPARAM
Definition: windef.h:207
uint16_t * PWCHAR
Definition: typedefs.h:56
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:64
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define IDC_INST_FILES_FOR_ASIAN
Definition: resource.h:67
#define LPPROPSHEETPAGE
Definition: prsht.h:390
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2335
BOOL GetJapaneseUninstallCmdLine(HWND hwnd, LPWSTR pszCmdLine, SIZE_T cchCmdLine)
Definition: languages.c:9
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
#define PropSheet_UnChanged(d, w)
Definition: prsht.h:358
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define BN_CLICKED
Definition: winuser.h:1915
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_DETAIL_BUTTON
Definition: resource.h:52
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1730
Definition: inflate.c:139
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
ULONG_PTR SIZE_T
Definition: typedefs.h:80
HWND WINAPI GetParent(_In_ HWND)
#define SW_SHOWNORMAL
Definition: winuser.h:764
FxAutoRegKey hKey
LPCWSTR szPath
Definition: env.c:37
LPCWSTR lpParameters
Definition: shellapi.h:331
LPWSTR WINAPI PathGetArgsW(LPCWSTR lpszPath)
Definition: path.c:506
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
VOID WINAPI PathUnquoteSpacesW(LPWSTR lpszPath)
Definition: path.c:1034
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define BST_CHECKED
Definition: winuser.h:197
#define LANG_CHINESE
Definition: nls.h:42
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2346
#define HIWORD(l)
Definition: typedefs.h:247
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define LANG_KOREAN
Definition: nls.h:84
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
VOID PrintErrorMsgBox(UINT msg)
Definition: intl.c:51
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define WM_NOTIFY
Definition: richedit.h:61
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12