mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 12:40:33 +00:00
[NtUser]
- Use desktop thread list to search for related active desktop threads. See CORE-11983. svn path=/trunk/; revision=72699
This commit is contained in:
parent
6e3b5e1ee2
commit
cb199a866c
1 changed files with 19 additions and 13 deletions
|
@ -450,31 +450,37 @@ HKL FASTCALL
|
|||
UserGetKeyboardLayout(
|
||||
DWORD dwThreadId)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PETHREAD pThread;
|
||||
PTHREADINFO pti;
|
||||
PLIST_ENTRY ListEntry;
|
||||
PKL pKl;
|
||||
HKL hKl;
|
||||
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
|
||||
if (!dwThreadId)
|
||||
{
|
||||
pti = PsGetCurrentThreadWin32Thread();
|
||||
pKl = pti->KeyboardLayout;
|
||||
return pKl ? pKl->hkl : NULL;
|
||||
}
|
||||
|
||||
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &pThread);
|
||||
if (!NT_SUCCESS(Status))
|
||||
ListEntry = pti->rpdesk->PtiList.Flink;
|
||||
|
||||
//
|
||||
// Search the Desktop Thread list for related Desktop active Threads.
|
||||
//
|
||||
while(ListEntry != &pti->rpdesk->PtiList)
|
||||
{
|
||||
EngSetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
pti = CONTAINING_RECORD(ListEntry, THREADINFO, PtiLink);
|
||||
|
||||
if (PsGetThreadId(pti->pEThread) == UlongToHandle(dwThreadId))
|
||||
{
|
||||
pKl = pti->KeyboardLayout;
|
||||
return pKl ? pKl->hkl : NULL;
|
||||
}
|
||||
|
||||
ListEntry = ListEntry->Flink;
|
||||
}
|
||||
|
||||
pti = PsGetThreadWin32Thread(pThread);
|
||||
pKl = pti->KeyboardLayout;
|
||||
hKl = pKl ? pKl->hkl : NULL;
|
||||
ObDereferenceObject(pThread);
|
||||
return hKl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue