ReactOS  0.4.15-dev-5446-g3f3714b
layout_list.h File Reference
#include "input.h"
Include dependency graph for layout_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _LAYOUT_LIST_NODE
 

Typedefs

typedef struct _LAYOUT_LIST_NODE LAYOUT_LIST_NODE
 

Functions

VOID LayoutList_Create (VOID)
 
VOID LayoutList_Destroy (VOID)
 
LAYOUT_LIST_NODELayoutList_GetByHkl (HKL hkl)
 
LAYOUT_LIST_NODELayoutList_GetFirst (VOID)
 

Typedef Documentation

◆ LAYOUT_LIST_NODE

Function Documentation

◆ LayoutList_Create()

VOID LayoutList_Create ( VOID  )

Definition at line 215 of file layout_list.c.

216 {
217  WCHAR szSystemDirectory[MAX_PATH], szKLID[KL_NAMELENGTH];
218  DWORD dwSize, dwIndex;
219  HKEY hKey, hLayoutKey;
220 
221  if (!GetSystemDirectoryW(szSystemDirectory, ARRAYSIZE(szSystemDirectory)))
222  return;
223 
224  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts",
225  0, KEY_READ, &hKey) != ERROR_SUCCESS)
226  {
227  return;
228  }
229 
230  for (dwIndex = 0; ; ++dwIndex)
231  {
232  dwSize = ARRAYSIZE(szKLID);
233  if (RegEnumKeyExW(hKey, dwIndex, szKLID, &dwSize, NULL, NULL,
234  NULL, NULL) != ERROR_SUCCESS)
235  {
236  break;
237  }
238 
239  if (RegOpenKeyExW(hKey, szKLID, 0, KEY_QUERY_VALUE, &hLayoutKey) == ERROR_SUCCESS)
240  {
241  LayoutList_ReadLayout(hLayoutKey, szKLID, szSystemDirectory);
242  RegCloseKey(hLayoutKey);
243  }
244  }
245 
246  RegCloseKey(hKey);
247 }
#define KL_NAMELENGTH
Definition: winuser.h:122
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define L(x)
Definition: ntvdm.h:50
static BOOL LayoutList_ReadLayout(HKEY hLayoutKey, LPCWSTR szKLID, LPCWSTR szSystemDirectory)
Definition: layout_list.c:147
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by OnInitSettingsPage().

◆ LayoutList_Destroy()

VOID LayoutList_Destroy ( VOID  )

Definition at line 67 of file layout_list.c.

68 {
69  LAYOUT_LIST_NODE *pCurrent;
70  LAYOUT_LIST_NODE *pNext;
71 
72  if (_LayoutList == NULL)
73  return;
74 
75  for (pCurrent = _LayoutList; pCurrent; pCurrent = pNext)
76  {
77  pNext = pCurrent->pNext;
78 
79  free(pCurrent->pszName);
80  free(pCurrent->pszFile);
81  free(pCurrent->pszImeFile);
82  free(pCurrent);
83  }
84 
85  _LayoutList = NULL;
86 }
#define free
Definition: debug_ros.c:5
static LAYOUT_LIST_NODE * _LayoutList
Definition: layout_list.c:11
struct _LAYOUT_LIST_NODE * pNext
Definition: layout_list.h:14
#define NULL
Definition: types.h:112

Referenced by OnDestroySettingsPage().

◆ LayoutList_GetByHkl()

LAYOUT_LIST_NODE* LayoutList_GetByHkl ( HKL  hkl)

Definition at line 251 of file layout_list.c.

252 {
253  LAYOUT_LIST_NODE *pCurrent;
254 
255  if (IS_SPECIAL_HKL(hkl))
256  {
257  WORD wSpecialId = SPECIALIDFROMHKL(hkl);
258 
259  for (pCurrent = _LayoutList; pCurrent != NULL; pCurrent = pCurrent->pNext)
260  {
261  if (wSpecialId == pCurrent->wSpecialId)
262  {
263  return pCurrent;
264  }
265  }
266  }
267  else if (IS_IME_HKL(hkl))
268  {
269  for (pCurrent = _LayoutList; pCurrent != NULL; pCurrent = pCurrent->pNext)
270  {
271  if (hkl == UlongToHandle(pCurrent->dwKLID))
272  {
273  return pCurrent;
274  }
275  }
276  }
277  else
278  {
279  for (pCurrent = _LayoutList; pCurrent != NULL; pCurrent = pCurrent->pNext)
280  {
281  if (HIWORD(hkl) == LOWORD(pCurrent->dwKLID))
282  {
283  return pCurrent;
284  }
285  }
286  }
287 
288  return NULL;
289 }
#define IS_SPECIAL_HKL(hKL)
Definition: input.h:89
static LAYOUT_LIST_NODE * _LayoutList
Definition: layout_list.c:11
struct _LAYOUT_LIST_NODE * pNext
Definition: layout_list.h:14
#define UlongToHandle(ul)
Definition: basetsd.h:97
unsigned short WORD
Definition: ntddk_ex.h:93
#define SPECIALIDFROMHKL(hKL)
Definition: input.h:90
HKL hkl
Definition: msctf.idl:611
#define IS_IME_HKL(hKL)
Definition: input.h:88
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
#define LOWORD(l)
Definition: pedump.c:82

Referenced by InputList_Create().

◆ LayoutList_GetFirst()

LAYOUT_LIST_NODE* LayoutList_GetFirst ( VOID  )

Definition at line 293 of file layout_list.c.

294 {
295  return _LayoutList;
296 }
static LAYOUT_LIST_NODE * _LayoutList
Definition: layout_list.c:11

Referenced by EditDialogProc(), and OnInitAddDialog().