- Update KTHREAD and KUSER_SHARED_DATA to latest versions. This should make 2K3 drive...
authorAlex Ionescu <aionescu@gmail.com>
Tue, 8 Nov 2005 08:56:41 +0000 (08:56 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Tue, 8 Nov 2005 08:56:41 +0000 (08:56 +0000)
- Update KAPC and DISPATCHER_HEADER to latest DDK definitions.

svn path=/trunk/; revision=19053

15 files changed:
reactos/include/ndk/arch/ketypes.h
reactos/include/ndk/asm.h
reactos/include/ndk/ketypes.h
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ke/i386/exp.c
reactos/ntoskrnl/ke/i386/fpu.c
reactos/ntoskrnl/ke/kthread.c
reactos/subsys/win32k/ntuser/desktop.c
reactos/subsys/win32k/ntuser/hook.c
reactos/subsys/win32k/ntuser/input.c
reactos/subsys/win32k/ntuser/message.c
reactos/subsys/win32k/ntuser/misc.c
reactos/subsys/win32k/ntuser/painting.c
reactos/subsys/win32k/ntuser/window.c
reactos/w32api/include/ddk/winddk.h

index 677629a..c47934e 100644 (file)
 /* Shared structures needed by Arch-specific headers */
 typedef struct _KDPC_DATA
 {
-    LIST_ENTRY  DpcListHead;
-    ULONG  DpcLock;
-    ULONG  DpcQueueDepth;
-    ULONG  DpcCount;
+    LIST_ENTRY DpcListHead;
+    ULONG DpcLock;
+    ULONG DpcQueueDepth;
+    ULONG DpcCount;
 } KDPC_DATA, *PKDPC_DATA;
 
 typedef struct _PP_LOOKASIDE_LIST
index d676d14..708ebac 100644 (file)
 #define KTHREAD_DEBUG_ACTIVE            0x03
 #define KTHREAD_INITIAL_STACK           0x18
 #define KTHREAD_STACK_LIMIT             0x1C
-#define KTHREAD_TEB                     0x20
-#define KTHREAD_KERNEL_STACK            0x28
-#define KTHREAD_NPX_STATE               0x31
-#define KTHREAD_STATE                   0x2D
-#define KTHREAD_ALERTED                 0x2E
-#define KTHREAD_APCSTATE_PROCESS        0x34 + 0x10
-#define KTHREAD_PENDING_USER_APC        0x34 + 0x16
-#define KTHREAD_PENDING_KERNEL_APC      0x34 + 0x15
-#define KTHREAD_CONTEXT_SWITCHES        0x4C
-#define KTHREAD_WAIT_IRQL               0x54
-#define KTHREAD_SERVICE_TABLE           0xDC
-#define KTHREAD_PREVIOUS_MODE           0x137
-#define KTHREAD_TRAP_FRAME              0x128
-#define KTHREAD_CALLBACK_STACK          0x120
+#define KTHREAD_TEB                     0x74
+#define KTHREAD_KERNEL_STACK            0x20
+#define KTHREAD_NPX_STATE               0x4D
+#define KTHREAD_STATE                   0x4C
+#define KTHREAD_ALERTED                 0x5E
+#define KTHREAD_APCSTATE_PROCESS        0x28 + 0x10
+#define KTHREAD_PENDING_USER_APC        0x28 + 0x16
+#define KTHREAD_PENDING_KERNEL_APC      0x28 + 0x15
+#define KTHREAD_CONTEXT_SWITCHES        0x48
+#define KTHREAD_WAIT_IRQL               0x4E
+#define KTHREAD_SERVICE_TABLE           0x118
+#define KTHREAD_PREVIOUS_MODE           0xD7
+#define KTHREAD_TRAP_FRAME              0x110
+#define KTHREAD_CALLBACK_STACK          0x114
 
 #define KPROCESS_DIRECTORY_TABLE_BASE   0x18
 #define KPROCESS_LDT_DESCRIPTOR0        0x20
index 342a644..2f89577 100644 (file)
 
 /* CONSTANTS *****************************************************************/
 #define SSDT_MAX_ENTRIES 4
-#define PROCESSOR_FEATURE_MAX 64
 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
 
 #ifdef NTOS_MODE_USER
 #define SharedUserData ((KUSER_SHARED_DATA * CONST) USER_SHARED_DATA)
+#define MAX_WOW64_SHARED_ENTRIES 16
+#define PROCESSOR_FEATURE_MAX 64
 #endif
 
 /* ENUMERATIONS **************************************************************/
@@ -216,12 +217,19 @@ typedef struct _KUSER_SHARED_DATA
     ULONG NumberOfPhysicalPages;
     BOOLEAN SafeBootMode;
     ULONG TraceLogging;
-    ULONGLONG Fill0;
-    ULONGLONG SystemCall[4];
+    ULONG Fill0;
+    ULONGLONG TestRetInstruction;
+    ULONG SystemCall;
+    ULONG SystemCallReturn;
+    ULONGLONG SystemCallPad[3];
     union {
         volatile KSYSTEM_TIME TickCount;
         volatile ULONG64 TickCountQuad;
     };
+    ULONG Cookie;
+    LONGLONG ConsoleSessionForegroundProcessId;
+    ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
+    ULONG UserModeGlobalLogging;
 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
 #endif
 
@@ -347,89 +355,179 @@ typedef enum _KOBJECTS
 
 typedef struct _KTHREAD
 {
-    DISPATCHER_HEADER DispatcherHeader;    /* 00 */
-    LIST_ENTRY        MutantListHead;      /* 10 */
-    PVOID             InitialStack;        /* 18 */
-    ULONG_PTR         StackLimit;          /* 1C */
-    struct _TEB       *Teb;                /* 20 */
-    PVOID             TlsArray;            /* 24 */
-    PVOID             KernelStack;         /* 28 */
-    UCHAR             DebugActive;         /* 2C */
-    UCHAR             State;               /* 2D */
-    BOOLEAN           Alerted[2];          /* 2E */
-    UCHAR             Iopl;                /* 30 */
-    UCHAR             NpxState;            /* 31 */
-    CHAR              Saturation;          /* 32 */
-    CHAR              Priority;            /* 33 */
-    KAPC_STATE        ApcState;            /* 34 */
-    ULONG             ContextSwitches;     /* 4C */
-    LONG              WaitStatus;          /* 50 */
-    KIRQL             WaitIrql;            /* 54 */
-    CHAR              WaitMode;            /* 55 */
-    UCHAR             WaitNext;            /* 56 */
-    UCHAR             WaitReason;          /* 57 */
-    union                                  /* 58 */
-    {
-        PKWAIT_BLOCK  WaitBlockList;       /* 58 */
-        PKGATE        GateObject;          /* 58 */
-    };                                     /* 58 */
-    LIST_ENTRY        WaitListEntry;       /* 5C */
-    ULONG             WaitTime;            /* 64 */
-    CHAR              BasePriority;        /* 68 */
-    UCHAR             DecrementCount;      /* 69 */
-    UCHAR             PriorityDecrement;   /* 6A */
-    CHAR              Quantum;             /* 6B */
-    KWAIT_BLOCK       WaitBlock[4];        /* 6C */
-    PVOID             LegoData;            /* CC */
-    union
-    {
-        struct
-        {
-            USHORT    KernelApcDisable;
-            USHORT    SpecialApcDisable;
-        };
-        ULONG         CombinedApcDisable;  /* D0 */
-    };
-    KAFFINITY         UserAffinity;        /* D4 */
-    UCHAR             SystemAffinityActive;/* D8 */
-    UCHAR             PowerState;          /* D9 */
-    UCHAR             NpxIrql;             /* DA */
-    UCHAR             Pad[1];              /* DB */
-    PVOID             ServiceTable;        /* DC */
-    struct _KQUEUE    *Queue;              /* E0 */
-    KSPIN_LOCK        ApcQueueLock;        /* E4 */
-    KTIMER            Timer;               /* E8 */
-    LIST_ENTRY        QueueListEntry;      /* 110 */
-    KAFFINITY         Affinity;            /* 118 */
-    UCHAR             Preempted;           /* 11C */
-    UCHAR             ProcessReadyQueue;   /* 11D */
-    UCHAR             KernelStackResident; /* 11E */
-    UCHAR             NextProcessor;       /* 11F */
-    PVOID             CallbackStack;       /* 120 */
-    struct _W32THREAD *Win32Thread;        /* 124 */
-    struct _KTRAP_FRAME *TrapFrame;        /* 128 */
-    PKAPC_STATE       ApcStatePointer[2];  /* 12C */
-    UCHAR             EnableStackSwap;     /* 134 */
-    UCHAR             LargeStack;          /* 135 */
-    UCHAR             ResourceIndex;       /* 136 */
-    UCHAR             PreviousMode;        /* 137 */
-    ULONG             KernelTime;          /* 138 */
-    ULONG             UserTime;            /* 13C */
-    KAPC_STATE        SavedApcState;       /* 140 */
-    UCHAR             Alertable;           /* 158 */
-    UCHAR             ApcStateIndex;       /* 159 */
-    UCHAR             ApcQueueable;        /* 15A */
-    UCHAR             AutoAlignment;       /* 15B */
-    PVOID             StackBase;           /* 15C */
-    KAPC              SuspendApc;          /* 160 */
-    KSEMAPHORE        SuspendSemaphore;    /* 190 */
-    LIST_ENTRY        ThreadListEntry;     /* 1A4 */
-    CHAR              FreezeCount;         /* 1AC */
-    UCHAR             SuspendCount;        /* 1AD */
-    UCHAR             IdealProcessor;      /* 1AE */
-    UCHAR             DisableBoost;        /* 1AF */
-    UCHAR             QuantumReset;        /* 1B0 */
-} KTHREAD;
+    DISPATCHER_HEADER DispatcherHeader;                 /* 00 */
+    LIST_ENTRY MutantListHead;                          /* 10 */
+    PVOID InitialStack;                                 /* 18 */
+    ULONG_PTR StackLimit;                               /* 1C */
+    PVOID KernelStack;                                  /* 20 */
+    KSPIN_LOCK ThreadLock;                              /* 24 */
+    union                                               /* 28 */
+    {                                                   /* 28 */
+        KAPC_STATE ApcState;                            /* 34 */
+        struct                                          /* 28 */
+        {                                               /* 28 */
+            UCHAR ApcStateFill[23];                     /* 34 */
+            UCHAR ApcQueueable;                         /* 3F */
+        };                                              /* 3F */
+    };                                                  /* 3F */
+    UCHAR NextProcessor;                                /* 40 */
+    UCHAR DeferredProcessor;                            /* 41 */
+    UCHAR AdjustReason;                                 /* 42 */
+    UCHAR AdjustIncrement;                              /* 43 */
+    KSPIN_LOCK ApcQueueLock;                            /* 44 */
+    ULONG ContextSwitches;                              /* 48 */
+    UCHAR State;                                        /* 4C */
+    UCHAR NpxState;                                     /* 4D */
+    UCHAR WaitIrql;                                     /* 4E */
+    UCHAR WaitMode;                                     /* 4F */
+    LONG WaitStatus;                                    /* 50 */
+    union                                               /* 54 */
+    {                                                   /* 54 */
+        PKWAIT_BLOCK WaitBlockList;                     /* 54 */
+        PKGATE GateObject;                              /* 54 */
+    };                                                  /* 54 */
+    UCHAR Alertable;                                    /* 58 */
+    UCHAR WaitNext;                                     /* 59 */
+    UCHAR WaitReason;                                   /* 5A */
+    UCHAR Priority;                                     /* 5B */
+    UCHAR EnableStackSwap;                              /* 5C */
+    UCHAR SwapBusy;                                     /* 5D */
+    UCHAR Alerted[2];                                   /* 5E */
+    union                                               /* 60 */
+    {                                                   /* 60 */
+        LIST_ENTRY WaitListEntry;                       /* 60 */
+        SINGLE_LIST_ENTRY SwapListEntry;                /* 60 */
+    };                                                  /* 68 */
+    PKQUEUE Queue;                                      /* 68 */
+    ULONG WaitTime;                                     /* 6C */
+    union                                               /* 70 */
+    {                                                   /* 70 */
+        struct                                          /* 70 */
+        {                                               /* 70 */
+            USHORT KernelApcDisable;                    /* 70 */
+            USHORT SpecialApcDisable;                   /* 72 */
+        };                                              /* 70 */
+        ULONG CombinedApcDisable;                       /* 70 */
+    };                                                  /* 74 */
+    struct _TEB *Teb;                                   /* 74 */
+    union                                               /* 78 */
+    {                                                   /* 78 */
+        KTIMER Timer;                                   /* 78 */
+        UCHAR TimerFill[40];                            /* 78 */
+    };                                                  /* 78 */
+    union                                               /* A0 */
+    {                                                   /* A0 */
+        struct                                          /* A0 */
+        {                                               /* A0 */
+            LONG AutoAlignment:1;                       /* A0 */
+            LONG DisableBoost:1;                        /* A0 */
+            LONG ReservedFlags:30;                      /* A0 */
+        };                                              /* A0 */
+        LONG ThreadFlags;                               /* A0 */
+    };                                                  /* A0 */
+    PVOID Padding;                                      /* A4 */
+    union                                               /* A8 */
+    {                                                   /* A8 */
+        KWAIT_BLOCK WaitBlock[4];                       /* A8 */
+        union                                           /* A8 */
+        {                                               /* A8 */
+            struct                                      /* A8 */
+            {                                           /* A8 */
+                UCHAR WaitBlockFill0[23];               /* A8 */
+                UCHAR SystemAffinityActive;             /* BF */
+            };                                          /* A8 */
+            struct                                      /* A8 */
+            {                                           /* A8 */
+                UCHAR WaitBlockFill1[47];               /* A8 */
+                UCHAR PreviousMode;                     /* D7 */
+            };                                          /* A8 */
+            struct                                      /* A8 */
+            {                                           /* A8 */
+                UCHAR WaitBlockFill2[71];               /* A8 */
+                UCHAR ResourceIndex;                    /* EF */
+            };                                          /* A8 */
+            struct                                      /* A8 */
+            {                                           /* A8 */
+                UCHAR WaitBlockFill3[95];               /* A8 */
+                UCHAR LargeStack;                       /* 107 */
+            };                                          /* A8 */
+        };                                              /* A8 */
+    };                                                  /* A8 */
+    LIST_ENTRY QueueListEntry;                          /* 108 */
+    PKTRAP_FRAME TrapFrame;                             /* 110 */
+    PVOID CallbackStack;                                /* 114 */
+    PVOID ServiceTable;                                 /* 118 */
+    UCHAR ApcStateIndex;                                /* 11C */
+    UCHAR IdealProcessor;                               /* 11D */
+    UCHAR Preempted;                                    /* 11E */
+    UCHAR ProcessReadyQueue;                            /* 11F */
+    UCHAR KernelStackResident;                          /* 120 */
+    CHAR BasePriority;                                  /* 121 */
+    CHAR PriorityDecrement;                             /* 122 */
+    CHAR Saturation;                                    /* 123 */
+    KAFFINITY UserAffinity;                             /* 124 */
+    struct _KPROCESS *Process;                          /* 128 */
+    KAFFINITY Affinity;                                 /* 12C */
+    PKAPC_STATE ApcStatePointer[2];                     /* 130 */
+    union                                               /* 138 */
+    {                                                   /* 138 */
+        KAPC_STATE SavedApcState;                       /* 138 */
+        union                                           /* 138 */
+        {                                               /* 138 */
+            UCHAR SavedApcStateFill[23];                /* 138 */
+            CHAR FreezeCount;                           /* 14F */
+        };                                              /* 138 */
+    };                                                  /* 138 */
+    CHAR SuspendCount;                                  /* 150 */
+    UCHAR UserIdealProcessor;                           /* 151 */
+    UCHAR CalloutActive;                                /* 152 */
+    UCHAR Iopl;                                         /* 153 */
+    PVOID Win32Thread;                                  /* 154 */
+    PVOID StackBase;                                    /* 158 */
+    union                                               /* 15C */
+    {                                                   /* 15C */
+        KAPC SuspendApc;                                /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill0[1];                   /* 15C */
+            CHAR Quantum;                               /* 15D */
+        };                                              /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill1[3];                   /* 15C */
+            UCHAR QuantumReset;                         /* 15F */
+        };                                              /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill2[4];                   /* 15C */
+            ULONG KernelTime;                           /* 160 */
+        };                                              /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill3[36];                  /* 15C */
+            PVOID TlsArray;                             /* 180 */
+        };                                              /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill4[40];                  /* 15C */
+            PVOID LegoData;                             /* 184 */
+        };                                              /* 15C */
+        union                                           /* 15C */
+        {                                               /* 15C */
+            UCHAR SuspendApcFill5[47];                  /* 15C */
+            UCHAR PowerState;                           /* 18B */
+        };                                              /* 15C */
+    };                                                  /* 15C */
+    ULONG UserTime;                                     /* 18C */
+    union                                               /* 190 */
+    {                                                   /* 190 */
+        KSEMAPHORE SuspendSemaphore;                    /* 190 */
+        UCHAR SuspendSemaphorefill[20];                 /* 190 */
+    };                                                  /* 190 */
+    ULONG SListFaultCount;                              /* 1A4 */
+    LIST_ENTRY ThreadListEntry;                         /* 1A8 */
+    PVOID SListFaultAddress;                            /* 1B0 */
+} KTHREAD;                                              /* sizeof: 1B4 */
 
 #include <poppack.h>
 
index 8047717..5150cb0 100644 (file)
@@ -229,6 +229,7 @@ ExecuteRuntimeAsserts(VOID)
      * Fail at runtime if someone has changed various structures without
      * updating the offsets used for the assembler code.
      */
+    ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCall) == 0x300);
     ASSERT(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK);
     ASSERT(FIELD_OFFSET(KTHREAD, Teb) == KTHREAD_TEB);
     ASSERT(FIELD_OFFSET(KTHREAD, KernelStack) == KTHREAD_KERNEL_STACK);
index 8271fc7..0d7d18d 100644 (file)
@@ -806,7 +806,7 @@ KeContextToTrapFrame(IN PCONTEXT Context,
         if (PreviousMode != KernelMode)
         {
             /* Set the Debug Flag */
-            KeGetCurrentThread()->DebugActive = (Context->Dr7 & DR7_ACTIVE);
+            KeGetCurrentThread()->DispatcherHeader.DebugActive = (Context->Dr7 & DR7_ACTIVE);
         }
     }
 
index 43e83ae..1a0447d 100644 (file)
@@ -571,7 +571,7 @@ KeSaveFloatingPointState(OUT PKFLOATING_SAVE Save)
 #error Unknown compiler for inline assembler
 #endif
 
-    KeGetCurrentThread()->NpxIrql = KeGetCurrentIrql();
+    KeGetCurrentThread()->DispatcherHeader.NpxIrql = KeGetCurrentIrql();
 
     return STATUS_SUCCESS;
 }
@@ -582,7 +582,7 @@ KeRestoreFloatingPointState(IN PKFLOATING_SAVE Save)
 {
     PFNSAVE_FORMAT FpState = *((PVOID *) Save);
 
-    if (KeGetCurrentThread()->NpxIrql != KeGetCurrentIrql())
+    if (KeGetCurrentThread()->DispatcherHeader.NpxIrql != KeGetCurrentIrql())
     {
         KEBUGCHECK(UNDEFINED_BUG_CODE);
     }
index 44f21bb..40b997e 100644 (file)
@@ -1259,7 +1259,6 @@ KeSetBasePriorityThread (PKTHREAD Thread,
     Thread->BasePriority = BasePriority;
 
     /* Reset the decrements */
-    Thread->DecrementCount = 0;
     Thread->PriorityDecrement = 0;
 
     /* If the priority will change, reset quantum and change it for real */
@@ -1303,7 +1302,6 @@ KeSetPriorityThread(PKTHREAD Thread,
 
     /* Reset the Quantum and Decrements */
     Thread->Quantum = Thread->QuantumReset;
-    Thread->DecrementCount = 0;
     Thread->PriorityDecrement = 0;
 
     /* Set the new Priority */
index f3fc283..9c89b69 100644 (file)
@@ -1432,14 +1432,14 @@ NtUserGetThreadDesktop(DWORD dwThreadId, DWORD Unknown1)
    {
       /* just return the handle, we queried the desktop handle of a thread running
          in the same context */
-      Ret = Thread->Tcb.Win32Thread->hDesktop;
+      Ret = ((PW32THREAD)Thread->Tcb.Win32Thread)->hDesktop;
       ObDereferenceObject(Thread);
       RETURN(Ret);
    }
 
    /* get the desktop handle and the desktop of the thread */
-   if(!(hThreadDesktop = Thread->Tcb.Win32Thread->hDesktop) ||
-         !(DesktopObject = Thread->Tcb.Win32Thread->Desktop))
+   if(!(hThreadDesktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->hDesktop) ||
+         !(DesktopObject = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop))
    {
       ObDereferenceObject(Thread);
       DPRINT1("Desktop information of thread 0x%x broken!?\n", dwThreadId);
index 5948ae6..b3fcfa0 100644 (file)
@@ -90,7 +90,7 @@ STATIC FASTCALL PHOOK
 IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinStaObj)
 {
    PHOOK Hook;
-   PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(Thread->Tcb.Win32Thread->MessageQueue);
+   PHOOKTABLE Table = Global ? GlobalHooks : MsqGetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue);
    HANDLE Handle;
 
    if (NULL == Table)
@@ -106,7 +106,7 @@ IntAddHook(PETHREAD Thread, int HookId, BOOLEAN Global, PWINSTATION_OBJECT WinSt
       }
       else
       {
-         MsqSetHooks(Thread->Tcb.Win32Thread->MessageQueue, Table);
+         MsqSetHooks(((PW32THREAD)Thread->Tcb.Win32Thread)->MessageQueue, Table);
       }
    }
 
@@ -136,7 +136,7 @@ IntGetTable(PHOOK Hook)
       return GlobalHooks;
    }
 
-   return MsqGetHooks(Hook->Thread->Tcb.Win32Thread->MessageQueue);
+   return MsqGetHooks(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue);
 }
 
 /* get the first hook in the chain */
@@ -272,7 +272,7 @@ IntCallLowLevelHook(INT HookId, INT Code, WPARAM wParam, LPARAM lParam, PHOOK Ho
 
    /* FIXME should get timeout from
     * HKEY_CURRENT_USER\Control Panel\Desktop\LowLevelHooksTimeout */
-   Status = co_MsqSendMessage(Hook->Thread->Tcb.Win32Thread->MessageQueue, (HWND) Code, HookId,
+   Status = co_MsqSendMessage(((PW32THREAD)Hook->Thread->Tcb.Win32Thread)->MessageQueue, (HWND) Code, HookId,
                               wParam, lParam, 5000, TRUE, TRUE, &uResult);
 
    return NT_SUCCESS(Status) ? uResult : 0;
index 5860b49..4d8e545 100644 (file)
@@ -670,14 +670,14 @@ KeyboardThreadMain(PVOID StartContext)
             FocusThread = FocusQueue->Thread;
 
             if (!(FocusThread && FocusThread->Tcb.Win32Thread &&
-                  FocusThread->Tcb.Win32Thread->KeyboardLayout))
+                  ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout))
                continue;
 
             /* This function uses lParam to fill wParam according to the
              * keyboard layout in use.
              */
             W32kKeyProcessMessage(&msg,
-                                  FocusThread->Tcb.Win32Thread->KeyboardLayout,
+                                  ((PW32THREAD)FocusThread->Tcb.Win32Thread)->KeyboardLayout,
                                   KeyInput.Flags & KEY_E0 ? 0xE0 :
                                   (KeyInput.Flags & KEY_E1 ? 0xE1 : 0));
 
index 22861a3..7e90408 100644 (file)
@@ -1283,7 +1283,7 @@ NtUserPostThreadMessage(DWORD idThread,
 
    if( Status == STATUS_SUCCESS )
    {
-      pThread = peThread->Tcb.Win32Thread;
+      pThread = (PW32THREAD)peThread->Tcb.Win32Thread;
       if( !pThread || !pThread->MessageQueue )
       {
          ObDereferenceObject( peThread );
@@ -1780,18 +1780,18 @@ CLEANUP:
 BOOL STDCALL
 IntInitMessagePumpHook()
 {
-   PsGetCurrentThread()->Tcb.Win32Thread->MessagePumpHookValue++;
+   ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessagePumpHookValue++;
    return TRUE;
 }
 
 BOOL STDCALL
 IntUninitMessagePumpHook()
 {
-   if (PsGetCurrentThread()->Tcb.Win32Thread->MessagePumpHookValue <= 0)
+   if (((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessagePumpHookValue <= 0)
    {
       return FALSE;
    }
-   PsGetCurrentThread()->Tcb.Win32Thread->MessagePumpHookValue--;
+   ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessagePumpHookValue--;
    return TRUE;
 }
 
index 2bfc633..28ff45f 100644 (file)
@@ -459,7 +459,7 @@ NtUserCallTwoParam(
 
       case TWOPARAM_ROUTINE_SETGUITHRDHANDLE:
          {
-            PUSER_MESSAGE_QUEUE MsgQueue = PsGetCurrentThread()->Tcb.Win32Thread->MessageQueue;
+            PUSER_MESSAGE_QUEUE MsgQueue = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->MessageQueue;
 
             ASSERT(MsgQueue);
             RETURN( (DWORD)MsqSetStateWindow(MsgQueue, (ULONG)Param1, (HWND)Param2));
@@ -1333,12 +1333,12 @@ NtUserGetGUIThreadInfo(
          SetLastWin32Error(ERROR_ACCESS_DENIED);
          RETURN( FALSE);
       }
-      Desktop = Thread->Tcb.Win32Thread->Desktop;
+      Desktop = ((PW32THREAD)Thread->Tcb.Win32Thread)->Desktop;
    }
    else
    {
       /* get the foreground thread */
-      PW32THREAD W32Thread = PsGetCurrentThread()->Tcb.Win32Thread;
+      PW32THREAD W32Thread = (PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread;
       Desktop = W32Thread->Desktop;
       if(Desktop)
       {
index 9b350b7..acfcf84 100644 (file)
@@ -671,7 +671,7 @@ co_IntFixCaret(PWINDOW_OBJECT Window, LPRECT lprc, UINT flags)
 
    ASSERT_REFS_CO(Window);
 
-   Desktop = PsGetCurrentThread()->Tcb.Win32Thread->Desktop;
+   Desktop = ((PW32THREAD)PsGetCurrentThread()->Tcb.Win32Thread)->Desktop;
    CaretInfo = ((PUSER_MESSAGE_QUEUE)Desktop->ActiveMessageQueue)->CaretInfo;
    hWndCaret = CaretInfo->hWnd;
 
index a4f5ee1..7afc46f 100644 (file)
@@ -571,7 +571,7 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread)
    PLIST_ENTRY Current;
    PWINDOW_OBJECT Wnd;
    USER_REFERENCE_ENTRY Ref;
-   WThread = Thread->Tcb.Win32Thread;
+   WThread = (PW32THREAD)Thread->Tcb.Win32Thread;
    
    while (!IsListEmpty(&WThread->WindowListHead))
    {
@@ -1121,7 +1121,7 @@ NtUserBuildHwndList(
          SetLastWin32Error(ERROR_INVALID_PARAMETER);
          return 0;
       }
-      if(!(W32Thread = Thread->Tcb.Win32Thread))
+      if(!(W32Thread = (PW32THREAD)Thread->Tcb.Win32Thread))
       {
          ObDereferenceObject(Thread);
          DPRINT("Thread is not a GUI Thread!\n");
@@ -1622,7 +1622,7 @@ co_IntCreateWindowEx(DWORD dwExStyle,
       PRTL_USER_PROCESS_PARAMETERS ProcessParams;
       BOOL CalculatedDefPosSize = FALSE;
 
-      IntGetDesktopWorkArea(Window->OwnerThread->Tcb.Win32Thread->Desktop, &WorkArea);
+      IntGetDesktopWorkArea(((PW32THREAD)Window->OwnerThread->Tcb.Win32Thread)->Desktop, &WorkArea);
 
       rc = WorkArea;
       ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters;
@@ -3363,7 +3363,7 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
             /*
              * Remove extended window style bit WS_EX_TOPMOST for shell windows.
              */
-            WindowStation = Window->OwnerThread->Tcb.Win32Thread->Desktop->WindowStation;
+            WindowStation = ((PW32THREAD)Window->OwnerThread->Tcb.Win32Thread)->Desktop->WindowStation;
             if(WindowStation)
             {
                if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
index 490b464..e7dc0f7 100644 (file)
@@ -394,6 +394,7 @@ extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
 extern NTOSAPI CCHAR KeNumberProcessors;
 
 #define PROCESSOR_FEATURE_MAX 64
+#define MAX_WOW64_SHARED_ENTRIES 16
 
 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE 
 {
@@ -418,12 +419,12 @@ typedef struct _KUSER_SHARED_DATA
     volatile KSYSTEM_TIME TimeZoneBias;
     USHORT ImageNumberLow;
     USHORT ImageNumberHigh;
-    WCHAR NtSystemRoot[ 260 ];
+    WCHAR NtSystemRoot[260];
     ULONG MaxStackTraceDepth;
     ULONG CryptoExponent;
     ULONG TimeZoneId;
     ULONG LargePageMinimum;
-    ULONG Reserved2[ 7 ];
+    ULONG Reserved2[7];
     NT_PRODUCT_TYPE NtProductType;
     BOOLEAN ProductTypeIsValid;
     ULONG NtMajorVersion;
@@ -443,12 +444,19 @@ typedef struct _KUSER_SHARED_DATA
     ULONG NumberOfPhysicalPages;
     BOOLEAN SafeBootMode;
     ULONG TraceLogging;
-    ULONGLONG   Fill0;
-    ULONGLONG   SystemCall[4];
+    ULONG Fill0;
+    ULONGLONG TestRetInstruction;
+    ULONG SystemCall;
+    ULONG SystemCallReturn;
+    ULONGLONG SystemCallPad[3];
     union {
         volatile KSYSTEM_TIME TickCount;
         volatile ULONG64 TickCountQuad;
     };
+    ULONG Cookie;
+    LONGLONG ConsoleSessionForegroundProcessId;
+    ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
+    ULONG UserModeGlobalLogging;
 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
 
 /*
@@ -929,21 +937,24 @@ typedef BOOLEAN
 (DDKAPI *PKTRANSFER_ROUTINE)(
   VOID);
 
-typedef struct _KAPC {
-  CSHORT  Type;
-  CSHORT  Size;
-  ULONG  Spare0;
-  struct _KTHREAD  *Thread;
-  LIST_ENTRY  ApcListEntry;
-  PKKERNEL_ROUTINE  KernelRoutine;
-  PKRUNDOWN_ROUTINE  RundownRoutine;
-  PKNORMAL_ROUTINE  NormalRoutine;
-  PVOID  NormalContext;
-  PVOID  SystemArgument1;
-  PVOID  SystemArgument2;
-  CCHAR  ApcStateIndex;
-  KPROCESSOR_MODE  ApcMode;
-  BOOLEAN  Inserted;
+typedef struct _KAPC
+{
+    UCHAR Type;
+    UCHAR SpareByte0;
+    UCHAR Size;
+    UCHAR SpareByte1;
+    ULONG SpareLong0;
+    struct _KTHREAD *Thread;
+    LIST_ENTRY ApcListEntry;
+    PKKERNEL_ROUTINE KernelRoutine;
+    PKRUNDOWN_ROUTINE RundownRoutine;
+    PKNORMAL_ROUTINE NormalRoutine;
+    PVOID NormalContext;
+    PVOID SystemArgument1;
+    PVOID SystemArgument2;
+    CCHAR ApcStateIndex;
+    KPROCESSOR_MODE ApcMode;
+    BOOLEAN Inserted;
 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
 
 typedef struct _KDEVICE_QUEUE {
@@ -1015,13 +1026,33 @@ typedef struct _WAIT_CONTEXT_BLOCK {
   PKDPC  BufferChainingDpc;
 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
 
-typedef struct _DISPATCHER_HEADER {
-  UCHAR  Type;
-  UCHAR  Absolute;
-  UCHAR  Size;
-  UCHAR  Inserted;
-  LONG  SignalState;
-  LIST_ENTRY  WaitListHead;
+typedef struct _DISPATCHER_HEADER
+{
+    union
+    {
+        struct
+        {
+            UCHAR Type;
+            union
+            {
+                UCHAR Absolute;
+                UCHAR NpxIrql;
+            };
+            union
+            {
+                UCHAR Size;
+                UCHAR Hand;
+            };
+            union
+            {
+                UCHAR Inserted;
+                BOOLEAN DebugActive;
+            };
+        };
+        volatile LONG Lock;
+    };
+    LONG SignalState;
+    LIST_ENTRY WaitListHead;
 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
 
 typedef struct _KEVENT {