mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
If W32kGetDefaultKeyLayout() is called before a user logged on, fall back to the layout set in HKU\.DEFAULT instead of falling back to US English.
This enables the layout set in 1st stage setup also in 2nd stage setup and half-fixes bug 2952. (win32csr will only use the HKU\.DEFAULT setting as it's loaded before a user logged on. Currently, we don't change the keyboard layout for win32csr, when a user logs on). svn path=/trunk/; revision=31690
This commit is contained in:
parent
cf111d5b8d
commit
5c1602ce91
1 changed files with 22 additions and 20 deletions
|
@ -272,6 +272,7 @@ BOOL UserInitDefaultKeyboardLayout()
|
|||
PKBL W32kGetDefaultKeyLayout(VOID)
|
||||
{
|
||||
const WCHAR szKeyboardLayoutPath[] = L"\\Keyboard Layout\\Preload";
|
||||
const WCHAR szDefaultUserPath[] = L"\\REGISTRY\\USER\\.DEFAULT";
|
||||
|
||||
HANDLE KeyHandle;
|
||||
LCID LayoutLocaleId = 0;
|
||||
|
@ -290,41 +291,42 @@ PKBL W32kGetDefaultKeyLayout(VOID)
|
|||
if( NT_SUCCESS(Status) )
|
||||
{
|
||||
// FIXME: Is this 100% correct?
|
||||
// We're called very early, so \\REGISTRY\\USER might not be available yet. Check this first.
|
||||
// We're called very early, so HKEY_CURRENT_USER might not be available yet. Check this first.
|
||||
InitializeObjectAttributes(&KeyAttributes, &CurrentUserPath, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
|
||||
|
||||
if(Status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||
{
|
||||
// Fall back to US English without any debug message
|
||||
LayoutLocaleId = 0x409;
|
||||
// It is not available, so read it from HKEY_USERS\.DEFAULT
|
||||
RtlCopyMemory(wszBuffer, szDefaultUserPath, sizeof(szDefaultUserPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
// The path is available, so build the full path to HKEY_CURRENT_USER\Keyboard Layout\Preload
|
||||
// The path is available
|
||||
ZwClose(KeyHandle);
|
||||
|
||||
RtlCopyMemory(wszBuffer, CurrentUserPath.Buffer, CurrentUserPath.MaximumLength);
|
||||
RtlInitUnicodeString(&FullKeyboardLayoutPath, wszBuffer);
|
||||
FullKeyboardLayoutPath.MaximumLength = MAX_PATH;
|
||||
}
|
||||
|
||||
Status = RtlAppendUnicodeToString(&FullKeyboardLayoutPath, szKeyboardLayoutPath);
|
||||
// Build the full path
|
||||
RtlInitUnicodeString(&FullKeyboardLayoutPath, wszBuffer);
|
||||
FullKeyboardLayoutPath.MaximumLength = MAX_PATH;
|
||||
|
||||
Status = RtlAppendUnicodeToString(&FullKeyboardLayoutPath, szKeyboardLayoutPath);
|
||||
|
||||
if( NT_SUCCESS(Status) )
|
||||
{
|
||||
// Return the first keyboard layout listed there
|
||||
RtlInitUnicodeString(&LayoutValueName, L"1");
|
||||
|
||||
Status = ReadRegistryValue(&FullKeyboardLayoutPath, &LayoutValueName, &LayoutLocaleIdString);
|
||||
|
||||
if( NT_SUCCESS(Status) )
|
||||
{
|
||||
// Return the first keyboard layout listed there
|
||||
RtlInitUnicodeString(&LayoutValueName, L"1");
|
||||
|
||||
Status = ReadRegistryValue(&FullKeyboardLayoutPath, &LayoutValueName, &LayoutLocaleIdString);
|
||||
|
||||
if( NT_SUCCESS(Status) )
|
||||
RtlUnicodeStringToInteger(&LayoutLocaleIdString, 16, &LayoutLocaleId);
|
||||
else
|
||||
DPRINT1("ReadRegistryValue failed! (%08lx).\n", Status);
|
||||
}
|
||||
RtlUnicodeStringToInteger(&LayoutLocaleIdString, 16, &LayoutLocaleId);
|
||||
else
|
||||
DPRINT1("RtlAppendUnicodeToString failed! (%08lx)\n", Status);
|
||||
DPRINT1("ReadRegistryValue failed! (%08lx).\n", Status);
|
||||
}
|
||||
else
|
||||
DPRINT1("RtlAppendUnicodeToString failed! (%08lx)\n", Status);
|
||||
|
||||
RtlFreeUnicodeString(&CurrentUserPath);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue