ReactOS  0.4.14-dev-57-g333b8f1
mui.c File Reference
#include "precomp.h"
#include "mui.h"
#include "muifonts.h"
#include "muilanguages.h"
#include "registry.h"
#include <debug.h>
Include dependency graph for mui.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static ULONG FindLanguageIndex (IN PCWSTR LanguageId)
 
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)
 
static BOOLEAN AddHotkeySettings (IN PCWSTR Hotkey, IN PCWSTR LangHotkey, IN PCWSTR LayoutHotkey)
 
BOOLEAN AddKbLayoutsToRegistry (IN const MUI_LAYOUTS *MuiLayouts)
 
BOOLEAN AddKeyboardLayouts (IN PCWSTR LanguageId)
 
static BOOLEAN AddCodepageToRegistry (IN PCWSTR ACPage, IN PCWSTR OEMCPage, IN PCWSTR MACCPage)
 
static BOOLEAN AddFontsSettingsToRegistry (IN const MUI_SUBFONT *MuiSubFonts)
 
BOOLEAN AddCodePage (IN PCWSTR LanguageId)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 35 of file mui.c.

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().

◆ AddCodepageToRegistry()

static BOOLEAN AddCodepageToRegistry ( IN PCWSTR  ACPage,
IN PCWSTR  OEMCPage,
IN PCWSTR  MACCPage 
)
static

Definition at line 392 of file mui.c.

396 {
402 
403  // Open the nls codepage key
405  L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage");
407  &KeyName,
410  NULL);
412  KEY_WRITE,
414  if (!NT_SUCCESS(Status))
415  {
416  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
417  return FALSE;
418  }
419 
420  // Set ANSI codepage
423  &ValueName,
424  0,
425  REG_SZ,
426  (PVOID)ACPage,
427  (wcslen(ACPage)+1) * sizeof(WCHAR));
428  if (!NT_SUCCESS(Status))
429  {
430  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
432  return FALSE;
433  }
434 
435  // Set OEM codepage
436  RtlInitUnicodeString(&ValueName, L"OEMCP");
438  &ValueName,
439  0,
440  REG_SZ,
441  (PVOID)OEMCPage,
442  (wcslen(OEMCPage)+1) * sizeof(WCHAR));
443  if (!NT_SUCCESS(Status))
444  {
445  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
447  return FALSE;
448  }
449 
450  // Set MAC codepage
451  RtlInitUnicodeString(&ValueName, L"MACCP");
453  &ValueName,
454  0,
455  REG_SZ,
456  (PVOID)MACCPage,
457  (wcslen(MACCPage)+1) * sizeof(WCHAR));
458  if (!NT_SUCCESS(Status))
459  {
460  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
462  return FALSE;
463  }
464 
466 
467  return TRUE;
468 }
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
_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
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
__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
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
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by AddCodePage().

◆ AddFontsSettingsToRegistry()

static BOOLEAN AddFontsSettingsToRegistry ( IN const MUI_SUBFONT MuiSubFonts)
static

Definition at line 472 of file mui.c.

474 {
480  ULONG uIndex = 0;
481 
483  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes");
485  &KeyName,
488  NULL);
490  KEY_WRITE,
492  if (!NT_SUCCESS(Status))
493  {
494  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
495  return FALSE;
496  }
497 
498  while (MuiSubFonts[uIndex].FontName != NULL)
499  {
500  RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName);
502  &ValueName,
503  0,
504  REG_SZ,
505  (PVOID)MuiSubFonts[uIndex].SubFontName,
506  (wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR));
507  if (!NT_SUCCESS(Status))
508  {
509  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
511  return FALSE;
512  }
513 
514  uIndex++;
515  }
516 
518 
519  return TRUE;
520 }
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
_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
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
__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
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
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
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
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by AddCodePage().

◆ AddHotkeySettings()

static BOOLEAN AddHotkeySettings ( IN PCWSTR  Hotkey,
IN PCWSTR  LangHotkey,
IN PCWSTR  LayoutHotkey 
)
static

Definition at line 121 of file mui.c.

125 {
132 
134  L".DEFAULT\\Keyboard Layout\\Toggle");
136  &KeyName,
139  NULL);
140 
144  0,
145  NULL,
147  &Disposition);
148  if (!NT_SUCCESS(Status))
149  {
150  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
151  return FALSE;
152  }
153 
155  L"Hotkey");
156 
158  &ValueName,
159  0,
160  REG_SZ,
161  (PVOID)Hotkey,
162  (1 + 1) * sizeof(WCHAR));
163  if (!NT_SUCCESS(Status))
164  {
165  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
167  return FALSE;
168  }
169 
171  L"Language Hotkey");
172 
174  &ValueName,
175  0,
176  REG_SZ,
177  (PVOID)LangHotkey,
178  (1 + 1) * sizeof(WCHAR));
179  if (!NT_SUCCESS(Status))
180  {
181  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
183  return FALSE;
184  }
185 
187  L"Layout Hotkey");
188 
190  &ValueName,
191  0,
192  REG_SZ,
193  (PVOID)LayoutHotkey,
194  (1 + 1) * sizeof(WCHAR));
195  if (!NT_SUCCESS(Status))
196  {
197  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
199  return FALSE;
200  }
201 
203  return TRUE;
204 }
#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
_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
__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
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 REG_SZ
Definition: layer.c:22

Referenced by AddKbLayoutsToRegistry().

◆ 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
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: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
#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().

◆ FindLanguageIndex()

static ULONG FindLanguageIndex ( IN PCWSTR  LanguageId)
static

Definition at line 43 of file mui.c.

45 {
46  ULONG lngIndex = 0;
47 
48  if (LanguageId == NULL)
49  {
50  /* Default to en-US */
51  // return 0; // FIXME!!
52  LanguageId = L"00000409";
53  }
54 
55  while (MUILanguageList[lngIndex].LanguageID != NULL)
56  {
57  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
58  {
59  return lngIndex;
60  }
61 
62  lngIndex++;
63  }
64 
65  return 0;
66 }
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
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 MUIDefaultKeyboardLayout(), MUIGetGeoID(), MUIGetLayoutsList(), and MUIGetOEMCodePage().

◆ 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().