mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
- [Win32k] Implement AttachThreadInput, not yet connected to the thread message queue, update related.
- See http://www.codeproject.com/KB/cpp/onscreenkeyboard.aspx for test program. svn path=/trunk/; revision=43352
This commit is contained in:
parent
2be81fb4fb
commit
2a76c1a5a0
6 changed files with 107 additions and 22 deletions
|
@ -124,7 +124,13 @@ typedef struct _CALLBACKWND
|
|||
PVOID pvWnd;
|
||||
} CALLBACKWND, *PCALLBACKWND;
|
||||
|
||||
#define CI_CURTHPRHOOK 0x00000010
|
||||
#define CI_TRANSACTION 0x00000001
|
||||
#define CI_QUEUEMSG 0x00000002
|
||||
#define CI_WOW 0x00000004
|
||||
#define CI_INITTHREAD 0x00000008
|
||||
#define CI_CURTHPRHOOK 0x00000010
|
||||
#define CI_CLASSESREGISTERED 0x00000020
|
||||
#define CI_IMMACTIVATE 0x00000040
|
||||
|
||||
typedef struct _CLIENTINFO
|
||||
{
|
||||
|
|
|
@ -15,6 +15,15 @@ typedef struct _KBL
|
|||
DWORD klid; // Low word - language id. High word - device id.
|
||||
} KBL, *PKBL;
|
||||
|
||||
typedef struct _ATTACHINFO
|
||||
{
|
||||
struct _ATTACHINFO* paiNext;
|
||||
PTHREADINFO pti1;
|
||||
PTHREADINFO pti2;
|
||||
} ATTACHINFO, *PATTACHINFO;
|
||||
|
||||
extern PATTACHINFO gpai;
|
||||
|
||||
#define KBL_UNLOAD 1
|
||||
#define KBL_PRELOAD 2
|
||||
#define KBL_RESET 4
|
||||
|
@ -33,6 +42,7 @@ BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki);
|
|||
|
||||
BOOL UserInitDefaultKeyboardLayout();
|
||||
PKBL UserHklToKbl(HKL hKl);
|
||||
BOOL FASTCALL UserAttachThreadInput(PTHREADINFO,PTHREADINFO,BOOL);
|
||||
|
||||
#define ThreadHasInputAccess(W32Thread) \
|
||||
(TRUE)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define TAG_CALLBACK 'KCBC' /* callback memory */
|
||||
#define TAG_WINSTA 'ATSW' /* window station */
|
||||
#define TAG_PDCE 'cdsU' /* dce */
|
||||
#define TAG_ATTACHINFO 'iasU' /* Attach Info Input */
|
||||
#define TAG_INPUT 'yssU' /* Input */
|
||||
|
||||
/* gdi objects from the handle table */
|
||||
|
|
|
@ -105,10 +105,18 @@ typedef struct _THREADINFO
|
|||
PDESKTOPINFO pDeskInfo;
|
||||
PCLIENTINFO pClientInfo;
|
||||
FLONG TIF_flags;
|
||||
PUNICODE_STRING pstrAppName;
|
||||
LONG timeLast;
|
||||
ULONG_PTR idLast;
|
||||
INT exitCode;
|
||||
HANDLE hDesktop;
|
||||
UINT cPaintsReady; /* Count of paints pending. */
|
||||
UINT cTimersReady; /* Count of timers pending. */
|
||||
DWORD dwExpWinVer;
|
||||
DWORD dwCompatFlags;
|
||||
DWORD dwCompatFlags2;
|
||||
struct _USER_MESSAGE_QUEUE* pqAttach;
|
||||
PTHREADINFO ptiSibling;
|
||||
ULONG fsHooks;
|
||||
PHOOK sphkCurrent;
|
||||
LIST_ENTRY PtiLink;
|
||||
|
|
|
@ -1,23 +1,4 @@
|
|||
/*
|
||||
* ReactOS W32 Subsystem
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Window classes
|
||||
|
@ -42,6 +23,7 @@ extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread);
|
|||
|
||||
PTHREADINFO ptiRawInput;
|
||||
PKTIMER MasterTimer;
|
||||
PATTACHINFO gpai = NULL;
|
||||
|
||||
static HANDLE MouseDeviceHandle;
|
||||
static HANDLE MouseThreadHandle;
|
||||
|
@ -1324,6 +1306,57 @@ IntKeyboardInput(KEYBDINPUT *ki)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL FASTCALL
|
||||
UserAttachThreadInput( PTHREADINFO pti, PTHREADINFO ptiTo, BOOL fAttach)
|
||||
{
|
||||
PATTACHINFO pai;
|
||||
|
||||
/* Can not be the same thread.*/
|
||||
if (pti == ptiTo) return FALSE;
|
||||
|
||||
/* Do not attach if IMM is in activate mode or between different desktops. */
|
||||
if ( pti->pClientInfo->CI_flags & CI_IMMACTIVATE ||
|
||||
ptiTo->pClientInfo->CI_flags & CI_IMMACTIVATE ||
|
||||
pti->Desktop != ptiTo->Desktop )
|
||||
return FALSE;
|
||||
|
||||
/* If Attach set, allocate and link. */
|
||||
if ( fAttach )
|
||||
{
|
||||
pai = ExAllocatePoolWithTag(PagedPool, sizeof(ATTACHINFO), TAG_ATTACHINFO);
|
||||
if ( !pai ) return FALSE;
|
||||
|
||||
pai->paiNext = gpai;
|
||||
pai->pti1 = pti;
|
||||
pai->pti2 = ptiTo;
|
||||
gpai = pai;
|
||||
}
|
||||
else /* If clear, unlink and free it. */
|
||||
{
|
||||
PATTACHINFO paiprev = NULL;
|
||||
|
||||
if ( !gpai ) return FALSE;
|
||||
|
||||
pai = gpai;
|
||||
|
||||
/* Search list and free if found or return false. */
|
||||
do
|
||||
{
|
||||
if ( pai->pti2 == ptiTo && pai->pti1 == pti ) break;
|
||||
paiprev = pai;
|
||||
pai = pai->paiNext;
|
||||
} while (pai);
|
||||
|
||||
if ( !pai ) return FALSE;
|
||||
|
||||
if (paiprev) paiprev->paiNext = pai->paiNext;
|
||||
|
||||
ExFreePoolWithTag(pai, TAG_ATTACHINFO);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT
|
||||
APIENTRY
|
||||
NtUserSendInput(
|
||||
|
|
|
@ -31,9 +31,36 @@ NtUserAttachThreadInput(
|
|||
IN DWORD idAttachTo,
|
||||
IN BOOL fAttach)
|
||||
{
|
||||
UNIMPLEMENTED
|
||||
NTSTATUS Status;
|
||||
PETHREAD Thread, ThreadTo;
|
||||
PTHREADINFO pti, ptiTo;
|
||||
BOOL Ret = FALSE;
|
||||
|
||||
return 0;
|
||||
UserEnterExclusive();
|
||||
Status = PsLookupThreadByThreadId((HANDLE)idAttach, &Thread);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
goto Exit;
|
||||
}
|
||||
Status = PsLookupThreadByThreadId((HANDLE)idAttachTo, &ThreadTo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||
ObDereferenceObject(Thread);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
pti = PsGetThreadWin32Thread(Thread);
|
||||
ptiTo = PsGetThreadWin32Thread(ThreadTo);
|
||||
ObDereferenceObject(Thread);
|
||||
ObDereferenceObject(ThreadTo);
|
||||
|
||||
Ret = UserAttachThreadInput( pti, ptiTo, fAttach);
|
||||
|
||||
Exit:
|
||||
UserLeave();
|
||||
return Ret;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue