- Setting up for the User32 part of the win32k rewrite.

- Pass window handle and pointer to the current teb callback. This will allow easy and fast read access for user space programs.
- Next will be ValidateHwnd and the rest.
- https://www.microsoft.com/msj/0397/hood/hood0397.aspx
- http://www.winterdom.com/dev/ui/wnd.html
- http://www.mvps.org/user32/modal.html
- http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.kernel/2006-05/msg00522.html

svn path=/trunk/; revision=29035
This commit is contained in:
James Tabor
2007-09-14 15:34:41 +00:00
parent b0de8603f3
commit 6aa84d10f7
@@ -106,6 +106,34 @@ IntCleanupThreadCallbacks(PW32THREAD W32Thread)
}
}
//
// Pass the Current Window handle and pointer to the Client Callback.
// This will help user space programs speed up read access with the window object.
//
static VOID
IntSetTebWndCallback (HWND * hWnd, PVOID * pWnd)
{
HWND hWndS = *hWnd;
PWINDOW_OBJECT Window = UserGetWindowObject(*hWnd);
PTEB Teb = NtCurrentTeb();
*hWnd = Teb->Win32ClientInfo.hWND;
*pWnd = Teb->Win32ClientInfo.pvWND;
Teb->Win32ClientInfo.hWND = hWndS;
Teb->Win32ClientInfo.pvWND = (PVOID) Window;
}
static VOID
IntRestoreTebWndCallback (HWND hWnd, PVOID pWnd)
{
PTEB Teb = NtCurrentTeb();
Teb->Win32ClientInfo.hWND = hWnd;
Teb->Win32ClientInfo.pvWND = pWnd;
}
/* FUNCTIONS *****************************************************************/
VOID STDCALL
@@ -116,7 +144,7 @@ co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
LRESULT Result)
{
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
PVOID ResultPointer;
PVOID ResultPointer, pWnd;
ULONG ResultLength;
NTSTATUS Status;
@@ -126,6 +154,8 @@ co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
Arguments.Context = CompletionCallbackContext;
Arguments.Result = Result;
IntSetTebWndCallback (&hWnd, &pWnd);
UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_SENDASYNCPROC,
@@ -136,6 +166,8 @@ co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
UserEnterCo();
IntRestoreTebWndCallback (hWnd, pWnd);
if (!NT_SUCCESS(Status))
{
return;
@@ -155,7 +187,7 @@ co_IntCallWindowProc(WNDPROC Proc,
WINDOWPROC_CALLBACK_ARGUMENTS StackArguments;
PWINDOWPROC_CALLBACK_ARGUMENTS Arguments;
NTSTATUS Status;
PVOID ResultPointer;
PVOID ResultPointer, pWnd;
ULONG ResultLength;
ULONG ArgumentLength;
LRESULT Result;
@@ -187,6 +219,8 @@ co_IntCallWindowProc(WNDPROC Proc,
ResultPointer = NULL;
ResultLength = ArgumentLength;
IntSetTebWndCallback (&Wnd, &pWnd);
UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_WINDOWPROC,
@@ -208,6 +242,8 @@ co_IntCallWindowProc(WNDPROC Proc,
UserEnterCo();
IntRestoreTebWndCallback (Wnd, pWnd);
if (!NT_SUCCESS(Status))
{
if (0 < lParamBufferSize)