[ros-diffs] [ion] 25481: - Fix major bugs in the definition of _KTHREAD inside the NDK. I made some stupid assumptions when reading the .pdb dump data. _KTHREAD should now be the right size and structure as Win 2003. (the reason this bug wasn't more evident was because we were using 1-byte packing and a "padding" field. this has now been removed).

ion at svn.reactos.org ion at svn.reactos.org
Tue Jan 16 03:40:41 CET 2007


Author: ion
Date: Tue Jan 16 05:40:41 2007
New Revision: 25481

URL: http://svn.reactos.org/svn/reactos?rev=25481&view=rev
Log:
- Fix major bugs in the definition of _KTHREAD inside the NDK. I made some stupid assumptions when reading the .pdb dump data. _KTHREAD should now be the right size and structure as Win 2003. (the reason this bug wasn't more evident was because we were using 1-byte packing and a "padding" field. this has now been removed).

Modified:
    trunk/reactos/include/ndk/ketypes.h

Modified: trunk/reactos/include/ndk/ketypes.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=25481&r1=25480&r2=25481&view=diff
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h (original)
+++ trunk/reactos/include/ndk/ketypes.h Tue Jan 16 05:40:41 2007
@@ -679,7 +679,6 @@
 //
 // Kernel Thread (KTHREAD)
 //
-#include <pshpack1.h>
 typedef struct _KTHREAD
 {
     DISPATCHER_HEADER DispatcherHeader;
@@ -700,31 +699,31 @@
         {
             UCHAR ApcStateFill[23];
             UCHAR ApcQueueable;
-        };
-    };
-    volatile UCHAR NextProcessor;
-    volatile UCHAR DeferredProcessor;
-    UCHAR AdjustReason;
-    SCHAR AdjustIncrement;
+            volatile UCHAR NextProcessor;
+            volatile UCHAR DeferredProcessor;
+            UCHAR AdjustReason;
+            SCHAR AdjustIncrement;
+        };
+    };
     KSPIN_LOCK ApcQueueLock;
     ULONG ContextSwitches;
     volatile UCHAR State;
     UCHAR NpxState;
-    UCHAR WaitIrql;
-    SCHAR WaitMode;
-    LONG WaitStatus;
+    KIRQL WaitIrql;
+    KPROCESSOR_MODE WaitMode;
+    LONG_PTR WaitStatus;
     union
     {
         PKWAIT_BLOCK WaitBlockList;
         PKGATE GateObject;
     };
-    UCHAR Alertable;
-    UCHAR WaitNext;
+    BOOLEAN Alertable;
+    BOOLEAN WaitNext;
     UCHAR WaitReason;
     SCHAR Priority;
-    UCHAR EnableStackSwap;
+    BOOLEAN EnableStackSwap;
     volatile UCHAR SwapBusy;
-    UCHAR Alerted[2];
+    BOOLEAN Alerted[MaximumMode];
     union
     {
         LIST_ENTRY WaitListEntry;
@@ -745,51 +744,50 @@
     union
     {
         KTIMER Timer;
-        UCHAR TimerFill[40];
-    };
-    union
-    {
-        struct
-        {
-            LONG AutoAlignment:1;
-            LONG DisableBoost:1;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-            LONG EtwStackTrace1ApcInserted:1;
-            LONG EtwStackTrace2ApcInserted:1;
-            LONG CycleChargePending:1;
-            LONG ReservedFlags:27;
+        struct
+        {
+            UCHAR TimerFill[40];
+            union
+            {
+                struct
+                {
+                    LONG AutoAlignment:1;
+                    LONG DisableBoost:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+                    LONG EtwStackTrace1ApcInserted:1;
+                    LONG EtwStackTrace2ApcInserted:1;
+                    LONG CycleChargePending:1;
+                    LONG ReservedFlags:27;
 #else
-            LONG ReservedFlags:30;
-#endif
-        };
-        LONG ThreadFlags;
-    };
-    PVOID Padding;
-    union
-    {
-        KWAIT_BLOCK WaitBlock[4];
-        union
-        {
-            struct
-            {
-                UCHAR WaitBlockFill0[23];
-                UCHAR SystemAffinityActive;
+                    LONG ReservedFlags:30;
+#endif
+                };
+                LONG ThreadFlags;
             };
-            struct
-            {
-                UCHAR WaitBlockFill1[47];
-                SCHAR PreviousMode;
-            };
-            struct
-            {
-                UCHAR WaitBlockFill2[71];
-                UCHAR ResourceIndex;
-            };
-            struct
-            {
-                UCHAR WaitBlockFill3[95];
-                UCHAR LargeStack;
-            };
+        };
+    };
+    union
+    {
+        KWAIT_BLOCK WaitBlock[THREAD_WAIT_OBJECTS + 1];
+        struct
+        {
+            UCHAR WaitBlockFill0[23];
+            BOOLEAN SystemAffinityActive;
+        };
+        struct
+        {
+            UCHAR WaitBlockFill1[47];
+            CCHAR PreviousMode;
+        };
+        struct
+        {
+            UCHAR WaitBlockFill2[71];
+            UCHAR ResourceIndex;
+        };
+        struct
+        {
+            UCHAR WaitBlockFill3[95];
+            UCHAR LargeStack;
         };
     };
     LIST_ENTRY QueueListEntry;
@@ -801,15 +799,15 @@
     PVOID ServiceTable;
     UCHAR ApcStateIndex;
     UCHAR IdealProcessor;
-    UCHAR Preempted;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    UCHAR CalloutActive;
+    BOOLEAN Preempted;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    BOOLEAN CalloutActive;
 #else
-    UCHAR ProcessReadyQueue;
-#endif
-    UCHAR KernelStackResident;
-    CHAR BasePriority;
-    CHAR PriorityDecrement;
+    BOOLEAN ProcessReadyQueue;
+#endif
+    BOOLEAN KernelStackResident;
+    SCHAR BasePriority;
+    SCHAR PriorityDecrement;
     CHAR Saturation;
 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
     ULONG SystemCallNumber;
@@ -833,29 +831,29 @@
     union
     {
         KAPC_STATE SavedApcState;
-        union
+        struct
         {
             UCHAR SavedApcStateFill[23];
-            SCHAR FreezeCount;
-        };
-    };
-    SCHAR SuspendCount;
-    UCHAR UserIdealProcessor;
-#if (NTDDI_VERSION >= NTDDI_LONGHORN)
-    union
-    {
-        struct
-        {
-            UCHAR ReservedBits0:1;
-            UCHAR SegmentsPresent:1;
-            UCHAR Reservedbits1:1;
-        };
-        UCHAR NestedStateFlags;
-    };
+            CCHAR FreezeCount;
+            CCHAR SuspendCount;
+            UCHAR UserIdealProcessor;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            union
+            {
+                struct
+                {
+                    UCHAR ReservedBits0:1;
+                    UCHAR SegmentsPresent:1;
+                    UCHAR Reservedbits1:1;
+                };
+                UCHAR NestedStateFlags;
+            };
 #else
-    UCHAR CalloutActive;
-#endif
-    UCHAR Iopl;
+            UCHAR CalloutActive;
+#endif
+            UCHAR Iopl;
+        };
+    };
     PVOID Win32Thread;
     PVOID StackBase;
     union
@@ -894,15 +892,18 @@
         {
             UCHAR SuspendApcFill5[47];
             UCHAR PowerState;
-        };
-    };
-    ULONG UserTime;
+            ULONG UserTime;
+        };
+    };
     union
     {
         KSEMAPHORE SuspendSemaphore;
-        UCHAR SuspendSemaphorefill[20];
-    };
-    ULONG SListFaultCount;
+        struct
+        {
+            UCHAR SuspendSemaphorefill[20];
+            ULONG SListFaultCount;
+        };
+    };
     LIST_ENTRY ThreadListEntry;
 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
     LIST_ENTRY MutantListHead;
@@ -912,7 +913,6 @@
     PVOID MdlForLockedteb;
 #endif
 } KTHREAD;
-#include <poppack.h>
 
 #define ASSERT_THREAD(object) \
     ASSERT((((object)->DispatcherHeader.Type & KOBJECT_TYPE_MASK) == ThreadObject))




More information about the Ros-diffs mailing list