A number of fixes for Vista/Win7, now all C_ASSERTs pass

svn path=/trunk/; revision=56314
This commit is contained in:
Timo Kreuzer 2012-04-01 22:25:05 +00:00
parent dc1ac7bfa3
commit 372271d5bf

View file

@ -682,6 +682,42 @@ typedef struct _KEXECUTE_OPTIONS
UCHAR Spare:2; UCHAR Spare:2;
} KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS; } KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
#if (NTDDI_VERSION >= NTDDI_WIN7)
typedef union _KWAIT_STATUS_REGISTER
{
UCHAR Flags;
struct
{
UCHAR State:2;
UCHAR Affinity:1;
UCHAR Priority:1;
UCHAR Apc:1;
UCHAR UserApc:1;
UCHAR Alert:1;
UCHAR Unused:1;
};
} KWAIT_STATUS_REGISTER, *PKWAIT_STATUS_REGISTER;
typedef struct _COUNTER_READING
{
enum _HARDWARE_COUNTER_TYPE Type;
ULONG Index;
ULONG64 Start;
ULONG64 Total;
}COUNTER_READING, *PCOUNTER_READING;
typedef struct _KTHREAD_COUNTERS
{
ULONG64 WaitReasonBitMap;
struct _THREAD_PERFORMANCE_DATA* UserData;
ULONG Flags;
ULONG ContextSwitches;
ULONG64 CycleTimeBias;
ULONG64 HardwareCounters;
COUNTER_READING HwCounter[16];
}KTHREAD_COUNTERS, *PKTHREAD_COUNTERS;
#endif
// //
// Kernel Thread (KTHREAD) // Kernel Thread (KTHREAD)
// //
@ -735,15 +771,20 @@ typedef struct _KTHREAD
UCHAR ApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1]; UCHAR ApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1];
#if (NTDDI_VERSION >= NTDDI_LONGHORN) // [ #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
SCHAR Priority; SCHAR Priority;
#if (NTDDI_VERSION >= NTDDI_WIN7) // [
/* On x86, the following members "fall out" of the union */
volatile ULONG NextProcessor;
volatile ULONG DeferredProcessor;
#else // ][
/* On x86, the following members "fall out" of the union */
volatile USHORT NextProcessor;
volatile USHORT DeferredProcessor;
#endif // ]
#else // ][ #else // ][
UCHAR ApcQueueable; UCHAR ApcQueueable;
#endif // ]
/* On x86, the following members "fall out" of the union */ /* On x86, the following members "fall out" of the union */
volatile UCHAR NextProcessor; volatile UCHAR NextProcessor;
#if (NTDDI_VERSION < NTDDI_WIN7) // [
volatile UCHAR DeferredProcessor; volatile UCHAR DeferredProcessor;
#endif // ]
#if (NTDDI_VERSION < NTDDI_LONGHORN) // [
UCHAR AdjustReason; UCHAR AdjustReason;
SCHAR AdjustIncrement; SCHAR AdjustIncrement;
#endif // ] #endif // ]
@ -787,8 +828,10 @@ typedef struct _KTHREAD
BOOLEAN WaitNext; BOOLEAN WaitNext;
#endif // ] #endif // ]
UCHAR WaitReason; UCHAR WaitReason;
#if (NTDDI_VERSION < NTDDI_LONGHORN)
SCHAR Priority; SCHAR Priority;
BOOLEAN EnableStackSwap; BOOLEAN EnableStackSwap;
#endif // ]
volatile UCHAR SwapBusy; volatile UCHAR SwapBusy;
BOOLEAN Alerted[MaximumMode]; BOOLEAN Alerted[MaximumMode];
#endif // ] #endif // ]
@ -824,13 +867,14 @@ typedef struct _KTHREAD
#if !defined(_WIN64) // [ #if !defined(_WIN64) // [
}; };
}; };
#endif // ]
#endif // ] #endif // ]
union union
{ {
struct struct
{ {
LONG AutoAlignment:1; ULONG AutoAlignment:1;
LONG DisableBoost:1; ULONG DisableBoost:1;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) // [ #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
ULONG EtwStackTraceApc1Inserted:1; ULONG EtwStackTraceApc1Inserted:1;
ULONG EtwStackTraceApc2Inserted:1; ULONG EtwStackTraceApc2Inserted:1;
@ -846,9 +890,15 @@ typedef struct _KTHREAD
}; };
LONG ThreadFlags; LONG ThreadFlags;
}; };
#if defined(_WIN64) && (NTDDI_VERSION < NTDDI_WIN7) // [
};
};
#endif // ]
#if (NTDDI_VERSION >= NTDDI_WIN7) // [
#if defined(_WIN64) // [ #if defined(_WIN64) // [
}; ULONG Spare0;
}; #else // ][
PVOID ServiceTable;
#endif // ] #endif // ]
#endif // ] #endif // ]
union union
@ -899,9 +949,21 @@ typedef struct _KTHREAD
UCHAR WaitBlockFill6[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)]; UCHAR WaitBlockFill6[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
ULONG WaitTime; ULONG WaitTime;
}; };
#if (NTDDI_VERSION >= NTDDI_WIN7) // [
struct struct
{ {
UCHAR WaitBlockFill7[168];
PVOID TebMappedLowVa;
struct _UMS_CONTROL_BLOCK* Ucb;
};
#endif // ]
struct
{
#if (NTDDI_VERSION >= NTDDI_WIN7) // [
UCHAR WaitBlockFill8[188];
#else // ][
UCHAR WaitBlockFill7[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)]; UCHAR WaitBlockFill7[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
#endif // ]
union union
{ {
struct struct
@ -921,7 +983,7 @@ typedef struct _KTHREAD
union // 2 elements, 0x8 bytes (sizeof) union // 2 elements, 0x8 bytes (sizeof)
{ {
PVOID CallbackStack; PVOID CallbackStack;
ULONG64 CallbackDepth; ULONG_PTR CallbackDepth;
}; };
#else // ][ #else // ][
PVOID CallbackStack; PVOID CallbackStack;
@ -949,24 +1011,30 @@ typedef struct _KTHREAD
BOOLEAN Preempted; BOOLEAN Preempted;
UCHAR AdjustReason; UCHAR AdjustReason;
CHAR AdjustIncrement; CHAR AdjustIncrement;
UINT8 Spare01; #if (NTDDI_VERSION >= NTDDI_WIN7)
UCHAR PreviousMode;
#else
UCHAR Spare01;
#endif
#endif // ] #endif // ]
CHAR Saturation; CHAR Saturation;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) // [ #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
ULONG SystemCallNumber; ULONG SystemCallNumber;
#if (NTDDI_VERSION >= NTDDI_WIN7) // [ #if (NTDDI_VERSION >= NTDDI_WIN7) // [
ULONG2 FreezeCount; ULONG FreezeCount;
#else // ][ #else // ][
ULONG Spare2; ULONG Spare02;
#endif // ] #endif // ]
#endif // ] #endif // ]
KAFFINITY UserAffinity;
struct _KPROCESS *Process;
#if (NTDDI_VERSION >= NTDDI_WIN7) // [ #if (NTDDI_VERSION >= NTDDI_WIN7) // [
GROUP_AFFINITY UserAffinity;
struct _KPROCESS *Process;
GROUP_AFFINITY Affinity; GROUP_AFFINITY Affinity;
ULONG IdealProcessor; ULONG IdealProcessor;
ULONG UserIdealProcessor; ULONG UserIdealProcessor;
#else // ][ #else // ][
KAFFINITY UserAffinity;
struct _KPROCESS *Process;
KAFFINITY Affinity; KAFFINITY Affinity;
#endif // ] #endif // ]
PKAPC_STATE ApcStatePointer[2]; PKAPC_STATE ApcStatePointer[2];
@ -993,7 +1061,7 @@ typedef struct _KTHREAD
#endif // ] #endif // ]
#if (NTDDI_VERSION >= NTDDI_WIN7) // [ #if (NTDDI_VERSION >= NTDDI_WIN7) // [
#elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][ #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
UCHAR Spare3; UCHAR Spare03;
#else // ][ #else // ][
UCHAR CalloutActive; UCHAR CalloutActive;
#endif // ] #endif // ]
@ -1096,7 +1164,7 @@ typedef struct _KTHREAD
PKTHREAD_COUNTERS ThreadCounters; PKTHREAD_COUNTERS ThreadCounters;
PXSTATE_SAVE XStateSave; PXSTATE_SAVE XStateSave;
#elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][ #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
PVOID MdlForLockedteb; PVOID MdlForLockedTeb;
#endif // ] #endif // ]
} KTHREAD; } KTHREAD;
@ -1159,9 +1227,9 @@ typedef struct _KPROCESS
}; };
ULONG StackCount; ULONG StackCount;
LIST_ENTRY ProcessListEntry; LIST_ENTRY ProcessListEntry;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
ULONGLONG CycleTime; ULONGLONG CycleTime;
#endif #endif // ]
} KPROCESS; } KPROCESS;
#define ASSERT_PROCESS(object) \ #define ASSERT_PROCESS(object) \