ReactOS 0.4.16-dev-197-g92996da
input.h File Reference
#include <stdlib.h>
#include <wchar.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <winuser.h>
#include <wingdi.h>
#include <commctrl.h>
#include <windowsx.h>
#include <setupapi.h>
#include <strsafe.h>
#include <cpl.h>
#include <imm32_undoc.h>
#include "resource.h"
Include dependency graph for input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  APPLET
 
struct  KEY_SETTINGS
 

Macros

#define WIN32_NO_STATUS
 
#define CCH_LAYOUT_ID   8
 
#define CCH_ULONG_DEC   10
 
#define MAX_STR_LEN   256
 

Typedefs

typedef struct APPLETPAPPLET
 

Functions

INT_PTR CALLBACK SettingsPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL EnableProcessPrivileges (LPCWSTR lpPrivilegeName, BOOL bEnable)
 
INT_PTR CALLBACK AdvancedSettingsPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK AddDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK EditDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK KeySettingsDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
DWORD ReadAttributes (VOID)
 
INT_PTR CALLBACK ChangeKeySeqDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static DWORD DWORDfromString (const WCHAR *pszString)
 
VOID GetSystemLibraryPath (LPWSTR pszPath, INT cchPath, LPCWSTR pszFileName)
 

Variables

HINSTANCE hApplet
 
BOOL g_bRebootNeeded
 

Macro Definition Documentation

◆ CCH_LAYOUT_ID

#define CCH_LAYOUT_ID   8

Definition at line 35 of file input.h.

◆ CCH_ULONG_DEC

#define CCH_ULONG_DEC   10

Definition at line 38 of file input.h.

◆ MAX_STR_LEN

#define MAX_STR_LEN   256

Definition at line 40 of file input.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 7 of file input.h.

Typedef Documentation

◆ PAPPLET

typedef struct APPLET * PAPPLET

Function Documentation

◆ AddDialogProc()

INT_PTR CALLBACK AddDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 177 of file add_dialog.c.

178{
179 switch (uMsg)
180 {
181 case WM_INITDIALOG:
182 OnInitAddDialog(hwndDlg);
183 return TRUE;
184
185 case WM_COMMAND:
186 OnCommandAddDialog(hwndDlg, wParam);
187 break;
188
189 case WM_DESTROY:
190 break;
191 }
192
193 return FALSE;
194}
static VOID OnCommandAddDialog(HWND hwndDlg, WPARAM wParam)
Definition: add_dialog.c:108
static VOID OnInitAddDialog(HWND hwndDlg)
Definition: add_dialog.c:62
WPARAM wParam
Definition: combotst.c:138
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define WM_DESTROY
Definition: winuser.h:1612

Referenced by OnCommandSettingsPage().

◆ AdvancedSettingsPageProc()

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

Definition at line 81 of file advanced_settings_page.c.

82{
83 switch (uMsg)
84 {
85 case WM_INITDIALOG:
86 LoadAdvancedSettings(hwndDlg);
87 return TRUE;
88
89 case WM_NOTIFY:
90 return OnNotifyAdvancedSettingsPage(hwndDlg, lParam);
91
92 case WM_COMMAND:
93 {
94 switch (LOWORD(wParam))
95 {
97 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
98 break;
99 }
100 break;
101 }
102 }
103
104 return 0;
105}
BOOL LoadAdvancedSettings(HWND hwndDlg)
static INT_PTR OnNotifyAdvancedSettingsPage(HWND hwndDlg, LPARAM lParam)
LPARAM lParam
Definition: combotst.c:139
#define IDC_TURNOFFTEXTSVCS_CB
Definition: resource.h:61
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define WM_NOTIFY
Definition: richedit.h:61
HWND WINAPI GetParent(_In_ HWND)

Referenced by SystemApplet().

◆ ChangeKeySeqDialogProc()

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

Definition at line 12 of file key_sequence_dialog.c.

13{
15
16 switch (uMsg)
17 {
18 case WM_INITDIALOG:
19 {
20 KEY_SETTINGS *keySettings = (KEY_SETTINGS*) lParam;
21
22 if (keySettings != NULL)
23 {
24 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR) keySettings);
25
26 if (keySettings->dwLanguage == 3)
27 {
31 }
32 else
33 {
35
36 if (keySettings->dwLanguage == 1)
37 {
39 }
40 else
41 {
43 }
44 }
45
46 if (keySettings->dwLayout == 3)
47 {
51 }
52 else
53 {
55
56 if (keySettings->dwLayout == 1)
57 {
59 }
60 else
61 {
63 }
64 }
65 }
66 return TRUE;
67 }
68
69 case WM_COMMAND:
70 {
71 switch (LOWORD(wParam))
72 {
74 {
75 if (HIWORD(wParam) == BN_CLICKED)
76 {
78 {
81 }
82 else
83 {
86 }
87 }
88 }
89 break;
90
92 {
93 if (HIWORD(wParam) == BN_CLICKED)
94 {
96 {
99 }
100 else
101 {
104 }
105 }
106 }
107 break;
108
109 case IDC_CTRL_LANG:
110 {
111 if (HIWORD(wParam) == BN_CLICKED)
112 {
115 }
116 }
117 break;
118
120 {
121 if (HIWORD(wParam) == BN_CLICKED)
122 {
125 }
126 }
127 break;
128
129 case IDC_CTRL_LAYOUT:
130 {
131 if (HIWORD(wParam) == BN_CLICKED)
132 {
135 }
136 }
137 break;
138
140 {
141 if (HIWORD(wParam) == BN_CLICKED)
142 {
145 }
146 }
147 break;
148
149 case IDOK:
150 {
151 KEY_SETTINGS *keySettings;
152
153 keySettings = (KEY_SETTINGS*)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
154
155 if (keySettings != NULL)
156 {
158 {
160 {
161 keySettings->dwLanguage = 2;
162 }
163 else
164 {
165 keySettings->dwLanguage = 1;
166 }
167 }
168 else
169 {
170 keySettings->dwLanguage = 3;
171 }
172
174 {
176 {
177 keySettings->dwLayout = 2;
178 }
179 else
180 {
181 keySettings->dwLayout = 1;
182 }
183 }
184 else
185 {
186 keySettings->dwLayout = 3;
187 }
188 }
189
190 EndDialog(hwndDlg, LOWORD(wParam));
191 }
192 break;
193
194 case IDCANCEL:
195 {
196 EndDialog(hwndDlg, LOWORD(wParam));
197 }
198 break;
199 }
200 }
201 break;
202 }
203
204 return FALSE;
205}
#define NULL
Definition: types.h:112
#define IDC_CTRL_LANG
Definition: resource.h:38
#define IDC_LEFT_ALT_LAYOUT
Definition: resource.h:41
#define IDC_SWITCH_INPUT_LANG_CB
Definition: resource.h:36
#define IDC_LEFT_ALT_LANG
Definition: resource.h:40
#define IDC_SWITCH_KBLAYOUTS_CB
Definition: resource.h:37
#define IDC_CTRL_LAYOUT
Definition: resource.h:39
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
DWORD dwLanguage
Definition: input.h:64
DWORD dwLayout
Definition: input.h:65
#define GWLP_USERDATA
Definition: treelist.c:63
#define HIWORD(l)
Definition: typedefs.h:247
#define GetWindowLongPtrW
Definition: winuser.h:4832
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:834
#define BST_UNCHECKED
Definition: winuser.h:199
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BN_CLICKED
Definition: winuser.h:1928
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by KeySettingsDialogProc().

◆ DWORDfromString()

static DWORD DWORDfromString ( const WCHAR pszString)
inlinestatic

Definition at line 80 of file input.h.

81{
82 WCHAR *pszEnd;
83
84 return wcstoul(pszString, &pszEnd, 16);
85}
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
Definition: wincrypt.h:4505
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GetDefaultLayoutForLocale(), LayoutList_ReadLayout(), and LocaleList_Create().

◆ EditDialogProc()

INT_PTR CALLBACK EditDialogProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 14 of file edit_dialog.c.

15{
17
18 switch (uMsg)
19 {
20 case WM_INITDIALOG:
21 {
22 LAYOUT_LIST_NODE *pCurrentLayout;
23 INPUT_LIST_NODE *pInput;
24 HWND hwndList;
25
26 pInput = (INPUT_LIST_NODE*) lParam;
27
28 if (pInput == NULL)
29 return TRUE;
30
31 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR) pInput);
32
34
35 hwndList = GetDlgItem(hwndDlg, IDC_KB_LAYOUT_IME_COMBO);
36
37 for (pCurrentLayout = LayoutList_GetFirst();
38 pCurrentLayout != NULL;
39 pCurrentLayout = pCurrentLayout->pNext)
40 {
41 INT iItemIndex;
42
43 iItemIndex = ComboBox_AddString(hwndList, pCurrentLayout->pszName);
44 ComboBox_SetItemData(hwndList, iItemIndex, pCurrentLayout);
45 }
46
47 ComboBox_SelectString(hwndList, 0, pInput->pLayout->pszName);
48 return TRUE;
49 }
50
51 case WM_COMMAND:
52 {
53 switch (LOWORD(wParam))
54 {
55 case IDOK:
56 {
57 INPUT_LIST_NODE *pInput;
58 HWND hwndList;
59
60 hwndList = GetDlgItem(hwndDlg, IDC_KB_LAYOUT_IME_COMBO);
61
63
64 if (pInput != NULL)
65 {
66 LAYOUT_LIST_NODE *pNewLayout;
67
68 pNewLayout = (LAYOUT_LIST_NODE*)ComboBox_GetItemData(hwndList,
69 ComboBox_GetCurSel(hwndList));
70 if (pNewLayout != NULL)
71 {
72 pInput->pLayout = pNewLayout;
74 }
75 }
76
77 EndDialog(hwndDlg, LOWORD(wParam));
78 }
79 break;
80
81 case IDCANCEL:
82 {
83 EndDialog(hwndDlg, LOWORD(wParam));
84 }
85 break;
86 }
87 }
88 break;
89 }
90
91 return FALSE;
92}
#define IDC_KB_LAYOUT_IME_COMBO
Definition: resource.h:34
#define IDC_INPUT_LANG_STR
Definition: resource.h:35
#define INPUT_LIST_NODE_FLAG_EDITED
Definition: input_list.h:11
LAYOUT_LIST_NODE * LayoutList_GetFirst(VOID)
Definition: layout_list.c:249
LAYOUT_LIST_NODE * pLayout
Definition: input_list.h:37
LOCALE_LIST_NODE * pLocale
Definition: input_list.h:36
struct _LAYOUT_LIST_NODE * pNext
Definition: layout_list.h:14
int32_t INT
Definition: typedefs.h:58
#define ComboBox_GetItemData(hwndCtl, index)
Definition: windowsx.h:54
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:49
#define ComboBox_AddString(hwndCtl, lpsz)
Definition: windowsx.h:41
#define ComboBox_SetItemData(hwndCtl, index, data)
Definition: windowsx.h:69
#define ComboBox_SelectString(hwndCtl, indexStart, lpszSelect)
Definition: windowsx.h:65
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

Referenced by OnCommandSettingsPage().

◆ EnableProcessPrivileges()

BOOL EnableProcessPrivileges ( LPCWSTR  lpPrivilegeName,
BOOL  bEnable 
)

Definition at line 548 of file settings_page.c.

549{
550 HANDLE hToken;
551 LUID luid;
552 TOKEN_PRIVILEGES tokenPrivileges;
553 BOOL Ret;
554
557 &hToken);
558 if (!Ret)
559 return Ret; // failure
560
561 Ret = LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid);
562 if (Ret)
563 {
564 tokenPrivileges.PrivilegeCount = 1;
565 tokenPrivileges.Privileges[0].Luid = luid;
566 tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
567
568 Ret = AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0);
569 }
570
571 CloseHandle(hToken);
572 return Ret;
573}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define GetCurrentProcess()
Definition: compat.h:759
unsigned int BOOL
Definition: ntddk_ex.h:94
$ULONG PrivilegeCount
Definition: setypes.h:1023
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1024
_In_ BOOL bEnable
Definition: winddi.h:3426
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:930
#define TOKEN_QUERY
Definition: setypes.h:928
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by MainWnd_OnClose(), and PropSheetProc().

◆ GetSystemLibraryPath()

VOID GetSystemLibraryPath ( LPWSTR  pszPath,
INT  cchPath,
LPCWSTR  pszFileName 
)

Definition at line 42 of file input_list.c.

43{
44 WCHAR szSysDir[MAX_PATH];
45 GetSystemDirectoryW(szSysDir, ARRAYSIZE(szSysDir));
46 StringCchPrintfW(pszPath, cchPath, L"%s\\%s", szSysDir, pszFileName);
47}
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44

Referenced by IntLoadKeyboardLayout().

◆ KeySettingsDialogProc()

INT_PTR CALLBACK KeySettingsDialogProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 224 of file key_settings_dialog.c.

225{
227
228 switch (uMsg)
229 {
230 case WM_INITDIALOG:
232 return TRUE;
233
234 case WM_COMMAND:
235 {
236 switch (LOWORD(wParam))
237 {
239 {
242 hwndDlg,
245 {
247 }
248 }
249 break;
250
251 case IDOK:
252 {
254 {
255 _KeySettings.dwAttributes &= ~KLF_SHIFTLOCK;
256 }
257 else
258 {
259 _KeySettings.dwAttributes |= KLF_SHIFTLOCK;
260 }
261
263 EndDialog(hwndDlg, LOWORD(wParam));
264 }
265 break;
266
267 case IDCANCEL:
268 {
269 EndDialog(hwndDlg, LOWORD(wParam));
270 }
271 break;
272 }
273 }
274 break;
275 }
276
277 return FALSE;
278}
HINSTANCE hApplet
Definition: access.c:17
INT_PTR CALLBACK ChangeKeySeqDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define IDC_CHANGE_KEY_SEQ_BTN
Definition: resource.h:30
#define IDC_PRESS_CL_KEY_RB
Definition: resource.h:27
#define IDC_KEY_LISTVIEW
Definition: resource.h:29
#define IDD_CHANGE_KEY_SEQ
Definition: resource.h:16
static VOID OnInitKeySettingsDialog(HWND hwndDlg)
static VOID WriteKeysSettings(VOID)
static KEY_SETTINGS _KeySettings
static VOID UpdateKeySettingsListView(HWND hwndList)
DWORD dwAttributes
Definition: input.h:63
LONG_PTR LPARAM
Definition: windef.h:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by OnCommandSettingsPage().

◆ ReadAttributes()

DWORD ReadAttributes ( VOID  )

Definition at line 14 of file key_settings_dialog.c.

15{
17 HKEY hKey;
18
20 L"Keyboard Layout",
21 0,
24 {
25 DWORD dwSize = sizeof(dwAttributes);
26
28 L"Attributes",
29 NULL, NULL,
31 &dwSize);
32
34 }
35
36 return dwAttributes;
37}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
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
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
unsigned char * LPBYTE
Definition: typedefs.h:53
DWORD dwAttributes
Definition: vdmdbg.h:34
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by ReadKeysSettings().

◆ SettingsPageProc()

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

Definition at line 613 of file settings_page.c.

614{
615 switch (uMsg)
616 {
617 case WM_INITDIALOG:
618 OnInitSettingsPage(hwndDlg);
619 return TRUE;
620
621 case WM_DESTROY:
622 OnDestroySettingsPage(hwndDlg);
623 break;
624
625 case WM_COMMAND:
627 break;
628
629 case WM_NOTIFY:
630 return OnNotifySettingsPage(hwndDlg, lParam);
631 }
632
633 return FALSE;
634}
static INT_PTR OnNotifySettingsPage(HWND hwndDlg, LPARAM lParam)
static VOID OnInitSettingsPage(HWND hwndDlg)
static VOID OnDestroySettingsPage(HWND hwndDlg)
VOID OnCommandSettingsPage(HWND hwndDlg, WPARAM wParam)

Variable Documentation

◆ g_bRebootNeeded

BOOL g_bRebootNeeded
extern

◆ hApplet

HINSTANCE hApplet
extern

Definition at line 17 of file access.c.