ReactOS  0.4.14-dev-1332-g6db3d88
mui.c File Reference
#include "precomp.h"
#include "mui.h"
#include "muifonts.h"
#include "muilanguages.h"
#include "registry.h"
#include "substset.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 36 of file mui.c.

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

◆ AddCodepageToRegistry()

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

Definition at line 393 of file mui.c.

397 {
403 
404  // Open the nls codepage key
406  L"SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage");
408  &KeyName,
411  NULL);
413  KEY_WRITE,
415  if (!NT_SUCCESS(Status))
416  {
417  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
418  return FALSE;
419  }
420 
421  // Set ANSI codepage
424  &ValueName,
425  0,
426  REG_SZ,
427  (PVOID)ACPage,
428  (wcslen(ACPage)+1) * sizeof(WCHAR));
429  if (!NT_SUCCESS(Status))
430  {
431  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
433  return FALSE;
434  }
435 
436  // Set OEM codepage
437  RtlInitUnicodeString(&ValueName, L"OEMCP");
439  &ValueName,
440  0,
441  REG_SZ,
442  (PVOID)OEMCPage,
443  (wcslen(OEMCPage)+1) * sizeof(WCHAR));
444  if (!NT_SUCCESS(Status))
445  {
446  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
448  return FALSE;
449  }
450 
451  // Set MAC codepage
452  RtlInitUnicodeString(&ValueName, L"MACCP");
454  &ValueName,
455  0,
456  REG_SZ,
457  (PVOID)MACCPage,
458  (wcslen(MACCPage)+1) * sizeof(WCHAR));
459  if (!NT_SUCCESS(Status))
460  {
461  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
463  return FALSE;
464  }
465 
467 
468  return TRUE;
469 }
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
#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
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
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 473 of file mui.c.

475 {
481  ULONG uIndex = 0;
482 
484  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes");
486  &KeyName,
489  NULL);
491  KEY_WRITE,
493  if (!NT_SUCCESS(Status))
494  {
495  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
496  return FALSE;
497  }
498 
499  while (MuiSubFonts[uIndex].FontName != NULL)
500  {
501  RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName);
502  if (MuiSubFonts[uIndex].SubFontName)
503  {
505  &ValueName,
506  0,
507  REG_SZ,
508  (PVOID)MuiSubFonts[uIndex].SubFontName,
509  (wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR));
510  if (!NT_SUCCESS(Status))
511  {
512  DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex);
514  return FALSE;
515  }
516  }
517  else
518  {
520  if (!NT_SUCCESS(Status))
521  {
522  DPRINT1("NtDeleteValueKey failed, Status = %lx\n", Status);
523  }
524  }
525 
526  uIndex++;
527  }
528 
530 
531  return TRUE;
532 }
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
#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
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:1014
#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
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 122 of file mui.c.

126 {
133 
135  L".DEFAULT\\Keyboard Layout\\Toggle");
137  &KeyName,
140  NULL);
141 
145  0,
146  NULL,
148  &Disposition);
149  if (!NT_SUCCESS(Status))
150  {
151  DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
152  return FALSE;
153  }
154 
156  L"Hotkey");
157 
159  &ValueName,
160  0,
161  REG_SZ,
162  (PVOID)Hotkey,
163  (1 + 1) * sizeof(WCHAR));
164  if (!NT_SUCCESS(Status))
165  {
166  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
168  return FALSE;
169  }
170 
172  L"Language Hotkey");
173 
175  &ValueName,
176  0,
177  REG_SZ,
178  (PVOID)LangHotkey,
179  (1 + 1) * sizeof(WCHAR));
180  if (!NT_SUCCESS(Status))
181  {
182  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
184  return FALSE;
185  }
186 
188  L"Layout Hotkey");
189 
191  &ValueName,
192  0,
193  REG_SZ,
194  (PVOID)LayoutHotkey,
195  (1 + 1) * sizeof(WCHAR));
196  if (!NT_SUCCESS(Status))
197  {
198  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
200  return FALSE;
201  }
202 
204  return TRUE;
205 }
#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
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
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 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().

◆ FindLanguageIndex()

static ULONG FindLanguageIndex ( IN PCWSTR  LanguageId)
static

Definition at line 44 of file mui.c.

46 {
47  ULONG lngIndex = 0;
48 
49  if (LanguageId == NULL)
50  {
51  /* Default to en-US */
52  // return 0; // FIXME!!
53  LanguageId = L"00000409";
54  }
55 
56  while (MUILanguageList[lngIndex].LanguageID != NULL)
57  {
58  if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
59  {
60  return lngIndex;
61  }
62 
63  lngIndex++;
64  }
65 
66  return 0;
67 }
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 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().