Commit in reactos/subsys/win32k/ntuser on MAIN
keyboard.c+16-181.31 -> 1.32
Don't retrieve the system locale id from the registry, use ZwQueryDefaultLocale instead.

reactos/subsys/win32k/ntuser
keyboard.c 1.31 -> 1.32
diff -u -r1.31 -r1.32
--- keyboard.c	8 Jul 2004 12:55:01 -0000	1.31
+++ keyboard.c	15 Nov 2004 14:40:14 -0000	1.32
@@ -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 @@
 					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 @@
   #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 @@
 
       AppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
 
-      RtlFreeUnicodeString(&DefaultLocale);
       RtlInitUnicodeString(&LayoutValueName,L"Layout File");
 
       Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile);
CVSspam 0.2.8