[ros-diffs] [tkreuzer] 36769: Win32 structure cleanup part 1 / x: - replace W32THREAD with THREADINFO, define W32THREAD like it's on Windows and make it part of THREADINFO.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Oct 16 19:52:39 CEST 2008


Author: tkreuzer
Date: Thu Oct 16 12:52:38 2008
New Revision: 36769

URL: http://svn.reactos.org/svn/reactos?rev=36769&view=rev
Log:
Win32 structure cleanup part 1 / x:
- replace W32THREAD with THREADINFO, define W32THREAD like it's on Windows and make it part of THREADINFO.

Modified:
    trunk/reactos/subsystems/win32/win32k/include/callback.h
    trunk/reactos/subsystems/win32/win32k/include/caret.h
    trunk/reactos/subsystems/win32/win32k/include/desktop.h
    trunk/reactos/subsystems/win32/win32k/include/hook.h
    trunk/reactos/subsystems/win32/win32k/include/input.h
    trunk/reactos/subsystems/win32/win32k/include/object.h
    trunk/reactos/subsystems/win32/win32k/include/painting.h
    trunk/reactos/subsystems/win32/win32k/include/win32.h
    trunk/reactos/subsystems/win32/win32k/main/dllmain.c
    trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
    trunk/reactos/subsystems/win32/win32k/ntuser/caret.c
    trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
    trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
    trunk/reactos/subsystems/win32/win32k/ntuser/event.c
    trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
    trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
    trunk/reactos/subsystems/win32/win32k/ntuser/input.c
    trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
    trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
    trunk/reactos/subsystems/win32/win32k/ntuser/message.c
    trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
    trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
    trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
    trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
    trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
    trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
    trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c
    trunk/reactos/subsystems/win32/win32k/ntuser/window.c
    trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
    trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
    trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c

Modified: trunk/reactos/subsystems/win32/win32k/include/callback.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/callback.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/callback.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/callback.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -46,7 +46,7 @@
                      WINEVENTPROC Proc);
 
 VOID FASTCALL
-IntCleanupThreadCallbacks(PW32THREAD W32Thread);
+IntCleanupThreadCallbacks(PTHREADINFO W32Thread);
 
 PVOID FASTCALL
 IntCbAllocateMemory(ULONG Size);

Modified: trunk/reactos/subsystems/win32/win32k/include/caret.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/caret.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/caret.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/caret.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -7,7 +7,7 @@
 #define IDCARETTIMER (0xffff)
 
 BOOL FASTCALL
-co_IntDestroyCaret(PW32THREAD Win32Thread);
+co_IntDestroyCaret(PTHREADINFO Win32Thread);
 
 BOOL FASTCALL
 IntSetCaretBlinkTime(UINT uMSeconds);

Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/desktop.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -198,11 +198,13 @@
 DesktopHeapGetUserDelta(VOID)
 {
     PW32HEAP_USER_MAPPING Mapping;
+    PTHREADINFO pti;
     HANDLE hDesktopHeap;
     ULONG_PTR Delta = 0;
 
-    ASSERT(PsGetCurrentThreadWin32Thread()->Desktop != NULL);
-    hDesktopHeap = PsGetCurrentThreadWin32Thread()->Desktop->hDesktopHeap;
+    pti = PsGetCurrentThreadWin32Thread();
+    ASSERT(pti->Desktop != NULL);
+    hDesktopHeap = pti->Desktop->hDesktopHeap;
 
     Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;
     while (Mapping != NULL)

Modified: trunk/reactos/subsystems/win32/win32k/include/hook.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/hook.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/hook.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/hook.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -18,7 +18,7 @@
 #define NB_HOOKS (WH_MAXHOOK-WH_MINHOOK+1)
 #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK)
 #define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1))
-#define ISITHOOKED(HookId) (PsGetCurrentThreadWin32Thread()->Hooks & HOOKID_TO_FLAG(HookId))
+#define ISITHOOKED(HookId) (((PTHREADINFO)PsGetCurrentThreadWin32Thread())->Hooks & HOOKID_TO_FLAG(HookId))
 
 typedef struct tagHOOKTABLE
 {

Modified: trunk/reactos/subsystems/win32/win32k/include/input.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/input.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -27,7 +27,7 @@
 VOID W32kUnregisterPrimitiveMessageQueue(VOID);
 PKBL W32kGetDefaultKeyLayout(VOID);
 VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout, BYTE Prefix);
-BOOL FASTCALL IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt);
+BOOL FASTCALL IntBlockInput(PTHREADINFO W32Thread, BOOL BlockIt);
 BOOL FASTCALL IntMouseInput(MOUSEINPUT *mi);
 BOOL FASTCALL IntKeyboardInput(KEYBDINPUT *ki);
 

Modified: trunk/reactos/subsystems/win32/win32k/include/object.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/object.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/object.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -87,7 +87,7 @@
 static __inline VOID
 UserAssertLastRef(PVOID obj, const char *file, int line)
 {
-    PW32THREAD W32Thread;
+    PTHREADINFO W32Thread;
     PSINGLE_LIST_ENTRY ReferenceEntry;
     PUSER_REFERENCE_ENTRY UserReferenceEntry;
 
@@ -122,7 +122,7 @@
 static __inline VOID
 UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
 {
-    PW32THREAD W32Thread;
+    PTHREADINFO W32Thread;
 
     W32Thread = PsGetCurrentThreadWin32Thread();
     ASSERT(W32Thread != NULL);
@@ -135,7 +135,7 @@
 static __inline VOID
 UserDerefObjectCo(PVOID obj)
 {
-    PW32THREAD W32Thread;
+    PTHREADINFO W32Thread;
     PSINGLE_LIST_ENTRY ReferenceEntry;
     PUSER_REFERENCE_ENTRY UserReferenceEntry;
 

Modified: trunk/reactos/subsystems/win32/win32k/include/painting.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/painting.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/painting.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/painting.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -10,7 +10,7 @@
 VOID FASTCALL
 IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags);
 BOOL FASTCALL
-IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, PW32THREAD Thread,
+IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax, PTHREADINFO Thread,
                    MSG *Message, BOOL Remove);
 INT FASTCALL UserRealizePalette(HDC);
 

Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/win32.h?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -3,22 +3,42 @@
 
 #include <pshpack1.h>
 
+typedef struct _TL
+{
+    struct _TL* next;
+    PVOID pobj;
+    PVOID pfnFree;
+} TL, *PTL;
+
 typedef struct _W32THREAD
 {
+    PETHREAD pEThread;
+    ULONG RefCount;
+    PTL ptlW32;
+    PVOID pgdiDcattr;
+    PVOID pgdiBrushAttr;
+    PVOID pUMPDObjs;
+    PVOID pUMPDHeap;
+    DWORD dwEngAcquireCount;
+    PVOID pSemTable;
+    PVOID pUMPDObj;
+} W32THREAD, *PW32THREAD;
+
+typedef struct _THREADINFO
+{
+    W32THREAD W32Thread;
+
   struct _USER_MESSAGE_QUEUE* MessageQueue;
   LIST_ENTRY WindowListHead;
   LIST_ENTRY W32CallbackListHead;
   struct _KBL* KeyboardLayout;
   struct _DESKTOP_OBJECT* Desktop;
   HANDLE hDesktop;
-  PVOID pgdiDcattr;
-  PVOID pgdiBrushAttr;
-  DWORD dwEngAcquireCount;
   BOOLEAN IsExiting;
   SINGLE_LIST_ENTRY  ReferencesList;
   ULONG Hooks;
   PW32THREADINFO ThreadInfo;
-} W32THREAD, *PW32THREAD;
+} THREADINFO, *PTHREADINFO;
 
 #include <poppack.h>
 
@@ -49,5 +69,4 @@
   PW32PROCESSINFO ProcessInfo;
 } W32PROCESS, *PW32PROCESS;
 
-
 #endif /* __INCLUDE_NAPI_WIN32_H */

Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/main/dllmain.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -174,7 +174,7 @@
                      PSW32THREADCALLOUTTYPE Type)
 {
     struct _EPROCESS *Process;
-    PW32THREAD Win32Thread;
+    PTHREADINFO Win32Thread;
     DECLARE_RETURN(NTSTATUS);
 
     DPRINT("Enter Win32kThreadCallback\n");
@@ -190,12 +190,12 @@
     {
         /* FIXME - lock the process */
         Win32Thread = ExAllocatePoolWithTag(NonPagedPool,
-                                            sizeof(W32THREAD),
+                                            sizeof(THREADINFO),
                                             TAG('W', '3', '2', 't'));
 
         if (Win32Thread == NULL) RETURN( STATUS_NO_MEMORY);
 
-        RtlZeroMemory(Win32Thread, sizeof(W32THREAD));
+        RtlZeroMemory(Win32Thread, sizeof(THREADINFO));
 
         PsSetThreadWin32Thread(Thread, Win32Thread);
         /* FIXME - unlock the process */
@@ -344,11 +344,11 @@
 
   if (Thread->Tcb.Win32Thread == NULL)
     {
-      Thread->Tcb.Win32Thread = ExAllocatePool (NonPagedPool, sizeof(W32THREAD));
+      Thread->Tcb.Win32Thread = ExAllocatePool (NonPagedPool, sizeof(THREADINFO));
       if (Thread->Tcb.Win32Thread == NULL)
 	return STATUS_NO_MEMORY;
 
-      RtlZeroMemory(Thread->Tcb.Win32Thread, sizeof(W32THREAD));
+      RtlZeroMemory(Thread->Tcb.Win32Thread, sizeof(THREADINFO));
 
       Win32kThreadCallback(Thread, PsW32ThreadCalloutInitialize);
     }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/callback.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -42,7 +42,7 @@
 
 typedef struct _INT_CALLBACK_HEADER
 {
-   /* list entry in the W32THREAD structure */
+   /* list entry in the THREADINFO structure */
    LIST_ENTRY ListEntry;
 }
 INT_CALLBACK_HEADER, *PINT_CALLBACK_HEADER;
@@ -51,7 +51,7 @@
 IntCbAllocateMemory(ULONG Size)
 {
    PINT_CALLBACK_HEADER Mem;
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
 
    if(!(Mem = ExAllocatePoolWithTag(PagedPool, Size + sizeof(INT_CALLBACK_HEADER),
                                     TAG_CALLBACK)))
@@ -73,7 +73,7 @@
 IntCbFreeMemory(PVOID Data)
 {
    PINT_CALLBACK_HEADER Mem;
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
 
    ASSERT(Data);
 
@@ -90,7 +90,7 @@
 }
 
 VOID FASTCALL
-IntCleanupThreadCallbacks(PW32THREAD W32Thread)
+IntCleanupThreadCallbacks(PTHREADINFO W32Thread)
 {
    PLIST_ENTRY CurrentEntry;
    PINT_CALLBACK_HEADER Mem;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/caret.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/caret.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/caret.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -40,7 +40,7 @@
 }
 
 BOOL FASTCALL
-co_IntDestroyCaret(PW32THREAD Win32Thread)
+co_IntDestroyCaret(PTHREADINFO Win32Thread)
 {
    PUSER_MESSAGE_QUEUE ThreadQueue;
    ThreadQueue = (PUSER_MESSAGE_QUEUE)Win32Thread->MessageQueue;
@@ -61,7 +61,8 @@
 IntSetCaretBlinkTime(UINT uMSeconds)
 {
    /* Don't save the new value to the registry! */
-   PWINSTATION_OBJECT WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PWINSTATION_OBJECT WinStaObject = pti->Desktop->WindowStation;
 
    /* windows doesn't do this check */
    if((uMSeconds < MIN_CARETBLINKRATE) || (uMSeconds > MAX_CARETBLINKRATE))
@@ -146,10 +147,12 @@
 UINT FASTCALL
 IntGetCaretBlinkTime(VOID)
 {
+   PTHREADINFO pti;
    PWINSTATION_OBJECT WinStaObject;
    UINT Ret;
 
-   WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+   pti = PsGetCurrentThreadWin32Thread();
+   WinStaObject = pti->Desktop->WindowStation;
 
    Ret = WinStaObject->CaretBlinkRate;
    if(!Ret)
@@ -171,8 +174,11 @@
 BOOL FASTCALL
 co_IntSetCaretPos(int X, int Y)
 {
-   PUSER_MESSAGE_QUEUE ThreadQueue;
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   PTHREADINFO pti;
+   PUSER_MESSAGE_QUEUE ThreadQueue;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if(ThreadQueue->CaretInfo->hWnd)
    {
@@ -194,8 +200,11 @@
 BOOL FASTCALL
 IntSwitchCaretShowing(PVOID Info)
 {
-   PUSER_MESSAGE_QUEUE ThreadQueue;
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   PTHREADINFO pti;
+   PUSER_MESSAGE_QUEUE ThreadQueue;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if(ThreadQueue->CaretInfo->hWnd)
    {
@@ -212,8 +221,11 @@
 VOID FASTCALL
 co_IntDrawCaret(HWND hWnd)
 {
-   PUSER_MESSAGE_QUEUE ThreadQueue;
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   PTHREADINFO pti;
+   PUSER_MESSAGE_QUEUE ThreadQueue;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if(ThreadQueue->CaretInfo->hWnd && ThreadQueue->CaretInfo->Visible &&
          ThreadQueue->CaretInfo->Showing)
@@ -228,6 +240,7 @@
 
 BOOL FASTCALL co_UserHideCaret(PWINDOW_OBJECT Window OPTIONAL)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
 
    if (Window) ASSERT_REFS_CO(Window);
@@ -238,7 +251,8 @@
       return FALSE;
    }
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
    {
@@ -261,6 +275,7 @@
 
 BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
 
    if (Window) ASSERT_REFS_CO(Window);
@@ -271,7 +286,8 @@
       return FALSE;
    }
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if(Window && ThreadQueue->CaretInfo->hWnd != Window->hSelf)
    {
@@ -304,6 +320,7 @@
    int nHeight)
 {
    PWINDOW_OBJECT Window;
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    DECLARE_RETURN(BOOL);
 
@@ -321,7 +338,8 @@
       RETURN(FALSE);
    }
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if (ThreadQueue->CaretInfo->Visible)
    {
@@ -374,6 +392,7 @@
 NtUserGetCaretPos(
    LPPOINT lpPoint)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    NTSTATUS Status;
    DECLARE_RETURN(BOOL);
@@ -381,7 +400,8 @@
    DPRINT("Enter NtUserGetCaretPos\n");
    UserEnterShared();
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    Status = MmCopyToCaller(lpPoint, &(ThreadQueue->CaretInfo->Pos), sizeof(POINT));
    if(!NT_SUCCESS(Status))

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/clipboard.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -15,27 +15,8 @@
 #define DATA_DELAYED_RENDER  0
 #define DATA_SYNTHESIZED_RENDER -1
 
-#define USE_WINSTA \
-    PWINSTATION_OBJECT WinStaObj; \
-    WinStaObj = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
-
-#define WINSTA_ClipboardThread WinStaObj->Clipboard->ClipboardThread
-#define WINSTA_ClipboardOwnerThread WinStaObj->Clipboard->ClipboardOwnerThread
-#define WINSTA_ClipboardWindow WinStaObj->Clipboard->ClipboardWindow
-#define WINSTA_ClipboardViewerWindow WinStaObj->Clipboard->ClipboardViewerWindow
-#define WINSTA_ClipboardOwnerWindow WinStaObj->Clipboard->ClipboardOwnerWindow
-#define WINSTA_sendDrawClipboardMsg WinStaObj->Clipboard->sendDrawClipboardMsg
-#define WINSTA_recentlySetClipboard WinStaObj->Clipboard->recentlySetClipboard
-#define WINSTA_delayedRender WinStaObj->Clipboard->delayedRender
-#define WINSTA_lastEnumClipboardFormats WinStaObj->Clipboard->lastEnumClipboardFormats
-#define WINSTA_ClipboardSequenceNumber WinStaObj->Clipboard->ClipboardSequenceNumber
-#define WINSTA_WindowsChain WinStaObj->Clipboard->WindowsChain
-#define WINSTA_ClipboardData WinStaObj->Clipboard->ClipboardData
-#define WINSTA_synthesizedData WinStaObj->Clipboard->synthesizedData
-#define WINSTA_synthesizedDataSize WinStaObj->Clipboard->synthesizedDataSize
-
-PW32THREAD      ClipboardThread;
-PW32THREAD      ClipboardOwnerThread;
+PTHREADINFO      ClipboardThread;
+PTHREADINFO      ClipboardOwnerThread;
 PWINDOW_OBJECT  ClipboardWindow;
 PWINDOW_OBJECT  ClipboardViewerWindow;
 PWINDOW_OBJECT  ClipboardOwnerWindow;
@@ -1145,11 +1126,13 @@
 VOID FASTCALL
 IntIncrementSequenceNumber(VOID)
 {
-
-    USE_WINSTA
-
-    WINSTA_ClipboardSequenceNumber++;
-
+    PTHREADINFO pti;
+    PWINSTATION_OBJECT WinStaObj;
+
+    pti = PsGetCurrentThreadWin32Thread();
+    WinStaObj = pti->Desktop->WindowStation;
+
+    WinStaObj->Clipboard->ClipboardSequenceNumber++;
 }
 
 DWORD STDCALL

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -1820,7 +1820,8 @@
 NTAPI
 UserShowCursor(BOOL bShow)
 {
-    PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+    PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+    PWINSTATION_OBJECT WinSta = pti->Desktop->WindowStation;
     PSYSTEM_CURSORINFO CurInfo;
 
     HDC Screen;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -580,7 +580,8 @@
 
 HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
 {
-   PDESKTOP_OBJECT pdo = PsGetCurrentThreadWin32Thread()->Desktop;
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PDESKTOP_OBJECT pdo = pti->Desktop;
    if (NULL == pdo)
    {
       DPRINT1("Thread doesn't have a desktop\n");
@@ -782,7 +783,8 @@
  */
 BOOL IntRegisterShellHookWindow(HWND hWnd)
 {
-   PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PDESKTOP_OBJECT Desktop = pti->Desktop;
    PSHELL_HOOK_WINDOW Entry;
 
    DPRINT("IntRegisterShellHookWindow\n");
@@ -813,7 +815,8 @@
  */
 BOOL IntDeRegisterShellHookWindow(HWND hWnd)
 {
-   PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PDESKTOP_OBJECT Desktop = pti->Desktop;
    PSHELL_HOOK_WINDOW Current;
 
    LIST_FOR_EACH(Current, &Desktop->ShellHookWindows, SHELL_HOOK_WINDOW, ListEntry)
@@ -1363,7 +1366,8 @@
    COLORREF color_old;
    UINT align_old;
    int mode_old;
-   PWINSTATION_OBJECT WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PWINSTATION_OBJECT WinSta = pti->Desktop->WindowStation;
    DECLARE_RETURN(BOOL);
 
    UserEnterExclusive();
@@ -1674,14 +1678,14 @@
    {
       /* just return the handle, we queried the desktop handle of a thread running
          in the same context */
-      Ret = ((PW32THREAD)Thread->Tcb.Win32Thread)->hDesktop;
+      Ret = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hDesktop;
       ObDereferenceObject(Thread);
       RETURN(Ret);
    }
 
    /* get the desktop handle and the desktop of the thread */
-   if(!(hThreadDesktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->hDesktop) ||
-         !(DesktopObject = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop))
+   if(!(hThreadDesktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->hDesktop) ||
+         !(DesktopObject = ((PTHREADINFO)Thread->Tcb.Win32Thread)->Desktop))
    {
       ObDereferenceObject(Thread);
       DPRINT1("Desktop information of thread 0x%x broken!?\n", dwThreadId);
@@ -1854,7 +1858,7 @@
                     IN BOOL FreeOnFailure)
 {
     PDESKTOP_OBJECT OldDesktop;
-    PW32THREAD W32Thread;
+    PTHREADINFO W32Thread;
     NTSTATUS Status;
     BOOL MapHeap;
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/event.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/event.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/event.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/event.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -105,7 +105,7 @@
 
    /* FIXME should get timeout from
     * HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout */
-   Status = co_MsqSendMessage(((PW32THREAD)pEH->Thread->Tcb.Win32Thread)->MessageQueue,
+   Status = co_MsqSendMessage(((PTHREADINFO)pEH->Thread->Tcb.Win32Thread)->MessageQueue,
                                            hwnd,
                                           event,
                                               0,

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/focus.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -40,8 +40,11 @@
 HWND FASTCALL
 IntGetThreadFocusWindow()
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    return ThreadQueue != NULL ? ThreadQueue->FocusWindow : 0;
 }
 
@@ -312,6 +315,7 @@
 HWND FASTCALL
 co_IntSetActiveWindow(PWINDOW_OBJECT Window OPTIONAL)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    HWND hWndPrev;
    HWND hWnd = 0;
@@ -320,7 +324,8 @@
    if (Window)
       ASSERT_REFS_CO(Window);
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    ASSERT(ThreadQueue != 0);
 
    if (Window != 0)
@@ -358,12 +363,14 @@
 co_IntSetFocusWindow(PWINDOW_OBJECT Window OPTIONAL)
 {
    HWND hWndPrev = 0;
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
 
    if (Window)
       ASSERT_REFS_CO(Window);
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    ASSERT(ThreadQueue != 0);
 
    hWndPrev = ThreadQueue->FocusWindow;
@@ -425,8 +432,11 @@
 
 HWND FASTCALL UserGetActiveWindow()
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    return( ThreadQueue ? ThreadQueue->ActiveWindow : 0);
 }
 
@@ -443,6 +453,7 @@
    if (hWnd)
    {
       PWINDOW_OBJECT Window;
+      PTHREADINFO pti;
       PUSER_MESSAGE_QUEUE ThreadQueue;
       HWND hWndPrev;
 
@@ -451,7 +462,8 @@
          RETURN( 0);
       }
 
-      ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+      pti = PsGetCurrentThreadWin32Thread();
+      ThreadQueue = pti->MessageQueue;
 
       if (Window->MessageQueue != ThreadQueue)
       {
@@ -482,12 +494,14 @@
 HWND STDCALL
 IntGetCapture(VOID)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    DECLARE_RETURN(HWND);
 
    DPRINT("Enter IntGetCapture\n");
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    RETURN( ThreadQueue ? ThreadQueue->CaptureWindow : 0);
 
 CLEANUP:
@@ -501,6 +515,7 @@
 HWND STDCALL
 NtUserSetCapture(HWND hWnd)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    PWINDOW_OBJECT Window;
    HWND hWndPrev;
@@ -509,7 +524,8 @@
    DPRINT("Enter NtUserSetCapture(%x)\n", hWnd);
    UserEnterExclusive();
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    if((Window = UserGetWindowObject(hWnd)))
    {
@@ -545,6 +561,7 @@
 {
    if (Window)
    {
+      PTHREADINFO pti;
       PUSER_MESSAGE_QUEUE ThreadQueue;
       HWND hWndPrev;
       PWINDOW_OBJECT TopWnd;
@@ -553,7 +570,8 @@
 
       ASSERT_REFS_CO(Window);
 
-      ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+      pti = PsGetCurrentThreadWin32Thread();
+      ThreadQueue = pti->MessageQueue;
 
       Wnd = Window->Wnd;
       if (Wnd->Style & (WS_MINIMIZE | WS_DISABLED))

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/hook.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -72,9 +72,9 @@
 static PHOOK
 IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinStaObj)
 {
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
    PHOOK Hook;
-   PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue);
+   PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PTHREADINFO)Thread->Tcb.Win32Thread)->MessageQueue);
    HANDLE Handle;
 
    if (NULL == Table)
@@ -90,7 +90,7 @@
       }
       else
       {
-         MsqSetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue, Table);
+         MsqSetHooks(((PTHREADINFO)Thread->Tcb.Win32Thread)->MessageQueue, Table);
       }
    }
 
@@ -106,7 +106,7 @@
 
    if (Thread)
    {
-      W32Thread = ((PW32THREAD)Thread->Tcb.Win32Thread);
+      W32Thread = ((PTHREADINFO)Thread->Tcb.Win32Thread);
       ASSERT(W32Thread != NULL);
       W32Thread->Hooks |= HOOKID_TO_FLAG(HookId);
       if (W32Thread->ThreadInfo != NULL)
@@ -130,7 +130,7 @@
       return GlobalHooks;
    }
 
-   return MsqGetHooks(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue);
+   return MsqGetHooks(((PTHREADINFO)Hook->Thread->Tcb.Win32Thread)->MessageQueue);
 }
 
 /* get the first hook in the chain */
@@ -208,7 +208,7 @@
 static VOID
 IntRemoveHook(PHOOK Hook, PWINSTATION_OBJECT WinStaObj, BOOL TableAlreadyLocked)
 {
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
    PHOOKTABLE Table = IntGetTable(Hook);
 
    ASSERT(NULL != Table);
@@ -217,7 +217,7 @@
       return;
    }
 
-   W32Thread = ((PW32THREAD)Hook->Thread->Tcb.Win32Thread);
+   W32Thread = ((PTHREADINFO)Hook->Thread->Tcb.Win32Thread);
    ASSERT(W32Thread != NULL);
    W32Thread->Hooks &= ~HOOKID_TO_FLAG(Hook->HookId);
    if (W32Thread->ThreadInfo != NULL)
@@ -274,7 +274,7 @@
 
    /* FIXME should get timeout from
     * HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout */
-   Status = co_MsqSendMessage(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue,
+   Status = co_MsqSendMessage(((PTHREADINFO)Hook->Thread->Tcb.Win32Thread)->MessageQueue,
                                     (HWND) Code,
                                    Hook->HookId,
                                          wParam,
@@ -295,7 +295,7 @@
 co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
 {
    PHOOK Hook, SaveHook;
-   PW32THREAD Win32Thread;
+   PTHREADINFO pti;
    PCLIENTINFO ClientInfo;
    PHOOKTABLE Table;
    LRESULT Result;
@@ -304,14 +304,14 @@
 
    ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK);
 
-   Win32Thread = PsGetCurrentThreadWin32Thread();
-   if (NULL == Win32Thread)
+   pti = PsGetCurrentThreadWin32Thread();
+   if (!pti)
    {
       Table = NULL;
    }
    else
    {
-      Table = MsqGetHooks(Win32Thread->MessageQueue);
+      Table = MsqGetHooks(pti->MessageQueue);
    }
 
    if (NULL == Table || ! (Hook = IntGetFirstValidHook(Table, HookId)))
@@ -361,7 +361,7 @@
    }
    else
    {
-      IntReleaseHookChain(MsqGetHooks(PsGetCurrentThreadWin32Thread()->MessageQueue), HookId, WinStaObj);
+      IntReleaseHookChain(MsqGetHooks(pti->MessageQueue), HookId, WinStaObj);
       IntReleaseHookChain(GlobalHooks, HookId, WinStaObj);
       ObDereferenceObject(WinStaObj);
    }

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/input.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -790,14 +790,14 @@
             FocusThread = FocusQueue->Thread;
 
             if (!(FocusThread && FocusThread->Tcb.Win32Thread &&
-                  ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout))
+                  ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout))
                continue;
 
             /* This function uses lParam to fill wParam according to the
              * keyboard layout in use.
              */
             W32kKeyProcessMessage(&msg,
-                                  ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout->KBTables,
+                                  ((PTHREADINFO)FocusThread->Tcb.Win32Thread)->KeyboardLayout->KBTables,
                                   KeyInput.Flags & KEY_E0 ? 0xE0 :
                                   (KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
 
@@ -892,9 +892,9 @@
 }
 
 BOOL FASTCALL
-IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt)
-{
-   PW32THREAD OldBlock;
+IntBlockInput(PTHREADINFO W32Thread, BOOL BlockIt)
+{
+   PTHREADINFO OldBlock;
    ASSERT(W32Thread);
 
    if(!W32Thread->Desktop || (W32Thread->IsExiting && BlockIt))
@@ -1225,7 +1225,7 @@
    LPINPUT pInput,
    INT cbSize)
 {
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
    UINT cnt;
    DECLARE_RETURN(UINT);
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -407,7 +407,7 @@
    return TRUE;
 }
 
-static PKBL co_UserActivateKbl(PW32THREAD w32Thread, PKBL pKbl, UINT Flags)
+static PKBL co_UserActivateKbl(PTHREADINFO w32Thread, PKBL pKbl, UINT Flags)
 {
    PKBL Prev;
 
@@ -444,7 +444,7 @@
 {
    NTSTATUS Status;
    PETHREAD Thread;
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
    HKL Ret;
 
    if(!dwThreadId)
@@ -523,13 +523,15 @@
 {
    BOOL ret = FALSE;
    PKBL pKbl;
+   PTHREADINFO pti;
 
    UserEnterShared();
 
    _SEH_TRY
    {
       ProbeForWrite(lpszName, KL_NAMELENGTH*sizeof(WCHAR), 1);
-      pKbl = PsGetCurrentThreadWin32Thread()->KeyboardLayout;
+      pti = PsGetCurrentThreadWin32Thread();
+      pKbl = pti->KeyboardLayout;
       RtlCopyMemory(lpszName,  pKbl->Name, KL_NAMELENGTH*sizeof(WCHAR));
       ret = TRUE;
    }
@@ -614,7 +616,7 @@
 {
    PKBL pKbl;
    HKL Ret = NULL;
-   PW32THREAD pWThread;
+   PTHREADINFO pWThread;
 
    UserEnterExclusive();
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -420,6 +420,7 @@
 IntTranslateKbdMessage(LPMSG lpMsg,
                        HKL dwhkl)
 {
+   PTHREADINFO pti;
    static INT dead_char = 0;
    LONG UState = 0;
    WCHAR wp[2] = { 0 };
@@ -428,8 +429,8 @@
    BOOL Result = FALSE;
    DWORD ScanCode = 0;
 
-
-   keyLayout = PsGetCurrentThreadWin32Thread()->KeyboardLayout->KBTables;
+   pti = PsGetCurrentThreadWin32Thread();
+   keyLayout = pti->KeyboardLayout->KBTables;
    if( !keyLayout )
       return FALSE;
 
@@ -439,7 +440,7 @@
    ScanCode = (lpMsg->lParam >> 16) & 0xff;
 
    /* All messages have to contain the cursor point. */
-   IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
+   IntGetCursorLocation(pti->Desktop->WindowStation,
                         &NewMsg.pt);
 
    UState = ToUnicodeInner(lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff,
@@ -476,14 +477,14 @@
          NewMsg.wParam = dead_char;
          NewMsg.lParam = lpMsg->lParam;
          dead_char = 0;
-         MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
+         MsqPostMessage(pti->MessageQueue, &NewMsg, FALSE, QS_KEY);
       }
 
       NewMsg.hwnd = lpMsg->hwnd;
       NewMsg.wParam = wp[0];
       NewMsg.lParam = lpMsg->lParam;
       DPRINT( "CHAR='%c' %04x %08x\n", wp[0], wp[0], lpMsg->lParam );
-      MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
+      MsqPostMessage(pti->MessageQueue, &NewMsg, FALSE, QS_KEY);
       Result = TRUE;
    }
    else if (UState == -1)
@@ -494,7 +495,7 @@
       NewMsg.wParam = wp[0];
       NewMsg.lParam = lpMsg->lParam;
       dead_char = wp[0];
-      MsqPostMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, &NewMsg, FALSE, QS_KEY);
+      MsqPostMessage(pti->MessageQueue, &NewMsg, FALSE, QS_KEY);
       Result = TRUE;
    }
 
@@ -664,13 +665,15 @@
 STDCALL
 NtUserMapVirtualKeyEx( UINT Code, UINT Type, DWORD keyboardId, HKL dwhkl )
 {
+   PTHREADINFO pti;
    PKBDTABLES keyLayout;
    DECLARE_RETURN(UINT);
 
    DPRINT("Enter NtUserMapVirtualKeyEx\n");
    UserEnterExclusive();
 
-   keyLayout = PsGetCurrentThreadWin32Thread() ? PsGetCurrentThreadWin32Thread()->KeyboardLayout->KBTables : 0;
+   pti = PsGetCurrentThreadWin32Thread();
+   keyLayout = pti ? pti->KeyboardLayout->KBTables : 0;
 
    if( !keyLayout )
       RETURN(0);
@@ -695,6 +698,7 @@
    UINT wFlags,
    HKL dwhkl )
 {
+   PTHREADINFO pti;
    BYTE KeyStateBuf[0x100];
    PWCHAR OutPwszBuff = 0;
    int ret = 0;
@@ -723,14 +727,14 @@
       }
       RtlZeroMemory( OutPwszBuff, sizeof( WCHAR ) * cchBuff );
 
+      pti = PsGetCurrentThreadWin32Thread();
       ret = ToUnicodeInner( wVirtKey,
                             wScanCode,
                             KeyStateBuf,
                             OutPwszBuff,
                             cchBuff,
                             wFlags,
-                            PsGetCurrentThreadWin32Thread() ?
-                               PsGetCurrentThreadWin32Thread()->KeyboardLayout->KBTables : 0 );
+                            pti ? pti->KeyboardLayout->KBTables : 0 );
 
       MmCopyToCaller(pwszBuff,OutPwszBuff,sizeof(WCHAR)*cchBuff);
       ExFreePool(OutPwszBuff);
@@ -757,6 +761,7 @@
 STDCALL
 NtUserGetKeyNameText( LONG lParam, LPWSTR lpString, int nSize )
 {
+   PTHREADINFO pti;
    int i;
    DWORD ret = 0;
    UINT CareVk = 0;
@@ -770,8 +775,8 @@
    DPRINT("Enter NtUserGetKeyNameText\n");
    UserEnterShared();
 
-   keyLayout = PsGetCurrentThreadWin32Thread() ?
-      PsGetCurrentThreadWin32Thread()->KeyboardLayout->KBTables : 0;
+   pti = PsGetCurrentThreadWin32Thread();
+   keyLayout = pti ? pti->KeyboardLayout->KBTables : 0;
 
    if( !keyLayout || nSize < 1 )
       RETURN(0);

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/message.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -303,7 +303,7 @@
 {
    BOOL SameThread = FALSE;
 
-   if (Window->ti == PsGetCurrentThreadWin32Thread()->ThreadInfo)
+   if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->ThreadInfo)
       SameThread = TRUE;
 
    if ((!SameThread && (Window->ti->Hooks & HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
@@ -325,7 +325,7 @@
 {
    BOOL SameThread = FALSE;
 
-   if (Window->ti == PsGetCurrentThreadWin32Thread()->ThreadInfo)
+   if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->ThreadInfo)
       SameThread = TRUE;
 
    if ((!SameThread && (Window->ti->Hooks & HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
@@ -740,6 +740,7 @@
                   UINT MsgFilterMax,
                   UINT RemoveMsg)
 {
+   PTHREADINFO pti;
    LARGE_INTEGER LargeTickCount;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    PUSER_MESSAGE Message;
@@ -751,7 +752,8 @@
    /* The queues and order in which they are checked are documented in the MSDN
       article on GetMessage() */
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    /* Inspect RemoveMsg flags */
    /* FIXME: The only flag we process is PM_REMOVE - processing of others must still be implemented */
@@ -827,7 +829,7 @@
       ;
 
    /* Check for paint messages. */
-   if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, PsGetCurrentThreadWin32Thread(), &Msg->Msg, RemoveMessages))
+   if (IntGetPaintMessage(hWnd, MsgFilterMin, MsgFilterMax, pti, &Msg->Msg, RemoveMessages))
    {
       Msg->FreeLParam = FALSE;
       goto MsgExit;
@@ -1056,11 +1058,13 @@
                   UINT MsgFilterMin,
                   UINT MsgFilterMax)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE ThreadQueue;
    NTSTATUS Status;
    USER_MESSAGE Msg;
 
-   ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
 
    do
    {
@@ -1292,14 +1296,16 @@
                 WPARAM wParam,
                 LPARAM lParam)
 {
+   PTHREADINFO pti;
    MSG UserModeMsg, KernelModeMsg;
    LARGE_INTEGER LargeTickCount;
    NTSTATUS Status;
    PMSGMEMORY MsgMemoryEntry;
 
+   pti = PsGetCurrentThreadWin32Thread();
    if (WM_QUIT == Msg)
    {
-      MsqPostQuitMessage(PsGetCurrentThreadWin32Thread()->MessageQueue, wParam);
+      MsqPostQuitMessage(pti->MessageQueue, wParam);
    }
    else if (Wnd == HWND_BROADCAST)
    {
@@ -1344,7 +1350,7 @@
          SetLastWin32Error(ERROR_INVALID_PARAMETER);
          return FALSE;
       }
-      IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
+      IntGetCursorLocation(pti->Desktop->WindowStation,
                            &KernelModeMsg.pt);
       KeQueryTickCount(&LargeTickCount);
       KernelModeMsg.time = MsqCalculateMessageTime(&LargeTickCount);
@@ -1386,7 +1392,7 @@
 {
    MSG UserModeMsg, KernelModeMsg;
    PETHREAD peThread;
-   PW32THREAD pThread;
+   PTHREADINFO pThread;
    NTSTATUS Status;
    PMSGMEMORY MsgMemoryEntry;
    DECLARE_RETURN(BOOL);
@@ -1398,7 +1404,7 @@
 
    if( Status == STATUS_SUCCESS )
    {
-      pThread = (PW32THREAD)peThread->Tcb.Win32Thread;
+      pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
       if( !pThread || !pThread->MessageQueue )
       {
          ObDereferenceObject( peThread );
@@ -1473,7 +1479,7 @@
    PMSGMEMORY MsgMemoryEntry;
    INT lParamBufferSize;
    LPARAM lParamPacked;
-   PW32THREAD Win32Thread;
+   PTHREADINFO Win32Thread;
    DECLARE_RETURN(LRESULT);
    USER_REFERENCE_ENTRY Ref;
 
@@ -1642,6 +1648,7 @@
                         LPARAM lParam)
 {
    ULONG_PTR Result;
+   PTHREADINFO pti;
    PWINDOW_OBJECT Window;
 
    if(hWnd == HWND_BROADCAST)
@@ -1654,7 +1661,8 @@
       return 0;
    }
 
-   if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
+   pti = PsGetCurrentThreadWin32Thread();
+   if(Window->MessageQueue != pti->MessageQueue)
    {
       Result = UserPostMessage(hWnd, Msg, wParam, lParam);
    }
@@ -1676,6 +1684,7 @@
                     PDOSENDMESSAGE dsm,
                     PNTUSERSENDMESSAGEINFO UnsafeInfo)
 {
+   PTHREADINFO pti;
    LRESULT Result = TRUE;
    NTSTATUS Status;
    PWINDOW_OBJECT Window;
@@ -1704,8 +1713,9 @@
    /* FIXME: Check for an exiting window. */
 
    /* See if the current thread can handle the message */
-   if (HWND_BROADCAST != hWnd && NULL != PsGetCurrentThreadWin32Thread() &&
-         Window->MessageQueue == PsGetCurrentThreadWin32Thread()->MessageQueue)
+   pti = PsGetCurrentThreadWin32Thread();
+   if (HWND_BROADCAST != hWnd && NULL != pti &&
+         Window->MessageQueue == pti->MessageQueue)
    {
       /* Gather the information usermode needs to call the window proc directly */
       Info.HandledByKernel = FALSE;
@@ -1870,6 +1880,7 @@
    else
    {
      ULONG_PTR PResult;
+     PTHREADINFO pti;
      PWINDOW_OBJECT Window;
      NTSTATUS Status;
      MSG UserModeMsg;
@@ -1878,7 +1889,8 @@
 
       if(!(Window = UserGetWindowObject(hWnd))) return FALSE;
 
-      if(Window->MessageQueue != PsGetCurrentThreadWin32Thread()->MessageQueue)
+      pti = PsGetCurrentThreadWin32Thread();
+      if(Window->MessageQueue != pti->MessageQueue)
       { // Send message w/o waiting for it.
          Result = UserPostMessage(hWnd, Msg, wParam, lParam);
       }
@@ -1952,13 +1964,15 @@
 DWORD STDCALL
 IntGetQueueStatus(BOOL ClearChanges)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE Queue;
    DWORD Result;
    DECLARE_RETURN(DWORD);
 
    DPRINT("Enter IntGetQueueStatus\n");
 
-   Queue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   Queue = pti->MessageQueue;
 
    Result = MAKELONG(Queue->QueueBits, Queue->ChangedBits);
    if (ClearChanges)
@@ -1976,9 +1990,9 @@
 BOOL STDCALL
 IntInitMessagePumpHook()
 {
-   if (((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo)
-   {
-     ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook++;
+   if (((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo)
+   {
+     ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook++;
      return TRUE;
    }
    return FALSE;
@@ -1987,13 +2001,13 @@
 BOOL STDCALL
 IntUninitMessagePumpHook()
 {
-   if (((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo)
-   {
-      if (((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook <= 0)
+   if (((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo)
+   {
+      if (((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook <= 0)
       {
          return FALSE;
       }
-      ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook--;
+      ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->ThreadInfo->ClientThreadInfo.dwcPumpHook--;
       return TRUE;
    }
    return FALSE;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/misc.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -130,12 +130,12 @@
          SetLastWin32Error(ERROR_ACCESS_DENIED);
          RETURN( FALSE);
       }
-      Desktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop;
+      Desktop = ((PTHREADINFO)Thread->Tcb.Win32Thread)->Desktop;
    }
    else
    {
       /* get the foreground thread */
-      PW32THREAD W32Thread = (PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread;
+      PTHREADINFO W32Thread = (PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread;
       Desktop = W32Thread->Desktop;
       if(Desktop)
       {
@@ -438,7 +438,7 @@
     PTEB Teb;
     PW32THREADINFO ti;
     PCLIENTINFO ci;
-    PW32THREAD W32Thread = PsGetCurrentThreadWin32Thread();
+    PTHREADINFO W32Thread = PsGetCurrentThreadWin32Thread();
 
     if (W32Thread == NULL)
     {
@@ -446,7 +446,7 @@
         return NULL;
     }
 
-    /* allocate a W32THREAD structure if neccessary */
+    /* allocate a THREADINFO structure if neccessary */
     if (W32Thread->ThreadInfo == NULL)
     {
         ti = UserHeapAlloc(sizeof(W32THREADINFO));

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -93,7 +93,7 @@
 HANDLE FASTCALL
 IntMsqSetWakeMask(DWORD WakeMask)
 {
-   PW32THREAD Win32Thread;
+   PTHREADINFO Win32Thread;
    PUSER_MESSAGE_QUEUE MessageQueue;
    HANDLE MessageEventHandle;
 
@@ -111,7 +111,7 @@
 BOOL FASTCALL
 IntMsqClearWakeMask(VOID)
 {
-   PW32THREAD Win32Thread;
+   PTHREADINFO Win32Thread;
    PUSER_MESSAGE_QUEUE MessageQueue;
 
    Win32Thread = PsGetCurrentThreadWin32Thread();
@@ -235,17 +235,19 @@
 BOOL FASTCALL
 MsqIsDblClk(LPMSG Msg, BOOL Remove)
 {
+   PTHREADINFO pti;
    PWINSTATION_OBJECT WinStaObject;
    PSYSTEM_CURSORINFO CurInfo;
    LONG dX, dY;
    BOOL Res;
 
-   if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
+   pti = PsGetCurrentThreadWin32Thread();
+   if (pti->Desktop == NULL)
    {
       return FALSE;
    }
 
-   WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+   WinStaObject = pti->Desktop->WindowStation;
 
    CurInfo = IntGetSysCursorInfo(WinStaObject);
    Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) &&
@@ -811,7 +813,7 @@
 MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
    PWINDOW_OBJECT Window;
-   PW32THREAD Win32Thread;
+   PTHREADINFO Win32Thread;
    PWINSTATION_OBJECT WinSta;
    MSG Mesg;
    LARGE_INTEGER LargeTickCount;
@@ -1100,6 +1102,7 @@
                   UINT uTimeout, BOOL Block, INT HookMessage,
                   ULONG_PTR *uResult)
 {
+   PTHREADINFO pti;
    PUSER_SENT_MESSAGE Message;
    KEVENT CompletionEvent;
    NTSTATUS WaitStatus;
@@ -1116,7 +1119,8 @@
 
    KeInitializeEvent(&CompletionEvent, NotificationEvent, FALSE);
 
-   ThreadQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   ThreadQueue = pti->MessageQueue;
    ASSERT(ThreadQueue != MessageQueue);
 
    Timeout.QuadPart = (LONGLONG) uTimeout * (LONGLONG) -10000;
@@ -1603,9 +1607,11 @@
 MsqSetMessageExtraInfo(LPARAM lParam)
 {
    LPARAM Ret;
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE MessageQueue;
 
-   MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   MessageQueue = pti->MessageQueue;
    if(!MessageQueue)
    {
       return 0;
@@ -1620,9 +1626,11 @@
 LPARAM FASTCALL
 MsqGetMessageExtraInfo(VOID)
 {
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE MessageQueue;
 
-   MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+   pti = PsGetCurrentThreadWin32Thread();
+   MessageQueue = pti->MessageQueue;
    if(!MessageQueue)
    {
       return 0;
@@ -1822,6 +1830,7 @@
    LARGE_INTEGER LargeTickCount;
    PLIST_ENTRY EnumEntry;
    BOOLEAN GotMessage;
+   PTHREADINFO pti;
 
    DPRINT("MsqGetTimerMessage queue %p msg %p restart %s\n",
           MessageQueue, Msg, Restart ? "TRUE" : "FALSE");
@@ -1873,7 +1882,8 @@
    Msg->lParam = (LPARAM) Timer->TimerFunc;
    KeQueryTickCount(&LargeTickCount);
    Msg->time = MsqCalculateMessageTime(&LargeTickCount);
-   IntGetCursorLocation(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
+   pti = PsGetCurrentThreadWin32Thread();
+   IntGetCursorLocation(pti->Desktop->WindowStation,
                         &Msg->pt);
 
    if (Restart)

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/painting.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -636,7 +636,7 @@
 }
 
 HWND FASTCALL
-IntFindWindowToRepaint(PWINDOW_OBJECT Window, PW32THREAD Thread)
+IntFindWindowToRepaint(PWINDOW_OBJECT Window, PTHREADINFO Thread)
 {
    HWND hChild;
    PWINDOW_OBJECT TempWindow;
@@ -680,7 +680,7 @@
 
 BOOL FASTCALL
 IntGetPaintMessage(HWND hWnd, UINT MsgFilterMin, UINT MsgFilterMax,
-                   PW32THREAD Thread, MSG *Message, BOOL Remove)
+                   PTHREADINFO Thread, MSG *Message, BOOL Remove)
 {
    PUSER_MESSAGE_QUEUE MessageQueue = (PUSER_MESSAGE_QUEUE)Thread->MessageQueue;
 
@@ -721,7 +721,7 @@
 
    ASSERT_REFS_CO(Window);
 
-   Desktop = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->Desktop;
+   Desktop = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->Desktop;
    CaretInfo = ((PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue)->CaretInfo;
    hWndCaret = CaretInfo->hWnd;
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -493,7 +493,7 @@
 
       case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
          {
-            PUSER_MESSAGE_QUEUE MsgQueue = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
+            PUSER_MESSAGE_QUEUE MsgQueue = ((PTHREADINFO)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
 
             ASSERT(MsgQueue);
             RETURN( (DWORD)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -465,7 +465,8 @@
       case SPI_SETWORKAREA:
          {
             RECT *rc;
-            PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
+            PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+            PDESKTOP_OBJECT Desktop = pti->Desktop;
 
             if(!Desktop)
             {
@@ -482,7 +483,8 @@
          }
       case SPI_GETWORKAREA:
          {
-            PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop;
+            PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+            PDESKTOP_OBJECT Desktop = pti->Desktop;
 
             if(!Desktop)
             {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/timer.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -61,6 +61,7 @@
 {
    PWINDOW_OBJECT Window;
    UINT_PTR Ret = 0;
+   PTHREADINFO pti;
    PUSER_MESSAGE_QUEUE MessageQueue;
 
    DPRINT("IntSetTimer wnd %x id %p elapse %u timerproc %p systemtimer %s\n",
@@ -84,7 +85,8 @@
       HintIndex = ++IDEvent;
       IntUnlockWindowlessTimerBitmap();
       Ret = IDEvent;
-      MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+      pti = PsGetCurrentThreadWin32Thread();
+      MessageQueue = pti->MessageQueue;
    }
    else
    {
@@ -149,16 +151,18 @@
 BOOL FASTCALL
 IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
 {
+   PTHREADINFO pti;
    PWINDOW_OBJECT Window = NULL;
    
    DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
           Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
 
+   pti = PsGetCurrentThreadWin32Thread();
    if (Wnd)
    {
       Window = UserGetWindowObject(Wnd);
    
-      if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
+      if (! MsqKillTimer(pti->MessageQueue, Wnd,
                                 IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
       {
          // Give it another chance to find the timer.
@@ -175,7 +179,7 @@
    /* window-less timer? */
    if ((Wnd == NULL) && ! SystemTimer)
    {
-      if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
+      if (! MsqKillTimer(pti->MessageQueue, Wnd,
                                 IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
       {
          DPRINT1("Unable to locate timer in message queue for Window-less timer.\n");

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/useratom.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -33,9 +33,11 @@
 IntAddAtom(LPWSTR AtomName)
 {
    NTSTATUS Status = STATUS_SUCCESS;
+   PTHREADINFO pti;
    RTL_ATOM Atom;
 
-   if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
+   pti = PsGetCurrentThreadWin32Thread();
+   if (pti->Desktop == NULL)
    {
       SetLastNtError(Status);
       return (RTL_ATOM)0;
@@ -55,9 +57,11 @@
 IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
 {
    NTSTATUS Status = STATUS_SUCCESS;
+   PTHREADINFO pti;
    ULONG Size = nSize;
 
-   if (PsGetCurrentThreadWin32Thread()->Desktop == NULL)
+   pti = PsGetCurrentThreadWin32Thread();
+   if (pti->Desktop == NULL)
    {
       SetLastNtError(Status);
       return 0;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -363,7 +363,7 @@
  */
 static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
                                    PW32PROCESS ProcessData,
-                                   PW32THREAD ThreadData,
+                                   PTHREADINFO ThreadData,
                                    BOOLEAN SendMessages)
 {
    HWND *Children;
@@ -697,11 +697,11 @@
 VOID FASTCALL
 co_DestroyThreadWindows(struct _ETHREAD *Thread)
 {
-   PW32THREAD WThread;
+   PTHREADINFO WThread;
    PLIST_ENTRY Current;
    PWINDOW_OBJECT Wnd;
    USER_REFERENCE_ENTRY Ref;
-   WThread = (PW32THREAD)Thread->Tcb.Win32Thread;
+   WThread = (PTHREADINFO)Thread->Tcb.Win32Thread;
 
    while (!IsListEmpty(&WThread->WindowListHead))
    {
@@ -771,7 +771,7 @@
 IntGetSystemMenu(PWINDOW_OBJECT Window, BOOL bRevert, BOOL RetMenu)
 {
    PMENU_OBJECT Menu, NewMenu = NULL, SysMenu = NULL, ret = NULL;
-   PW32THREAD W32Thread;
+   PTHREADINFO W32Thread;
    HMENU hNewMenu, hSysMenu;
    ROSMENUITEMINFO ItemInfo;
 
@@ -1315,7 +1315,7 @@
    else
    {
       PETHREAD Thread;
-      PW32THREAD W32Thread;
+      PTHREADINFO W32Thread;
       PLIST_ENTRY Current;
       PWINDOW_OBJECT Window;
 
@@ -1324,7 +1324,7 @@
       {
          return ERROR_INVALID_PARAMETER;
       }
-      if(!(W32Thread = (PW32THREAD)Thread->Tcb.Win32Thread))
+      if(!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread))
       {
          ObDereferenceObject(Thread);
          DPRINT("Thread is not a GUI Thread!\n");
@@ -1523,8 +1523,10 @@
    DECLARE_RETURN(HWND);
    BOOL HasOwner;
    USER_REFERENCE_ENTRY ParentRef, Ref;
-
-   ParentWindowHandle = PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow;
+   PTHREADINFO pti;
+
+   pti = PsGetCurrentThreadWin32Thread();
+   ParentWindowHandle = pti->Desktop->DesktopWindow;
    OwnerWindowHandle = NULL;
 
    if (hWndParent == HWND_MESSAGE)
@@ -1568,7 +1570,7 @@
 
    /* Check the window station. */
    ti = GetW32ThreadInfo();
-   if (ti == NULL || PsGetCurrentThreadWin32Thread()->Desktop == NULL)
+   if (ti == NULL || pti->Desktop == NULL)
    {
       DPRINT1("Thread is not attached to a desktop! Cannot create window!\n");
       RETURN( (HWND)0);
@@ -1606,7 +1608,7 @@
        RETURN(NULL);
    }
 
-   WinSta = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
+   WinSta = pti->Desktop->WindowStation;
 
    //FIXME: Reference thread/desktop instead
    ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0);
@@ -1644,11 +1646,11 @@
 
    ObDereferenceObject(WinSta);
 
-   if (NULL == PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow)
+   if (NULL == pti->Desktop->DesktopWindow)
    {
       /* If there is no desktop window yet, we must be creating it */
-      PsGetCurrentThreadWin32Thread()->Desktop->DesktopWindow = hWnd;
-      PsGetCurrentThreadWin32Thread()->Desktop->DesktopInfo->Wnd = Wnd;
+      pti->Desktop->DesktopWindow = hWnd;
+      pti->Desktop->DesktopInfo->Wnd = Wnd;
    }
 
    /*
@@ -1664,7 +1666,7 @@
    Wnd->Instance = hInstance;
    Window->hSelf = hWnd;
 
-   Window->MessageQueue = PsGetCurrentThreadWin32Thread()->MessageQueue;
+   Window->MessageQueue = pti->MessageQueue;
    IntReferenceMessageQueue(Window->MessageQueue);
    Window->Parent = ParentWindow;
    Wnd->Parent = ParentWindow ? ParentWindow->Wnd : NULL;
@@ -1790,7 +1792,7 @@
        Wnd->IDMenu = (UINT) hMenu;
 
    /* Insert the window into the thread's window list. */
-   InsertTailList (&PsGetCurrentThreadWin32Thread()->WindowListHead, &Window->ThreadListEntry);
+   InsertTailList (&pti->WindowListHead, &Window->ThreadListEntry);
 
    /*  Handle "CS_CLASSDC", it is tested first. */
    if ((Wnd->Class->Style & CS_CLASSDC) && !(Wnd->Class->Dce)) // One DCE per class to have CLASS.
@@ -1842,7 +1844,7 @@
       PRTL_USER_PROCESS_PARAMETERS ProcessParams;
       BOOL CalculatedDefPosSize = FALSE;
 
-      IntGetDesktopWorkArea(((PW32THREAD)Window->OwnerThread->Tcb.Win32Thread)->Desktop, &WorkArea);
+      IntGetDesktopWorkArea(((PTHREADINFO)Window->OwnerThread->Tcb.Win32Thread)->Desktop, &WorkArea);
 
       rc = WorkArea;
       ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters;
@@ -3650,7 +3652,7 @@
             /*
              * Remove extended window style bit WS_EX_TOPMOST for shell windows.
              */
-            WindowStation = ((PW32THREAD)Window->OwnerThread->Tcb.Win32Thread)->Desktop->WindowStation;
+            WindowStation = ((PTHREADINFO)Window->OwnerThread->Tcb.Win32Thread)->Desktop->WindowStation;
             if(WindowStation)
             {
                if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
@@ -4485,6 +4487,7 @@
 
    if ((DesktopWindow = UserGetWindowObject(IntGetDesktopWindow())))
    {
+      PTHREADINFO pti;
       USHORT Hit;
 
       pt.x = X;
@@ -4494,7 +4497,8 @@
       //its possible this referencing is useless, thou it shouldnt hurt...
       UserRefObjectCo(DesktopWindow, &Ref);
 
-      Hit = co_WinPosWindowFromPoint(DesktopWindow, PsGetCurrentThreadWin32Thread()->MessageQueue, &pt, &Window);
+      pti = PsGetCurrentThreadWin32Thread();
+      Hit = co_WinPosWindowFromPoint(DesktopWindow, pti->MessageQueue, &pt, &Window);
 
       if(Window)
       {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -257,7 +257,8 @@
    if (!Wnd->InternalPosInitialized)
    {
       RECT WorkArea;
-      PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop; /* Or rather get it from the window? */
+      PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+      PDESKTOP_OBJECT Desktop = pti->Desktop; /* Or rather get it from the window? */
 
       Parent = Window->Parent;
       if(Parent)
@@ -401,7 +402,8 @@
 {
    UINT XInc, YInc;
    RECT WorkArea;
-   PDESKTOP_OBJECT Desktop = PsGetCurrentThreadWin32Thread()->Desktop; /* Or rather get it from the window? */
+   PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+   PDESKTOP_OBJECT Desktop = pti->Desktop; /* Or rather get it from the window? */
 
    IntGetDesktopWorkArea(Desktop, &WorkArea);
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -918,6 +918,7 @@
 UserGetProcessWindowStation(VOID)
 {
    NTSTATUS Status;
+   PTHREADINFO pti;
    HWINSTA WinSta;
 
    if(PsGetCurrentProcess() != CsrProcess)
@@ -927,7 +928,8 @@
    else
    {
       DPRINT1("Should use ObFindHandleForObject\n");
-      Status = ObOpenObjectByPointer(PsGetCurrentThreadWin32Thread()->Desktop->WindowStation,
+      pti = PsGetCurrentThreadWin32Thread();
+      Status = ObOpenObjectByPointer(pti->Desktop->WindowStation,
                                      0,
                                      NULL,
                                      WINSTA_ALL_ACCESS,
@@ -970,7 +972,7 @@
 IntGetWinStaObj(VOID)
 {
    PWINSTATION_OBJECT WinStaObj;
-   PW32THREAD Win32Thread;
+   PTHREADINFO Win32Thread;
    PEPROCESS CurrentProcess;
 
    /*

Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c?rev=36769&r1=36768&r2=36769&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Thu Oct 16 12:52:38 2008
@@ -366,7 +366,7 @@
         PrevProcId = _InterlockedCompareExchangePointer((PVOID*)&Entry->ProcessId, LockedProcessId, 0);
         if (PrevProcId == NULL)
         {
-            PW32THREAD Thread = PsGetCurrentThreadWin32Thread();
+            PW32THREAD Thread = (PW32THREAD)PsGetCurrentThreadWin32Thread();
             HGDIOBJ Handle;
 
             Entry->KernelData = newObject;
@@ -803,7 +803,7 @@
             if ( (Entry->KernelData != NULL) &&
                  ((Entry->Type << GDI_ENTRY_UPPER_SHIFT) == HandleUpper) )
             {
-                PW32THREAD Thread = PsGetCurrentThreadWin32Thread();
+                PW32THREAD Thread = (PW32THREAD)PsGetCurrentThreadWin32Thread();
                 Object = Entry->KernelData;
 
                 if (Object->cExclusiveLock == 0)
@@ -1046,7 +1046,7 @@
 
     DPRINT("GDIOBJ_ConvertToStockObj: hObj: 0x%08x\n", hObj);
 
-    Thread = PsGetCurrentThreadWin32Thread();
+    Thread = (PW32THREAD)PsGetCurrentThreadWin32Thread();
 
     if (!GDI_HANDLE_IS_STOCKOBJ(hObj))
     {
@@ -1172,7 +1172,7 @@
 
     DPRINT("GDIOBJ_SetOwnership: hObj: 0x%x, NewProcess: 0x%x\n", ObjectHandle, (NewOwner ? PsGetProcessId(NewOwner) : 0));
 
-    Thread = PsGetCurrentThreadWin32Thread();
+    Thread = (PW32THREAD)PsGetCurrentThreadWin32Thread();
 
     if (!GDI_HANDLE_IS_STOCKOBJ(ObjectHandle))
     {
@@ -1301,7 +1301,7 @@
 
     DPRINT("GDIOBJ_CopyOwnership: from: 0x%x, to: 0x%x\n", CopyFrom, CopyTo);
 
-    Thread = PsGetCurrentThreadWin32Thread();
+    Thread = (PW32THREAD)PsGetCurrentThreadWin32Thread();
 
     if (!GDI_HANDLE_IS_STOCKOBJ(CopyFrom) && !GDI_HANDLE_IS_STOCKOBJ(CopyTo))
     {



More information about the Ros-diffs mailing list