ReactOS  0.4.13-dev-464-g6b95727
mui.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MUI_SUBFONT
 
struct  MUI_LAYOUTS
 
struct  MUI_LANGUAGE
 

Functions

BOOLEAN IsLanguageAvailable (IN PCWSTR LanguageId)
 
PCWSTR MUIDefaultKeyboardLayout (IN PCWSTR LanguageId)
 
PCWSTR MUIGetOEMCodePage (IN PCWSTR LanguageId)
 
PCWSTR MUIGetGeoID (IN PCWSTR LanguageId)
 
const MUI_LAYOUTSMUIGetLayoutsList (IN PCWSTR LanguageId)
 
BOOLEAN AddKbLayoutsToRegistry (IN const MUI_LAYOUTS *MuiLayouts)
 
BOOLEAN AddKeyboardLayouts (IN PCWSTR LanguageId)
 
BOOLEAN AddCodePage (IN PCWSTR LanguageId)
 

Function Documentation

◆ AddCodePage()

BOOLEAN AddCodePage ( IN PCWSTR  LanguageId)

Definition at line 523 of file mui.c.

525 {
526  ULONG lngIndex = 0;
527 
528  while (MUILanguageList[lngIndex].LanguageID != NULL)
529  {
530  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
531  {
532  if (AddCodepageToRegistry(MUILanguageList[lngIndex].ACPage,
533  MUILanguageList[lngIndex].OEMCPage,
534  MUILanguageList[lngIndex].MACCPage) &&
535  AddFontsSettingsToRegistry(MUILanguageList[lngIndex].MuiSubFonts))
536  {
537  return TRUE;
538  }
539  else
540  {
541  return FALSE;
542  }
543  }
544 
545  lngIndex++;
546  }
547 
548  return FALSE;
549 }
#define TRUE
Definition: types.h:120
static BOOLEAN AddFontsSettingsToRegistry(IN const MUI_SUBFONT *MuiSubFonts)
Definition: mui.c:472
smooth NULL
Definition: ftsmooth.c:416
static BOOLEAN AddCodepageToRegistry(IN PCWSTR ACPage, IN PCWSTR OEMCPage, IN PCWSTR MACCPage)
Definition: mui.c:392
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
unsigned int ULONG
Definition: retypes.h:1
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by UpdateRegistry().

◆ AddKbLayoutsToRegistry()

BOOLEAN AddKbLayoutsToRegistry ( IN const MUI_LAYOUTS MuiLayouts)

Definition at line 207 of file mui.c.

209 {
217  ULONG uIndex = 0;
218  ULONG uCount = 0;
219  WCHAR szKeyName[48] = L".DEFAULT\\Keyboard Layout";
220  WCHAR szValueName[3 + 1];
221  WCHAR szLangID[8 + 1];
222 
223  // Open the keyboard layout key
224  RtlInitUnicodeString(&KeyName, szKeyName);
226  &KeyName,
229  NULL);
230 
234  0,
235  NULL,
237  &Disposition);
238  if (!NT_SUCCESS(Status))
239  {
240  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
241  return FALSE;
242  }
243 
245 
246  KeyName.MaximumLength = sizeof(szKeyName);
247  Status = RtlAppendUnicodeToString(&KeyName, L"\\Preload");
248 
249  if (!NT_SUCCESS(Status))
250  {
251  DPRINT1("RtlAppend failed! (%lx)\n", Status);
252  DPRINT1("String is %wZ\n", &KeyName);
253  return FALSE;
254  }
255 
257  &KeyName,
260  NULL);
261 
265  0,
266  NULL,
268  &Disposition);
269  if (!NT_SUCCESS(Status))
270  {
271  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
272  return FALSE;
273  }
274 
275  RtlInitUnicodeString(&KeyName, L".DEFAULT\\Keyboard Layout\\Substitutes");
277  &KeyName,
280  NULL);
281 
285  0,
286  NULL,
288  &Disposition);
289  if (!NT_SUCCESS(Status))
290  {
291  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
294  return FALSE;
295  }
296 
297  while (MuiLayouts[uIndex].LangID != NULL)
298  {
299  if (uIndex > 19) break;
300 
301  RtlStringCchPrintfW(szValueName, ARRAYSIZE(szValueName), L"%u", uIndex + 1);
302  RtlInitUnicodeString(&ValueName, szValueName);
303 
304  RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"0000%s", MuiLayouts[uIndex].LangID);
305 
306  if (_wcsicmp(szLangID, MuiLayouts[uIndex].LayoutID) == 0)
307  {
309  &ValueName,
310  0,
311  REG_SZ,
312  (PVOID)MuiLayouts[uIndex].LayoutID,
313  (wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
314  if (!NT_SUCCESS(Status))
315  {
316  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
319  return FALSE;
320  }
321  }
322  else
323  {
324  RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"d%03lu%s", uCount, MuiLayouts[uIndex].LangID);
326  &ValueName,
327  0,
328  REG_SZ,
329  (PVOID)szLangID,
330  (wcslen(szLangID)+1) * sizeof(WCHAR));
331  if (!NT_SUCCESS(Status))
332  {
333  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
336  return FALSE;
337  }
338 
339  RtlInitUnicodeString(&ValueName, szLangID);
340 
342  &ValueName,
343  0,
344  REG_SZ,
345  (PVOID)MuiLayouts[uIndex].LayoutID,
346  (wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
347  if (!NT_SUCCESS(Status))
348  {
349  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
352  return FALSE;
353  }
354 
355  uCount++;
356  }
357 
358  uIndex++;
359  }
360 
361  if (uIndex > 1)
362  AddHotkeySettings(L"2", L"2", L"1");
363  else
364  AddHotkeySettings(L"3", L"3", L"3");
365 
368  return TRUE;
369 }
#define HKEY_USERS
Definition: winreg.h:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static BOOLEAN AddHotkeySettings(IN PCWSTR Hotkey, IN PCWSTR LangHotkey, IN PCWSTR LayoutHotkey)
Definition: mui.c:121
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
static __inline NTSTATUS RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1064
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4723
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define REG_SZ
Definition: layer.c:22

Referenced by AddKeyboardLayouts(), and ProcessKeyboardLayoutRegistry().

◆ AddKeyboardLayouts()

BOOLEAN AddKeyboardLayouts ( IN PCWSTR  LanguageId)

Definition at line 372 of file mui.c.

374 {
375  ULONG lngIndex = 0;
376 
377  while (MUILanguageList[lngIndex].LanguageID != NULL)
378  {
379  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
380  {
381  return AddKbLayoutsToRegistry(MUILanguageList[lngIndex].MuiLayouts);
382  }
383 
384  lngIndex++;
385  }
386 
387  return FALSE;
388 }
smooth NULL
Definition: ftsmooth.c:416
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
BOOLEAN AddKbLayoutsToRegistry(IN const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:207
unsigned int ULONG
Definition: retypes.h:1
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by UpdateRegistry().

◆ IsLanguageAvailable()

BOOLEAN IsLanguageAvailable ( IN PCWSTR  LanguageId)

Definition at line 69 of file mui.c.

71 {
72  ULONG lngIndex = 0;
73 
74  while (MUILanguageList[lngIndex].LanguageID != NULL)
75  {
76  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
77  return TRUE;
78 
79  lngIndex++;
80  }
81 
82  return FALSE;
83 }
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
unsigned int ULONG
Definition: retypes.h:1
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by ProcessLangEntry().

◆ MUIDefaultKeyboardLayout()

PCWSTR MUIDefaultKeyboardLayout ( IN PCWSTR  LanguageId)

Definition at line 87 of file mui.c.

89 {
90  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
91  return MUILanguageList[lngIndex].MuiLayouts[0].LayoutID;
92 }
#define max(a, b)
Definition: svc.c:63
const MUI_LAYOUTS * MuiLayouts
Definition: mui.h:24
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
static ULONG FindLanguageIndex(IN PCWSTR LanguageId)
Definition: mui.c:43
unsigned int ULONG
Definition: retypes.h:1
PCWSTR LayoutID
Definition: mui.h:12

Referenced by UpdateKBLayout().

◆ MUIGetGeoID()

PCWSTR MUIGetGeoID ( IN PCWSTR  LanguageId)

Definition at line 103 of file mui.c.

105 {
106  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
107  return MUILanguageList[lngIndex].GeoID;
108 }
#define max(a, b)
Definition: svc.c:63
PCWSTR GeoID
Definition: mui.h:22
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
static ULONG FindLanguageIndex(IN PCWSTR LanguageId)
Definition: mui.c:43
unsigned int ULONG
Definition: retypes.h:1

Referenced by UpdateRegistry().

◆ MUIGetLayoutsList()

const MUI_LAYOUTS* MUIGetLayoutsList ( IN PCWSTR  LanguageId)

Definition at line 111 of file mui.c.

113 {
114  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
115  return MUILanguageList[lngIndex].MuiLayouts;
116 }
#define max(a, b)
Definition: svc.c:63
const MUI_LAYOUTS * MuiLayouts
Definition: mui.h:24
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
static ULONG FindLanguageIndex(IN PCWSTR LanguageId)
Definition: mui.c:43
unsigned int ULONG
Definition: retypes.h:1

Referenced by CreateKeyboardLayoutList(), and ProcessKeyboardLayoutRegistry().

◆ MUIGetOEMCodePage()

PCWSTR MUIGetOEMCodePage ( IN PCWSTR  LanguageId)

Definition at line 95 of file mui.c.

97 {
98  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
99  return MUILanguageList[lngIndex].OEMCPage;
100 }
#define max(a, b)
Definition: svc.c:63
PCWSTR OEMCPage
Definition: mui.h:19
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
static ULONG FindLanguageIndex(IN PCWSTR LanguageId)
Definition: mui.c:43
unsigned int ULONG
Definition: retypes.h:1

Referenced by SetConsoleCodePage().