40 pFirstKL = pti->KeyboardLayout;
54 }
while (pKL != pFirstKL);
63 }
while (pKL != pFirstKL);
74 }
while (pKL != pFirstKL);
85 }
while (pKL != pFirstKL);
105 if (!pWinSta || !pFirstKL)
118 }
while (pKL != pFirstKL);
127 *pHklBuff = pKL->
hkl;
136 }
while (pKL != pFirstKL);
153 DbgPrint(
"Kbd layout: fLocaleFlags %x bMaxVSCtoVK %x\n",
154 pKbdTbl->fLocaleFlags, pKbdTbl->bMaxVSCtoVK);
156 pKbdTbl->pCharModifiers ? pKbdTbl->pCharModifiers->wMaxModBits
159 if (pKbdTbl->pCharModifiers)
161 pVkToBit = pKbdTbl->pCharModifiers->pVkToBit;
164 for (; pVkToBit->
Vk; ++pVkToBit)
170 for (
i = 0;
i <= pKbdTbl->pCharModifiers->wMaxModBits; ++
i)
172 DbgPrint(
"ModNumber %x -> %x\n",
i, pKbdTbl->pCharModifiers->ModNumber[
i]);
176 pVkToWchTbl = pKbdTbl->pVkToWcharTable;
181 PVK_TO_WCHARS1 pVkToWch = pVkToWchTbl->
pVkToWchars;
183 DbgPrint(
"pVkToWchTbl nModifications %x cbSize %x\n",
187 while (pVkToWch->VirtualKey)
189 DbgPrint(
"pVkToWch VirtualKey %x Attributes %x wc { ",
190 pVkToWch->VirtualKey, pVkToWch->Attributes);
196 pVkToWch = (PVK_TO_WCHARS1)(((
PBYTE)pVkToWch) + pVkToWchTbl->
cbSize);
205 if (pKbdTbl->pusVSCtoVK)
207 for (
i = 0;
i < pKbdTbl->bMaxVSCtoVK; ++
i)
209 DbgPrint(
"%x -> %x, ",
i, pKbdTbl->pusVSCtoVK[
i]);
215 pVscVk = pKbdTbl->pVSCtoVK_E0;
218 for (; pVscVk->
Vsc; ++pVscVk)
226 pVscVk = pKbdTbl->pVSCtoVK_E1;
229 for (; pVscVk->
Vsc; ++pVscVk)
255 TRACE(
"Loading Keyboard DLL %ws\n", pwszLayoutPath);
259 ERR(
"Failed to load dll %ws\n", pwszLayoutPath);
264 TRACE(
"Loaded %ws\n", pwszLayoutPath);
270 if (pfnKbdLayerDescriptor)
271 *pKbdTables = pfnKbdLayerDescriptor();
273 ERR(
"Error: %ws has no KbdLayerDescriptor()\n", pwszLayoutPath);
275 if (!pfnKbdLayerDescriptor || !*pKbdTables)
277 ERR(
"Failed to load the keyboard layout.\n");
284 DumpKbdLayout(*pKbdTables);
303 WCHAR wszLayoutRegKey[256] =
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet\\"
304 L"Control\\Keyboard Layouts\\";
310 ERR(
"Failed to create object!\n");
322 ERR(
"Failed to open keyboard layouts registry key %ws (%lx)\n", wszLayoutRegKey,
Status);
327 cbSize = (
ULONG)(
sizeof(wszLayoutPath) -
wcslen(wszLayoutPath)*
sizeof(
WCHAR));
331 wszLayoutPath +
wcslen(wszLayoutPath),
336 ERR(
"Can't get layout filename for %wZ (%lx)\n", pwszKLID,
Status);
343 ERR(
"Failed to load %ws dll!\n", wszLayoutPath);
385 ERR(
"Failed to create object!\n");
398 ERR(
"UserLoadKbdFile(%wZ) failed!\n", pustrKLID);
406 ERR(
"RtlUnicodeStringToInteger failed for '%wZ'\n", pustrKLID);
411 TRACE(
"Language Identifiers %wZ LCID 0x%x\n", pustrKLID, lCid);
417 TRACE(
"Charset %u Font Sig %lu CodePage %u\n",
452 if (*ppkfLink == pkf)
455 ppkfLink = &(*ppkfLink)->
pkfNext;
458 if (*ppkfLink == pkf)
564 if ((pWinSta->Flags &
WSS_NOIO) || pNewKL == pOldKL)
567 pNewKL->
pklPrev->pklNext = pNewKL->pklNext;
568 pNewKL->pklNext->pklPrev = pNewKL->pklPrev;
569 pNewKL->pklNext = pOldKL;
571 pOldKL->
pklPrev->pklNext = pNewKL;
604 if (pti->KeyboardLayout == pKL)
607 pImeWnd = pti->spwndDefaultIme;
618 pti->hklPrev = pti->KeyboardLayout->hkl;
620 if (pti->spDefaultImc)
628 pti->pClientInfo->hKL = pKL->hkl;
629 pti->pClientInfo->CodePage = pKL->CodePage;
638 for (ptiNode = ppi->
ptiList; ptiNode; ptiNode = ptiNext)
659 pClientInfo->
hKL = pKL->
hkl;
675 PWND pTargetWnd, pImeWnd;
676 HWND hTargetWnd, hImeWnd;
686 hOldKL = pOldKL->
hkl;
690 FIXME(
"KLF_RESET\n");
710 else if (bSetForProcess)
794 ERR(
"Invalid HKL %p!\n", hKL);
857 ERR(
"Invalid HKL %p!\n", hKL);
901 if (hOldKL && hOldKL != hNewKL)
929 pNewKL->
pklNext->pklPrev = pNewKL;
930 pNewKL->
pklPrev->pklNext = pNewKL;
1010 ListEntry = pti->
rpdesk->PtiList.Flink;
1015 while(ListEntry != &pti->
rpdesk->PtiList)
1025 ListEntry = ListEntry->
Flink;
1112 ustrNameSafe = *pustrName;
1135 *pustrName = ustrNameSafe;
1181 KLF_RESET|KLF_SHIFTLOCK))
1188 RtlInitEmptyUnicodeString(&uszSafeKLID,
Buffer,
sizeof(
Buffer));
1192 ProbeForRead(puszKLID->Buffer,
sizeof(puszKLID->Length), 1);
#define UlongToHandle(ul)
#define DBG_DEFAULT_CHANNEL(ch)
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
static void cleanup(void)
#define ExAllocatePoolWithTag(hernya, size, tag)
NTSTATUS RtlAppendUnicodeToString(IN PUNICODE_STRING Str1, IN PWSTR Str2)
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define ISITHOOKED(HookId)
#define IMS_ACTIVATELAYOUT
#define IMS_SENDNOTIFICATION
#define EXCEPTION_EXECUTE_HANDLER
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define UserHMGetHandle(obj)
struct _THREADINFO * GetW32ThreadInfo(VOID)
#define ExFreePoolWithTag(_P, _T)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
#define UNREFERENCED_PARAMETER(P)
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
NTSTRSAFEAPI RtlStringCbCatW(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
PWINSTATION_OBJECT FASTCALL IntGetProcessWindowStation(HWINSTA *phWinSta OPTIONAL)
VOID FASTCALL UserLeave(VOID)
VOID FASTCALL UserEnterShared(VOID)
VOID FASTCALL UserEnterExclusive(VOID)
static __inline VOID UserDerefObjectCo(PVOID obj)
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define ProbeForWriteUnicodeString(Ptr)
struct _LIST_ENTRY * Flink
struct _CLIENTINFO * pClientInfo
struct tagKL * KeyboardLayout
struct _WND * spwndDefaultIme
struct _USER_MESSAGE_QUEUE * MessageQueue
PVK_TO_WCHARS1 pVkToWchars
struct _KBDTABLES * pKbdTbl
struct tagKBDFILE * pkfNext
#define CONTAINING_RECORD(address, type, field)
#define UKL_NOACTIVATENEXT
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
#define IntDereferenceThreadInfo(pti)
#define IntReferenceThreadInfo(pti)
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
BOOL APIENTRY co_IntGetCharsetInfo(LCID Locale, PCHARSETINFO pCs)
BOOL APIENTRY co_ClientImmLoadLayout(_In_ HKL hKL, _Inout_ PIMEINFOEX pImeInfoEx)
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
PTHREADINFO gptiForeground
UINT APIENTRY NtUserGetKeyboardLayoutList(ULONG nBuff, HKL *pHklBuff)
static BOOL APIENTRY co_IntUnloadKeyboardLayoutEx(_Inout_ PWINSTATION_OBJECT pWinSta, _Inout_ PKL pKL, _In_ DWORD dwFlags)
static UINT APIENTRY IntGetKeyboardLayoutList(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ ULONG nBuff, _Out_ HKL *pHklBuff)
HKL NTAPI NtUserActivateKeyboardLayout(HKL hKL, ULONG Flags)
static BOOL UserLoadKbdDll(WCHAR *pwszLayoutPath, HANDLE *phModule, PKBDTABLES *pKbdTables)
VOID FASTCALL IntReorderKeyboardLayouts(_Inout_ PWINSTATION_OBJECT pWinSta, _Inout_ PKL pNewKL)
VOID APIENTRY IntImmActivateLayout(_Inout_ PTHREADINFO pti, _Inout_ PKL pKL)
static BOOL APIENTRY IntUnloadKeyboardLayout(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ HKL hKL)
PKL NTAPI UserHklToKbl(HKL hKl)
PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
HKL APIENTRY co_UserActivateKeyboardLayout(_Inout_ PKL pKL, _In_ ULONG uFlags, _In_opt_ PWND pWnd)
static PKL co_UserLoadKbdLayout(PUNICODE_STRING pustrKLID, HKL hKL)
BOOL UserUnloadKbl(PKL pKl)
PVOID(* PFN_KBDLAYERDESCRIPTOR)(VOID)
PIMEINFOEX FASTCALL co_UserImmLoadLayout(_In_ HKL hKL)
Invokes imm32!ImmLoadLayout and returns PIMEINFOEX.
static VOID UnloadKbdFile(_In_ PKBDFILE pkf)
HKL APIENTRY co_IntLoadKeyboardLayoutEx(IN OUT PWINSTATION_OBJECT pWinSta, IN HANDLE hSafeFile, IN HKL hOldKL, IN PUNICODE_STRING puszSafeKLID, IN HKL hNewKL, IN UINT Flags)
HKL APIENTRY co_IntActivateKeyboardLayout(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ HKL hKL, _In_ ULONG uFlags, _In_opt_ PWND pWnd)
BOOL APIENTRY NtUserUnloadKeyboardLayout(HKL hKl)
BOOL APIENTRY NtUserGetKeyboardLayoutName(_Inout_ PUNICODE_STRING pustrName)
HKL FASTCALL UserGetKeyboardLayout(DWORD dwThreadId)
static VOID co_IntSetKeyboardLayoutForProcess(PPROCESSINFO ppi, PKL pKL)
PKL W32kGetDefaultKeyLayout(VOID)
HANDLE FASTCALL IntVerifyKeyboardFileHandle(HANDLE hFile)
HKL NTAPI NtUserLoadKeyboardLayoutEx(IN HANDLE hFile, IN DWORD offTable, IN PVOID pTables, IN HKL hOldKL, IN PUNICODE_STRING puszKLID, IN DWORD dwNewKL, IN UINT Flags)
BOOL NTAPI UserSetDefaultInputLang(HKL hKl)
static PKBDFILE UserLoadKbdFile(PUNICODE_STRING pwszKLID)
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
BOOL FASTCALL UserDereferenceObject(PVOID Object)
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
PUSER_HANDLE_TABLE gHandleTable
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
ENGAPI PVOID APIENTRY EngFindImageProcAddress(_In_ HANDLE hModule, _In_ LPSTR lpProcName)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
ENGAPI VOID APIENTRY EngUnloadImage(_In_ HANDLE hModule)
ENGAPI HANDLE APIENTRY EngLoadImage(_In_ LPWSTR pwszDriver)
#define ERROR_INVALID_FLAGS
#define KLF_SETFORPROCESS
#define KLF_SUBSTITUTE_OK
#define KLF_UNLOADPREVIOUS
_Must_inspect_result_ _In_ ULONG Flags
#define ObDereferenceObject