Author: jimtabor
Date: Fri Sep 14 19:34:41 2007
New Revision: 29035
URL:
http://svn.reactos.org/svn/reactos?rev=29035&view=rev
Log:
- 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.prog…
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c Fri Sep 14 19:34:41 2007
@@ -106,6 +106,34 @@
}
}
+
+//
+// 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 @@
LRESULT Result)
{
SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
- PVOID ResultPointer;
+ PVOID ResultPointer, pWnd;
ULONG ResultLength;
NTSTATUS Status;
@@ -126,6 +154,8 @@
Arguments.Context = CompletionCallbackContext;
Arguments.Result = Result;
+ IntSetTebWndCallback (&hWnd, &pWnd);
+
UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_SENDASYNCPROC,
@@ -135,6 +165,8 @@
&ResultLength);
UserEnterCo();
+
+ IntRestoreTebWndCallback (hWnd, pWnd);
if (!NT_SUCCESS(Status))
{
@@ -155,7 +187,7 @@
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 @@
ResultPointer = NULL;
ResultLength = ArgumentLength;
+ IntSetTebWndCallback (&Wnd, &pWnd);
+
UserLeaveCo();
Status = KeUserModeCallback(USER32_CALLBACK_WINDOWPROC,
@@ -207,6 +241,8 @@
_SEH_END;
UserEnterCo();
+
+ IntRestoreTebWndCallback (Wnd, pWnd);
if (!NT_SUCCESS(Status))
{