ReactOS 0.4.15-dev-7842-g558ab78
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
 

Typedefs

typedef USHORT LANGID
 
typedef ULONG KLID
 
typedef ULONG GEOID
 

Functions

BOOLEAN IsLanguageAvailable (IN PCWSTR LanguageId)
 
KLID MUIDefaultKeyboardLayout (IN PCWSTR LanguageId)
 
UINT MUIGetOEMCodePage (IN PCWSTR LanguageId)
 
GEOID 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)
 

Typedef Documentation

◆ GEOID

typedef ULONG GEOID

Definition at line 28 of file mui.h.

◆ KLID

typedef ULONG KLID

Definition at line 10 of file mui.h.

◆ LANGID

static LANGID

Definition at line 9 of file mui.h.

Function Documentation

◆ AddCodePage()

BOOLEAN AddCodePage ( IN PCWSTR  LanguageId)

Definition at line 534 of file mui.c.

536{
537 ULONG lngIndex = 0;
538
539 while (MUILanguageList[lngIndex].LanguageID != NULL)
540 {
541 if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
542 {
543 if (AddCodepageToRegistry(MUILanguageList[lngIndex].ACPage,
544 MUILanguageList[lngIndex].OEMCPage,
545 MUILanguageList[lngIndex].MACCPage) &&
546 AddFontsSettingsToRegistry(MUILanguageList[lngIndex].MuiSubFonts))
547 {
548 return TRUE;
549 }
550 else
551 {
552 return FALSE;
553 }
554 }
555
556 lngIndex++;
557 }
558
559 return FALSE;
560}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOLEAN AddFontsSettingsToRegistry(IN const MUI_SUBFONT *MuiSubFonts)
Definition: mui.c:472
static BOOLEAN AddCodepageToRegistry(_In_ UINT ACPage, _In_ UINT OEMCPage, _In_ UINT MACCPage)
Definition: mui.c:382
const MUI_LANGUAGE MUILanguageList[]
Definition: muilanguages.h:412
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
uint32_t ULONG
Definition: typedefs.h:59

Referenced by UpdateRegistry().

◆ AddKbLayoutsToRegistry()

BOOLEAN AddKbLayoutsToRegistry ( _In_ const MUI_LAYOUTS MuiLayouts)

Definition at line 208 of file mui.c.

210{
218 ULONG uIndex;
219 ULONG uCount;
220 WCHAR szKeyName[48] = L".DEFAULT\\Keyboard Layout";
221 WCHAR szValueName[3 + 1];
222 WCHAR szSubstID[8 + 1];
223 WCHAR szLayoutID[8 + 1];
224
225 /* Open the keyboard layout key */
226 RtlInitUnicodeString(&KeyName, szKeyName);
228 &KeyName,
231 NULL);
232
236 0,
237 NULL,
239 &Disposition);
240 if (!NT_SUCCESS(Status))
241 {
242 DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
243 return FALSE;
244 }
245
247
248 KeyName.MaximumLength = sizeof(szKeyName);
250 if (!NT_SUCCESS(Status))
251 {
252 DPRINT1("RtlAppend() failed (%lx), string is '%wZ'\n", Status, &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);
292 goto Quit;
293 }
294
295 uCount = 0;
296 for (uIndex = 0; (uIndex <= 19) && (MuiLayouts[uIndex].LangID != 0); ++uIndex)
297 {
298 RtlStringCchPrintfW(szValueName, _countof(szValueName), L"%u", uIndex + 1);
299 RtlInitUnicodeString(&ValueName, szValueName);
300
301 RtlStringCchPrintfW(szLayoutID, _countof(szLayoutID), L"%08lx", MuiLayouts[uIndex].LayoutID);
302
303 if ((KLID)MuiLayouts[uIndex].LangID == MuiLayouts[uIndex].LayoutID)
304 {
305 /* Main keyboard layout */
307 &ValueName,
308 0,
309 REG_SZ,
310 (PVOID)szLayoutID,
311 (wcslen(szLayoutID)+1) * sizeof(WCHAR));
312 if (!NT_SUCCESS(Status))
313 {
314 DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
315 goto Quit;
316 }
317 }
318 else
319 {
320 /* Generate a substitute keyboard layout ID */
321 RtlStringCchPrintfW(szSubstID, _countof(szSubstID), L"%08lx",
322 (0xD0000000/*SUBST_MASK*/ | ((USHORT)uCount << 4) | MuiLayouts[uIndex].LangID));
324 &ValueName,
325 0,
326 REG_SZ,
327 (PVOID)szSubstID,
328 (wcslen(szSubstID)+1) * sizeof(WCHAR));
329 if (!NT_SUCCESS(Status))
330 {
331 DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
332 goto Quit;
333 }
334
335 /* Link the substitute layout with the original one */
336 RtlInitUnicodeString(&ValueName, szSubstID);
338 &ValueName,
339 0,
340 REG_SZ,
341 (PVOID)szLayoutID,
342 (wcslen(szLayoutID)+1) * sizeof(WCHAR));
343 if (!NT_SUCCESS(Status))
344 {
345 DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %u)\n", Status, uIndex);
346 goto Quit;
347 }
348
349 ++uCount;
350 }
351 }
352
353 AddHotkeySettings(L"1", L"1", L"2");
354
355Quit:
358 return NT_SUCCESS(Status);
359}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
Definition: string_lib.cpp:62
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define REG_SZ
Definition: layer.c:22
static BOOLEAN AddHotkeySettings(IN PCWSTR Hotkey, IN PCWSTR LangHotkey, IN PCWSTR LayoutHotkey)
Definition: mui.c:122
ULONG KLID
Definition: mui.h:10
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING _Out_ PNDIS_HANDLE SubKeyHandle
Definition: ndis.h:4726
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
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
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define KEY_SET_VALUE
Definition: nt_native.h:1017
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
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
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define _countof(array)
Definition: sndvol32.h:68
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
#define HKEY_USERS
Definition: winreg.h:13
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by AddKeyboardLayouts(), and ProcessKeyboardLayoutRegistry().

◆ AddKeyboardLayouts()

BOOLEAN AddKeyboardLayouts ( IN PCWSTR  LanguageId)

Definition at line 362 of file mui.c.

364{
365 ULONG lngIndex = 0;
366
367 while (MUILanguageList[lngIndex].LanguageID != NULL)
368 {
369 if (_wcsicmp(MUILanguageList[lngIndex].LanguageID, LanguageId) == 0)
370 {
371 return AddKbLayoutsToRegistry(MUILanguageList[lngIndex].MuiLayouts);
372 }
373
374 lngIndex++;
375 }
376
377 return FALSE;
378}
BOOLEAN AddKbLayoutsToRegistry(_In_ const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:208

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}

Referenced by ProcessLangEntry().

◆ MUIDefaultKeyboardLayout()

KLID MUIDefaultKeyboardLayout ( IN PCWSTR  LanguageId)

Definition at line 88 of file mui.c.

90{
91 ULONG lngIndex = FindLanguageIndex(LanguageId);
92 return MUILanguageList[lngIndex].MuiLayouts[0].LayoutID;
93}
static ULONG FindLanguageIndex(IN PCWSTR LanguageId)
Definition: mui.c:44
const MUI_LAYOUTS * MuiLayouts
Definition: mui.h:39
KLID LayoutID
Definition: mui.h:25

Referenced by UpdateKBLayout().

◆ MUIGetGeoID()

GEOID MUIGetGeoID ( IN PCWSTR  LanguageId)

Definition at line 104 of file mui.c.

106{
107 ULONG lngIndex = FindLanguageIndex(LanguageId);
108 return MUILanguageList[lngIndex].GeoID;
109}
GEOID GeoID
Definition: mui.h:37

Referenced by UpdateRegistry().

◆ MUIGetLayoutsList()

const MUI_LAYOUTS * MUIGetLayoutsList ( IN PCWSTR  LanguageId)

Definition at line 112 of file mui.c.

114{
115 ULONG lngIndex = FindLanguageIndex(LanguageId);
116 return MUILanguageList[lngIndex].MuiLayouts;
117}

Referenced by CreateKeyboardLayoutList(), and ProcessKeyboardLayoutRegistry().

◆ MUIGetOEMCodePage()

UINT MUIGetOEMCodePage ( IN PCWSTR  LanguageId)

Definition at line 96 of file mui.c.

98{
99 ULONG lngIndex = FindLanguageIndex(LanguageId);
100 return MUILanguageList[lngIndex].OEMCPage;
101}
UINT OEMCPage
Definition: mui.h:34

Referenced by SetConsoleCodePage().