Author: tretiakov
Date: Tue Feb 13 22:50:06 2007
New Revision: 25797
URL:
http://svn.reactos.org/svn/reactos?rev=25797&view=rev
Log:
- Make NtUserLoadKeyboardLayoutEx accept 6 params
- Always get default locale from ntoskrnl
- Fix some small bugs
Modified:
trunk/reactos/base/applications/testsets/user32/kbdlayout/kbdlayout.c
trunk/reactos/config.template.rbuild
trunk/reactos/dll/win32/user32/windows/input.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/include/input.h
trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
trunk/reactos/tools/nci/w32ksvc.db
Modified: trunk/reactos/base/applications/testsets/user32/kbdlayout/kbdlayout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/testsets…
==============================================================================
--- trunk/reactos/base/applications/testsets/user32/kbdlayout/kbdlayout.c (original)
+++ trunk/reactos/base/applications/testsets/user32/kbdlayout/kbdlayout.c Tue Feb 13
22:50:06 2007
@@ -332,6 +332,7 @@
case WM_INPUTLANGCHANGEREQUEST:
{
FormatMsg(L"dlg WM_INPUTLANGCHANGEREQUEST lParam=%x wParam=%x\n", lParam,
wParam);
+ UpdateData(hDlg);
return FALSE;
}
Modified: trunk/reactos/config.template.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/config.template.rbuild?rev…
==============================================================================
--- trunk/reactos/config.template.rbuild (original)
+++ trunk/reactos/config.template.rbuild Tue Feb 13 22:50:06 2007
@@ -49,6 +49,8 @@
5 = gcc -O3 with -mpreferred-stack-boundary=2
-->
<property name="OPTIMIZE" value="1" />
+
+
<!--
Whether to compile for an uniprocessor or multiprocessor machine.
-->
Modified: trunk/reactos/dll/win32/user32/windows/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/input.c (original)
+++ trunk/reactos/dll/win32/user32/windows/input.c Tue Feb 13 22:50:06 2007
@@ -300,7 +300,7 @@
{
return NtUserLoadKeyboardLayoutEx(
strtoul(pwszKLID, NULL, 16),
- Flags);
+ Flags, 0, 0, 0, 0);
}
@@ -315,7 +315,7 @@
// We will do things our own way.
return NtUserLoadKeyboardLayoutEx(
wcstoul(pwszKLID, NULL, 16),
- Flags);
+ Flags, 0, 0, 0, 0);
}
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h Tue Feb 13 22:50:06 2007
@@ -1217,10 +1217,14 @@
);
HKL
-NTAPI
-NtUserLoadKeyboardLayoutEx(
- LCID LocaleId,
- UINT Flags);
+STDCALL
+NtUserLoadKeyboardLayoutEx(
+ IN DWORD dwKLID,
+ IN UINT Flags,
+ IN DWORD Unused1,
+ IN DWORD Unused2,
+ IN DWORD Unused3,
+ IN DWORD Unused4);
BOOL
NTAPI
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/input.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/input.h Tue Feb 13 22:50:06 2007
@@ -12,7 +12,7 @@
HANDLE hModule;
ULONG RefCount;
HKL hkl;
- LCID lcid;
+ DWORD klid; // Low word - language id. High word - device id.
} KBL, *PKBL;
#define KBL_UNLOADED 0x20000000
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c Tue Feb 13 22:50:06 2007
@@ -17,7 +17,6 @@
#include <debug.h>
PKBL KBLList = NULL; // Keyboard layout list.
-PKBL DefaultKL = NULL;
typedef PVOID (*KbdLayerDescriptor)(VOID);
NTSTATUS STDCALL LdrGetProcedureAddress(PVOID module,
@@ -193,13 +192,13 @@
return TRUE;
}
-static PKBL UserLoadDllAndCreateKbl(LCID LocaleId)
+static PKBL UserLoadDllAndCreateKbl(DWORD LocaleId)
{
PKBL NewKbl;
ULONG hKl;
LANGID langid;
- NewKbl = ExAllocatePool(PagedPool, sizeof(NewKbl));
+ NewKbl = ExAllocatePool(PagedPool, sizeof(KBL));
if(!NewKbl)
{
@@ -229,7 +228,7 @@
else hKl |= hKl << 16;
NewKbl->hkl = (HKL) hKl;
- NewKbl->lcid = LocaleId;
+ NewKbl->klid = LocaleId;
NewKbl->Flags = 0;
NewKbl->RefCount = 0;
@@ -238,7 +237,6 @@
BOOL UserInitDefaultKeyboardLayout()
{
-
LCID LocaleId;
NTSTATUS Status;
@@ -252,27 +250,60 @@
DPRINT("DefaultLocale = %08lx\n", LocaleId);
}
- if(!NT_SUCCESS(Status) || !(DefaultKL = UserLoadDllAndCreateKbl(LocaleId)))
+ if(!NT_SUCCESS(Status) || !(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
{
DPRINT1("Trying to load US Keyboard Layout.\n");
LocaleId = 0x409;
- if(!(DefaultKL = UserLoadDllAndCreateKbl(LocaleId)))
+ if(!(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
{
DPRINT1("Failed to load any Keyboard Layout\n");
return FALSE;
}
}
- InitializeListHead(&DefaultKL->List);
- KBLList = DefaultKL;
+ InitializeListHead(&KBLList->List);
return TRUE;
}
-
PKBL W32kGetDefaultKeyLayout(VOID)
{
- return DefaultKL;
+ LCID LocaleId;
+ NTSTATUS Status;
+ PKBL pKbl;
+
+ // This is probably wrong...
+ // I need to do more research.
+ Status = ZwQueryDefaultLocale(FALSE, &LocaleId);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Could not get default locale (%08lx).\n", Status);
+ DPRINT1("Assuming default locale = 0x409 (US).\n");
+ LocaleId = 0x409;
+ }
+
+ pKbl = KBLList;
+ do
+ {
+ if(pKbl->klid == LocaleId)
+ {
+ return pKbl;
+ }
+
+ pKbl = (PKBL) pKbl->List.Flink;
+ } while(pKbl != KBLList);
+
+ DPRINT("Loading new default keyboard layout.\n");
+ pKbl = UserLoadDllAndCreateKbl(LocaleId);
+
+ if(!pKbl)
+ {
+ DPRINT1("Failed to load %x!!! Returning any availableKL.\n", LocaleId);
+ return KBLList;
+ }
+
+ InsertTailList(&KBLList->List, &pKbl->List);
+ return pKbl;
}
static PKBL UserHklToKbl(HKL hKl)
@@ -298,6 +329,8 @@
return Prev;
}
+
+/* EXPORTS *******************************************************************/
HKL FASTCALL
UserGetKeyboardLayout(
@@ -326,8 +359,6 @@
ObDereferenceObject(Thread);
return Ret;
}
-
-/* EXPORTS *******************************************************************/
UINT
STDCALL
@@ -408,8 +439,12 @@
HKL
STDCALL
NtUserLoadKeyboardLayoutEx(
- IN LCID LocaleId,
- IN UINT Flags)
+ IN DWORD dwKLID,
+ IN UINT Flags,
+ IN DWORD Unused1,
+ IN DWORD Unused2,
+ IN DWORD Unused3,
+ IN DWORD Unused4)
{
HKL Ret = NULL;
PKBL pKbl;
@@ -419,7 +454,7 @@
pKbl = KBLList;
do
{
- if(pKbl->lcid == LocaleId)
+ if(pKbl->klid == dwKLID)
{
Ret = pKbl->hkl;
goto the_end;
@@ -428,7 +463,13 @@
pKbl = (PKBL) pKbl->List.Flink;
} while(pKbl != KBLList);
- pKbl = UserLoadDllAndCreateKbl(LocaleId);
+ pKbl = UserLoadDllAndCreateKbl(dwKLID);
+
+ if(!pKbl)
+ {
+ goto the_end;
+ }
+
InsertTailList(&KBLList->List, &pKbl->List);
Ret = pKbl->hkl;
Modified: trunk/reactos/tools/nci/w32ksvc.db
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/nci/w32ksvc.db?rev=2…
==============================================================================
--- trunk/reactos/tools/nci/w32ksvc.db (original)
+++ trunk/reactos/tools/nci/w32ksvc.db Tue Feb 13 22:50:06 2007
@@ -428,7 +428,7 @@
NtUserIsClipboardFormatAvailable 1
NtUserKillSystemTimer 2
NtUserKillTimer 2
-NtUserLoadKeyboardLayoutEx 2
+NtUserLoadKeyboardLayoutEx 6
NtUserLockWindowStation 1
NtUserLockWindowUpdate 1
NtUserLockWorkStation 0