mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
* Load default keyboard layout (GER or US) if no other load was successfull
svn path=/trunk/; revision=6364
This commit is contained in:
parent
36324e0454
commit
19ce427c77
1 changed files with 54 additions and 43 deletions
|
@ -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.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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -537,63 +537,74 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
|
||||||
|
|
||||||
if( !NT_SUCCESS(Status) ) {
|
if( !NT_SUCCESS(Status) ) {
|
||||||
DbgPrint( "Could not get default locale (%08x).\n", Status );
|
DbgPrint( "Could not get default locale (%08x).\n", Status );
|
||||||
return;
|
} else {
|
||||||
}
|
DPRINT( "DefaultLocale = %wZ\n", &DefaultLocale );
|
||||||
|
|
||||||
DPRINT( "DefaultLocale = %wZ\n", &DefaultLocale );
|
RtlInitUnicodeString(&LayoutKeyName,
|
||||||
|
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet"
|
||||||
|
L"\\Control\\KeyboardLayouts\\");
|
||||||
|
|
||||||
|
ReallyAppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&DefaultLocale);
|
||||||
|
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);
|
||||||
|
RtlFreeUnicodeString(&LayoutFile);
|
||||||
|
} else {
|
||||||
|
DPRINT("Read registry and got %wZ\n", &LayoutFile);
|
||||||
|
|
||||||
RtlInitUnicodeString(&LayoutKeyName,
|
RtlFreeUnicodeString(&LayoutKeyName);
|
||||||
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet"
|
|
||||||
L"\\Control\\KeyboardLayouts\\");
|
|
||||||
|
|
||||||
ReallyAppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
|
ReallyAppendUnicodeString(&FullLayoutPath,&LayoutFile,FALSE);
|
||||||
|
|
||||||
RtlFreeUnicodeString(&DefaultLocale);
|
DPRINT("Loading Keyboard DLL %wZ\n", &FullLayoutPath);
|
||||||
RtlInitUnicodeString(&LayoutValueName,L"Layout File");
|
|
||||||
|
|
||||||
Status = ReadRegistryValue(&LayoutKeyName,&LayoutValueName,&LayoutFile);
|
RtlFreeUnicodeString(&LayoutFile);
|
||||||
|
|
||||||
if( !NT_SUCCESS(Status) ) {
|
KeyboardLayoutWSTR = ExAllocatePool(PagedPool,
|
||||||
DbgPrint("Got default locale but not layout file. (%08x)\n",
|
(FullLayoutPath.Length + 1) *
|
||||||
Status);
|
sizeof(WCHAR));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Read registry and got %wZ\n", &LayoutFile);
|
if( !KeyboardLayoutWSTR ) {
|
||||||
|
DbgPrint("Couldn't allocate a string for the keyboard layout name.\n");
|
||||||
RtlFreeUnicodeString(&LayoutKeyName);
|
RtlFreeUnicodeString(&FullLayoutPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memcpy(KeyboardLayoutWSTR,FullLayoutPath.Buffer,
|
||||||
|
(FullLayoutPath.Length + 1) * sizeof(WCHAR));
|
||||||
|
KeyboardLayoutWSTR[FullLayoutPath.Length] = 0;
|
||||||
|
|
||||||
RtlInitUnicodeString(&FullLayoutPath,SYSTEMROOT_DIR);
|
kbModule = EngLoadImage(KeyboardLayoutWSTR);
|
||||||
ReallyAppendUnicodeString(&FullLayoutPath,&LayoutFile,FALSE);
|
DPRINT( "Load Keyboard Layout: %S\n", KeyboardLayoutWSTR );
|
||||||
|
|
||||||
DPRINT("Loading Keyboard DLL %wZ\n", &FullLayoutPath);
|
if( !kbModule )
|
||||||
|
DbgPrint( "Load Keyboard Layout: No %wZ\n", &FullLayoutPath );
|
||||||
|
}
|
||||||
|
|
||||||
RtlFreeUnicodeString(&LayoutFile);
|
|
||||||
|
|
||||||
KeyboardLayoutWSTR = ExAllocatePool(PagedPool,
|
|
||||||
(FullLayoutPath.Length + 1) *
|
|
||||||
sizeof(WCHAR));
|
|
||||||
|
|
||||||
if( !KeyboardLayoutWSTR ) {
|
|
||||||
DbgPrint("Couldn't allocate a string for the keyboard layout name.\n");
|
|
||||||
RtlFreeUnicodeString(&FullLayoutPath);
|
RtlFreeUnicodeString(&FullLayoutPath);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(KeyboardLayoutWSTR,FullLayoutPath.Buffer,
|
|
||||||
(FullLayoutPath.Length + 1) * sizeof(WCHAR));
|
|
||||||
KeyboardLayoutWSTR[FullLayoutPath.Length] = 0;
|
|
||||||
|
|
||||||
kbModule = EngLoadImage(KeyboardLayoutWSTR);
|
|
||||||
DPRINT( "Load Keyboard Layout: %S\n", KeyboardLayoutWSTR );
|
|
||||||
|
|
||||||
if( !kbModule ) {
|
if( !kbModule ) {
|
||||||
DbgPrint( "Load Keyboard Layout: No %wZ\n", &FullLayoutPath );
|
DbgPrint("Trying to load GER Keyboard Layout\n");
|
||||||
RtlFreeUnicodeString(&FullLayoutPath);
|
kbModule = EngLoadImage(L"\\SystemRoot\\system32\\kbdgr.dll");
|
||||||
return;
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlFreeUnicodeString(&FullLayoutPath);
|
|
||||||
RtlInitAnsiString( &kbdProcedureName, "KbdLayerDescriptor" );
|
RtlInitAnsiString( &kbdProcedureName, "KbdLayerDescriptor" );
|
||||||
|
|
||||||
LdrGetProcedureAddress((PVOID)kbModule,
|
LdrGetProcedureAddress((PVOID)kbModule,
|
||||||
|
|
Loading…
Reference in a new issue