From 4d1046ee76da8bbb5d896fb3c9ab58e721726672 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 15 Nov 2004 14:40:14 +0000 Subject: [PATCH] Don't retrieve the system locale id from the registry, use ZwQueryDefaultLocale instead. svn path=/trunk/; revision=11667 --- reactos/subsys/win32k/ntuser/keyboard.c | 34 ++++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/reactos/subsys/win32k/ntuser/keyboard.c b/reactos/subsys/win32k/ntuser/keyboard.c index 6215ca72ec1..4c49415e96e 100644 --- a/reactos/subsys/win32k/ntuser/keyboard.c +++ b/reactos/subsys/win32k/ntuser/keyboard.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: keyboard.c,v 1.31 2004/07/08 12:55:01 navaraf Exp $ +/* $Id: keyboard.c,v 1.32 2004/11/15 14:40:14 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -486,14 +486,15 @@ NTSTATUS STDCALL LdrGetProcedureAddress(PVOID module, DWORD flags, PVOID *func_addr); -void InitKbdLayout( PVOID *pkKeyboardLayout ) { - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; +void InitKbdLayout( PVOID *pkKeyboardLayout ) +{ + WCHAR LocaleBuffer[16]; UNICODE_STRING LayoutKeyName; UNICODE_STRING LayoutValueName; UNICODE_STRING DefaultLocale; UNICODE_STRING LayoutFile; UNICODE_STRING FullLayoutPath; + LCID LocaleId; PWCHAR KeyboardLayoutWSTR; HMODULE kbModule = 0; NTSTATUS Status; @@ -503,20 +504,18 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) { #define XX_STATUS(x) if (!NT_SUCCESS(Status = (x))) continue; do { - RtlInitUnicodeString(&KeyName, - L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet" - L"\\Control\\Nls\\Locale"); - RtlInitUnicodeString(&ValueName, - L"(Default)"); - - DPRINT("KeyName = %wZ, ValueName = %wZ\n", &KeyName, &ValueName); + Status = ZwQueryDefaultLocale(FALSE, &LocaleId); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Could not get default locale (%08lx).\n", Status); + } + else + { + DPRINT1("DefaultLocale = %lx\n", LocaleId); - Status = ReadRegistryValue(&KeyName,&ValueName,&DefaultLocale); - - if( !NT_SUCCESS(Status) ) { - DPRINT1( "Could not get default locale (%08x).\n", Status ); - } else { - DPRINT( "DefaultLocale = %wZ\n", &DefaultLocale ); + swprintf(LocaleBuffer, L"%08lx", LocaleId); + DPRINT1("DefaultLocale = %S\n", LocaleBuffer); + RtlInitUnicodeString(&DefaultLocale, LocaleBuffer); RtlInitUnicodeString(&LayoutKeyName, L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet" @@ -524,7 +523,6 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) { AppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE); - RtlFreeUnicodeString(&DefaultLocale); RtlInitUnicodeString(&LayoutValueName,L"Layout File"); Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile);