Don't retrieve the system locale id from the registry, use ZwQueryDefaultLocale instead.

svn path=/trunk/; revision=11667
This commit is contained in:
Eric Kohl 2004-11-15 14:40:14 +00:00
parent f838190b50
commit 4d1046ee76

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -486,14 +486,15 @@ NTSTATUS STDCALL LdrGetProcedureAddress(PVOID module,
DWORD flags, DWORD flags,
PVOID *func_addr); PVOID *func_addr);
void InitKbdLayout( PVOID *pkKeyboardLayout ) { void InitKbdLayout( PVOID *pkKeyboardLayout )
UNICODE_STRING KeyName; {
UNICODE_STRING ValueName; WCHAR LocaleBuffer[16];
UNICODE_STRING LayoutKeyName; UNICODE_STRING LayoutKeyName;
UNICODE_STRING LayoutValueName; UNICODE_STRING LayoutValueName;
UNICODE_STRING DefaultLocale; UNICODE_STRING DefaultLocale;
UNICODE_STRING LayoutFile; UNICODE_STRING LayoutFile;
UNICODE_STRING FullLayoutPath; UNICODE_STRING FullLayoutPath;
LCID LocaleId;
PWCHAR KeyboardLayoutWSTR; PWCHAR KeyboardLayoutWSTR;
HMODULE kbModule = 0; HMODULE kbModule = 0;
NTSTATUS Status; NTSTATUS Status;
@ -503,20 +504,18 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
#define XX_STATUS(x) if (!NT_SUCCESS(Status = (x))) continue; #define XX_STATUS(x) if (!NT_SUCCESS(Status = (x))) continue;
do { do {
RtlInitUnicodeString(&KeyName, Status = ZwQueryDefaultLocale(FALSE, &LocaleId);
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet" if (!NT_SUCCESS(Status))
L"\\Control\\Nls\\Locale"); {
RtlInitUnicodeString(&ValueName, DPRINT1("Could not get default locale (%08lx).\n", Status);
L"(Default)"); }
else
{
DPRINT1("DefaultLocale = %lx\n", LocaleId);
DPRINT("KeyName = %wZ, ValueName = %wZ\n", &KeyName, &ValueName); swprintf(LocaleBuffer, L"%08lx", LocaleId);
DPRINT1("DefaultLocale = %S\n", LocaleBuffer);
Status = ReadRegistryValue(&KeyName,&ValueName,&DefaultLocale); RtlInitUnicodeString(&DefaultLocale, LocaleBuffer);
if( !NT_SUCCESS(Status) ) {
DPRINT1( "Could not get default locale (%08x).\n", Status );
} else {
DPRINT( "DefaultLocale = %wZ\n", &DefaultLocale );
RtlInitUnicodeString(&LayoutKeyName, RtlInitUnicodeString(&LayoutKeyName,
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet" L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet"
@ -524,7 +523,6 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
AppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE); AppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
RtlFreeUnicodeString(&DefaultLocale);
RtlInitUnicodeString(&LayoutValueName,L"Layout File"); RtlInitUnicodeString(&LayoutValueName,L"Layout File");
Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile); Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile);