* Load default keyboard layout (GER or US) if no other load was successfull

svn path=/trunk/; revision=6364
This commit is contained in:
Martin Fuchs 2003-10-18 21:29:26 +00:00
parent 36324e0454
commit 19ce427c77

View file

@ -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.11 2003/10/18 20:41:10 vizzini Exp $
/* $Id: keyboard.c,v 1.12 2003/10/18 21:29:26 mf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -537,9 +537,7 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
if( !NT_SUCCESS(Status) ) {
DbgPrint( "Could not get default locale (%08x).\n", Status );
return;
}
} else {
DPRINT( "DefaultLocale = %wZ\n", &DefaultLocale );
RtlInitUnicodeString(&LayoutKeyName,
@ -552,18 +550,17 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
RtlInitUnicodeString(&LayoutValueName,L"Layout File");
Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile);
RtlInitUnicodeString(&FullLayoutPath,SYSTEMROOT_DIR);
if( !NT_SUCCESS(Status) ) {
DbgPrint("Got default locale but not layout file. (%08x)\n",
Status);
return;
}
RtlFreeUnicodeString(&LayoutFile);
} else {
DPRINT("Read registry and got %wZ\n", &LayoutFile);
RtlFreeUnicodeString(&LayoutKeyName);
RtlInitUnicodeString(&FullLayoutPath,SYSTEMROOT_DIR);
ReallyAppendUnicodeString(&FullLayoutPath,&LayoutFile,FALSE);
DPRINT("Loading Keyboard DLL %wZ\n", &FullLayoutPath);
@ -579,7 +576,6 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
RtlFreeUnicodeString(&FullLayoutPath);
return;
}
memcpy(KeyboardLayoutWSTR,FullLayoutPath.Buffer,
(FullLayoutPath.Length + 1) * sizeof(WCHAR));
KeyboardLayoutWSTR[FullLayoutPath.Length] = 0;
@ -587,13 +583,28 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
kbModule = EngLoadImage(KeyboardLayoutWSTR);
DPRINT( "Load Keyboard Layout: %S\n", KeyboardLayoutWSTR );
if( !kbModule ) {
if( !kbModule )
DbgPrint( "Load Keyboard Layout: No %wZ\n", &FullLayoutPath );
RtlFreeUnicodeString(&FullLayoutPath);
return;
}
RtlFreeUnicodeString(&FullLayoutPath);
}
if( !kbModule ) {
DbgPrint("Trying to load GER Keyboard Layout\n");
kbModule = EngLoadImage(L"\\SystemRoot\\system32\\kbdgr.dll");
if( !kbModule ) {
DbgPrint("Trying to load US Keyboard Layout\n");
kbModule = EngLoadImage(L"\\SystemRoot\\system32\\kbdus.dll");
if (!kbModule) {
DbgPrint("Failed to load any Keyboard Layout\n");
return;
}
}
}
RtlInitAnsiString( &kbdProcedureName, "KbdLayerDescriptor" );
LdrGetProcedureAddress((PVOID)kbModule,