ReactOS  0.4.15-dev-507-g90aff8d
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 535 of file mui.c.

537 {
538  ULONG lngIndex = 0;
539 
540  while (MUILanguageList[lngIndex].LanguageID != NULL)
541  {
542  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
543  {
544  if (AddCodepageToRegistry(MUILanguageList[lngIndex].ACPage,
545  MUILanguageList[lngIndex].OEMCPage,
546  MUILanguageList[lngIndex].MACCPage) &&
547  AddFontsSettingsToRegistry(MUILanguageList[lngIndex].MuiSubFonts))
548  {
549  return TRUE;
550  }
551  else
552  {
553  return FALSE;
554  }
555  }
556 
557  lngIndex++;
558  }
559 
560  return FALSE;
561 }
#define TRUE
Definition: types.h:120
static BOOLEAN AddFontsSettingsToRegistry(IN const MUI_SUBFONT *MuiSubFonts)
Definition: mui.c:473
smooth NULL
Definition: ftsmooth.c:416
static BOOLEAN AddCodepageToRegistry(IN PCWSTR ACPage, IN PCWSTR OEMCPage, IN PCWSTR MACCPage)
Definition: mui.c:393
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 208 of file mui.c.

210 {
218  ULONG uIndex = 0;
219  ULONG uCount = 0;
220  WCHAR szKeyName[48] = L".DEFAULT\\Keyboard Layout";
221  WCHAR szValueName[3 + 1];
222  WCHAR szLangID[8 + 1];
223 
224  // Open the keyboard layout key
225  RtlInitUnicodeString(&KeyName, szKeyName);
227  &KeyName,
230  NULL);
231 
235  0,
236  NULL,
238  &Disposition);
239  if (!NT_SUCCESS(Status))
240  {
241  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
242  return FALSE;
243  }
244 
246 
247  KeyName.MaximumLength = sizeof(szKeyName);
248  Status = RtlAppendUnicodeToString(&KeyName, L"\\Preload");
249 
250  if (!NT_SUCCESS(Status))
251  {
252  DPRINT1("RtlAppend failed! (%lx)\n", Status);
253  DPRINT1("String is %wZ\n", &KeyName);
254  return FALSE;
255  }
256 
258  &KeyName,
261  NULL);
262 
266  0,
267  NULL,
269  &Disposition);
270  if (!NT_SUCCESS(Status))
271  {
272  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
273  return FALSE;
274  }
275 
276  RtlInitUnicodeString(&KeyName, L".DEFAULT\\Keyboard Layout\\Substitutes");
278  &KeyName,
281  NULL);
282 
286  0,
287  NULL,
289  &Disposition);
290  if (!NT_SUCCESS(Status))
291  {
292  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
295  return FALSE;
296  }
297 
298  while (MuiLayouts[uIndex].LangID != NULL)
299  {
300  if (uIndex > 19) break;
301 
302  RtlStringCchPrintfW(szValueName, ARRAYSIZE(szValueName), L"%u", uIndex + 1);
303  RtlInitUnicodeString(&ValueName, szValueName);
304 
305  RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"0000%s", MuiLayouts[uIndex].LangID);
306 
307  if (_wcsicmp(szLangID, MuiLayouts[uIndex].LayoutID) == 0)
308  {
310  &ValueName,
311  0,
312  REG_SZ,
313  (PVOID)MuiLayouts[uIndex].LayoutID,
314  (wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
315  if (!NT_SUCCESS(Status))
316  {
317  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
320  return FALSE;
321  }
322  }
323  else
324  {
325  RtlStringCchPrintfW(szLangID, ARRAYSIZE(szLangID), L"d%03lu%s", uCount, MuiLayouts[uIndex].LangID);
327  &ValueName,
328  0,
329  REG_SZ,
330  (PVOID)szLangID,
331  (wcslen(szLangID)+1) * sizeof(WCHAR));
332  if (!NT_SUCCESS(Status))
333  {
334  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
337  return FALSE;
338  }
339 
340  RtlInitUnicodeString(&ValueName, szLangID);
341 
343  &ValueName,
344  0,
345  REG_SZ,
346  (PVOID)MuiLayouts[uIndex].LayoutID,
347  (wcslen(MuiLayouts[uIndex].LayoutID)+1) * sizeof(WCHAR));
348  if (!NT_SUCCESS(Status))
349  {
350  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
353  return FALSE;
354  }
355 
356  uCount++;
357  }
358 
359  uIndex++;
360  }
361 
362  if (uIndex > 1)
363  AddHotkeySettings(L"2", L"2", L"1");
364  else
365  AddHotkeySettings(L"3", L"3", L"3");
366 
369  return TRUE;
370 }
#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
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
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:122
_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
#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
_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 373 of file mui.c.

375 {
376  ULONG lngIndex = 0;
377 
378  while (MUILanguageList[lngIndex].LanguageID != NULL)
379  {
380  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
381  {
382  return AddKbLayoutsToRegistry(MUILanguageList[lngIndex].MuiLayouts);
383  }
384 
385  lngIndex++;
386  }
387 
388  return FALSE;
389 }
smooth NULL
Definition: ftsmooth.c:416
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
BOOLEAN AddKbLayoutsToRegistry(IN const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:208
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 70 of file mui.c.

72 {
73  ULONG lngIndex = 0;
74 
75  while (MUILanguageList[lngIndex].LanguageID != NULL)
76  {
77  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
78  return TRUE;
79 
80  lngIndex++;
81  }
82 
83  return FALSE;
84 }
#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 88 of file mui.c.

90 {
91  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
92  return MUILanguageList[lngIndex].MuiLayouts[0].LayoutID;
93 }
#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:44
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 104 of file mui.c.

106 {
107  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
108  return MUILanguageList[lngIndex].GeoID;
109 }
#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:44
unsigned int ULONG
Definition: retypes.h:1

Referenced by UpdateRegistry().

◆ MUIGetLayoutsList()

const MUI_LAYOUTS* MUIGetLayoutsList ( IN PCWSTR  LanguageId)

Definition at line 112 of file mui.c.

114 {
115  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
116  return MUILanguageList[lngIndex].MuiLayouts;
117 }
#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:44
unsigned int ULONG
Definition: retypes.h:1

Referenced by CreateKeyboardLayoutList(), and ProcessKeyboardLayoutRegistry().

◆ MUIGetOEMCodePage()

PCWSTR MUIGetOEMCodePage ( IN PCWSTR  LanguageId)

Definition at line 96 of file mui.c.

98 {
99  ULONG lngIndex = max(FindLanguageIndex(LanguageId), 0);
100  return MUILanguageList[lngIndex].OEMCPage;
101 }
#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:44
unsigned int ULONG
Definition: retypes.h:1

Referenced by SetConsoleCodePage().