Sync with trunk (r48545)
[reactos.git] / include / xdk / ketypes.h
1 /******************************************************************************
2 * Kernel Types *
3 ******************************************************************************/
4 $if (_WDMDDK_)
5
6 typedef UCHAR KIRQL, *PKIRQL;
7 typedef CCHAR KPROCESSOR_MODE;
8 typedef LONG KPRIORITY;
9
10 typedef enum _MODE {
11 KernelMode,
12 UserMode,
13 MaximumMode
14 } MODE;
15
16 #define CACHE_FULLY_ASSOCIATIVE 0xFF
17 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
18
19 #define EVENT_QUERY_STATE (0x0001)
20 #define EVENT_MODIFY_STATE (0x0002)
21 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
22
23 #define LTP_PC_SMT 0x1
24
25 #if (NTDDI_VERSION < NTDDI_WIN7) || defined(_X86_) || !defined(NT_PROCESSOR_GROUPS)
26 #define SINGLE_GROUP_LEGACY_API 1
27 #endif
28
29 #define SEMAPHORE_QUERY_STATE (0x0001)
30 #define SEMAPHORE_MODIFY_STATE (0x0002)
31 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
32
33 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
34 RelationProcessorCore,
35 RelationNumaNode,
36 RelationCache,
37 RelationProcessorPackage,
38 RelationGroup,
39 RelationAll = 0xffff
40 } LOGICAL_PROCESSOR_RELATIONSHIP;
41
42 typedef enum _PROCESSOR_CACHE_TYPE {
43 CacheUnified,
44 CacheInstruction,
45 CacheData,
46 CacheTrace
47 } PROCESSOR_CACHE_TYPE;
48
49 typedef struct _CACHE_DESCRIPTOR {
50 UCHAR Level;
51 UCHAR Associativity;
52 USHORT LineSize;
53 ULONG Size;
54 PROCESSOR_CACHE_TYPE Type;
55 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
56
57 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
58 ULONG_PTR ProcessorMask;
59 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
60 _ANONYMOUS_UNION union {
61 struct {
62 UCHAR Flags;
63 } ProcessorCore;
64 struct {
65 ULONG NodeNumber;
66 } NumaNode;
67 CACHE_DESCRIPTOR Cache;
68 ULONGLONG Reserved[2];
69 } DUMMYUNIONNAME;
70 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
71
72 typedef struct _PROCESSOR_RELATIONSHIP {
73 UCHAR Flags;
74 UCHAR Reserved[21];
75 USHORT GroupCount;
76 GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
77 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
78
79 typedef struct _NUMA_NODE_RELATIONSHIP {
80 ULONG NodeNumber;
81 UCHAR Reserved[20];
82 GROUP_AFFINITY GroupMask;
83 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
84
85 typedef struct _CACHE_RELATIONSHIP {
86 UCHAR Level;
87 UCHAR Associativity;
88 USHORT LineSize;
89 ULONG CacheSize;
90 PROCESSOR_CACHE_TYPE Type;
91 UCHAR Reserved[20];
92 GROUP_AFFINITY GroupMask;
93 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
94
95 typedef struct _PROCESSOR_GROUP_INFO {
96 UCHAR MaximumProcessorCount;
97 UCHAR ActiveProcessorCount;
98 UCHAR Reserved[38];
99 KAFFINITY ActiveProcessorMask;
100 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
101
102 typedef struct _GROUP_RELATIONSHIP {
103 USHORT MaximumGroupCount;
104 USHORT ActiveGroupCount;
105 UCHAR Reserved[20];
106 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
107 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
108
109 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX {
110 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
111 ULONG Size;
112 _ANONYMOUS_UNION union {
113 PROCESSOR_RELATIONSHIP Processor;
114 NUMA_NODE_RELATIONSHIP NumaNode;
115 CACHE_RELATIONSHIP Cache;
116 GROUP_RELATIONSHIP Group;
117 } DUMMYUNIONNAME;
118 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;;
119
120 /* Processor features */
121 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
122 #define PF_FLOATING_POINT_EMULATED 1
123 #define PF_COMPARE_EXCHANGE_DOUBLE 2
124 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
125 #define PF_PPC_MOVEMEM_64BIT_OK 4
126 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
127 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
128 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
129 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
130 #define PF_PAE_ENABLED 9
131 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
132 #define PF_SSE_DAZ_MODE_AVAILABLE 11
133 #define PF_NX_ENABLED 12
134 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
135 #define PF_COMPARE_EXCHANGE128 14
136 #define PF_COMPARE64_EXCHANGE128 15
137 #define PF_CHANNELS_ENABLED 16
138 #define PF_XSAVE_ENABLED 17
139
140 #define MAXIMUM_WAIT_OBJECTS 64
141
142 #define ASSERT_APC(Object) NT_ASSERT((Object)->Type == ApcObject)
143
144 #define ASSERT_DPC(Object) \
145 ASSERT(((Object)->Type == 0) || \
146 ((Object)->Type == DpcObject) || \
147 ((Object)->Type == ThreadedDpcObject))
148
149 #define ASSERT_GATE(object) \
150 NT_ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == GateObject) || \
151 (((object)->Header.Type & KOBJECT_TYPE_MASK) == EventSynchronizationObject))
152
153 #define ASSERT_DEVICE_QUEUE(Object) \
154 NT_ASSERT((Object)->Type == DeviceQueueObject)
155
156 #define ASSERT_TIMER(E) \
157 NT_ASSERT(((E)->Header.Type == TimerNotificationObject) || \
158 ((E)->Header.Type == TimerSynchronizationObject))
159
160 #define ASSERT_MUTANT(E) \
161 NT_ASSERT((E)->Header.Type == MutantObject)
162
163 #define ASSERT_SEMAPHORE(E) \
164 NT_ASSERT((E)->Header.Type == SemaphoreObject)
165
166 #define ASSERT_EVENT(E) \
167 NT_ASSERT(((E)->Header.Type == NotificationEvent) || \
168 ((E)->Header.Type == SynchronizationEvent))
169
170 #define DPC_NORMAL 0
171 #define DPC_THREADED 1
172
173 #define GM_LOCK_BIT 0x1
174 #define GM_LOCK_BIT_V 0x0
175 #define GM_LOCK_WAITER_WOKEN 0x2
176 #define GM_LOCK_WAITER_INC 0x4
177
178 #define LOCK_QUEUE_WAIT_BIT 0
179 #define LOCK_QUEUE_OWNER_BIT 1
180
181 #define LOCK_QUEUE_WAIT 1
182 #define LOCK_QUEUE_OWNER 2
183 #define LOCK_QUEUE_TIMER_LOCK_SHIFT 4
184 #define LOCK_QUEUE_TIMER_TABLE_LOCKS (1 << (8 - LOCK_QUEUE_TIMER_LOCK_SHIFT))
185
186 #define PROCESSOR_FEATURE_MAX 64
187
188 #define DBG_STATUS_CONTROL_C 1
189 #define DBG_STATUS_SYSRQ 2
190 #define DBG_STATUS_BUGCHECK_FIRST 3
191 #define DBG_STATUS_BUGCHECK_SECOND 4
192 #define DBG_STATUS_FATAL 5
193 #define DBG_STATUS_DEBUG_CONTROL 6
194 #define DBG_STATUS_WORKER 7
195
196 #if defined(_WIN64)
197 #define MAXIMUM_PROC_PER_GROUP 64
198 #else
199 #define MAXIMUM_PROC_PER_GROUP 32
200 #endif
201 #define MAXIMUM_PROCESSORS MAXIMUM_PROC_PER_GROUP
202
203 /* Exception Records */
204 #define EXCEPTION_NONCONTINUABLE 1
205 #define EXCEPTION_MAXIMUM_PARAMETERS 15
206
207 #define EXCEPTION_DIVIDED_BY_ZERO 0
208 #define EXCEPTION_DEBUG 1
209 #define EXCEPTION_NMI 2
210 #define EXCEPTION_INT3 3
211 #define EXCEPTION_BOUND_CHECK 5
212 #define EXCEPTION_INVALID_OPCODE 6
213 #define EXCEPTION_NPX_NOT_AVAILABLE 7
214 #define EXCEPTION_DOUBLE_FAULT 8
215 #define EXCEPTION_NPX_OVERRUN 9
216 #define EXCEPTION_INVALID_TSS 0x0A
217 #define EXCEPTION_SEGMENT_NOT_PRESENT 0x0B
218 #define EXCEPTION_STACK_FAULT 0x0C
219 #define EXCEPTION_GP_FAULT 0x0D
220 #define EXCEPTION_RESERVED_TRAP 0x0F
221 #define EXCEPTION_NPX_ERROR 0x010
222 #define EXCEPTION_ALIGNMENT_CHECK 0x011
223
224 typedef struct _EXCEPTION_RECORD {
225 NTSTATUS ExceptionCode;
226 ULONG ExceptionFlags;
227 struct _EXCEPTION_RECORD *ExceptionRecord;
228 PVOID ExceptionAddress;
229 ULONG NumberParameters;
230 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
231 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
232
233 typedef struct _EXCEPTION_RECORD32 {
234 NTSTATUS ExceptionCode;
235 ULONG ExceptionFlags;
236 ULONG ExceptionRecord;
237 ULONG ExceptionAddress;
238 ULONG NumberParameters;
239 ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
240 } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;
241
242 typedef struct _EXCEPTION_RECORD64 {
243 NTSTATUS ExceptionCode;
244 ULONG ExceptionFlags;
245 ULONG64 ExceptionRecord;
246 ULONG64 ExceptionAddress;
247 ULONG NumberParameters;
248 ULONG __unusedAlignment;
249 ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
250 } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
251
252 typedef struct _EXCEPTION_POINTERS {
253 PEXCEPTION_RECORD ExceptionRecord;
254 PCONTEXT ContextRecord;
255 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
256
257 typedef enum _KBUGCHECK_CALLBACK_REASON {
258 KbCallbackInvalid,
259 KbCallbackReserved1,
260 KbCallbackSecondaryDumpData,
261 KbCallbackDumpIo,
262 KbCallbackAddPages
263 } KBUGCHECK_CALLBACK_REASON;
264
265 struct _KBUGCHECK_REASON_CALLBACK_RECORD;
266
267 typedef VOID
268 (NTAPI KBUGCHECK_REASON_CALLBACK_ROUTINE)(
269 IN KBUGCHECK_CALLBACK_REASON Reason,
270 IN struct _KBUGCHECK_REASON_CALLBACK_RECORD *Record,
271 IN OUT PVOID ReasonSpecificData,
272 IN ULONG ReasonSpecificDataLength);
273 typedef KBUGCHECK_REASON_CALLBACK_ROUTINE *PKBUGCHECK_REASON_CALLBACK_ROUTINE;
274
275 typedef struct _KBUGCHECK_ADD_PAGES {
276 IN OUT PVOID Context;
277 IN OUT ULONG Flags;
278 IN ULONG BugCheckCode;
279 OUT ULONG_PTR Address;
280 OUT ULONG_PTR Count;
281 } KBUGCHECK_ADD_PAGES, *PKBUGCHECK_ADD_PAGES;
282
283 typedef struct _KBUGCHECK_SECONDARY_DUMP_DATA {
284 IN PVOID InBuffer;
285 IN ULONG InBufferLength;
286 IN ULONG MaximumAllowed;
287 OUT GUID Guid;
288 OUT PVOID OutBuffer;
289 OUT ULONG OutBufferLength;
290 } KBUGCHECK_SECONDARY_DUMP_DATA, *PKBUGCHECK_SECONDARY_DUMP_DATA;
291
292 typedef enum _KBUGCHECK_DUMP_IO_TYPE {
293 KbDumpIoInvalid,
294 KbDumpIoHeader,
295 KbDumpIoBody,
296 KbDumpIoSecondaryData,
297 KbDumpIoComplete
298 } KBUGCHECK_DUMP_IO_TYPE;
299
300 typedef struct _KBUGCHECK_DUMP_IO {
301 IN ULONG64 Offset;
302 IN PVOID Buffer;
303 IN ULONG BufferLength;
304 IN KBUGCHECK_DUMP_IO_TYPE Type;
305 } KBUGCHECK_DUMP_IO, *PKBUGCHECK_DUMP_IO;
306
307 #define KB_ADD_PAGES_FLAG_VIRTUAL_ADDRESS 0x00000001UL
308 #define KB_ADD_PAGES_FLAG_PHYSICAL_ADDRESS 0x00000002UL
309 #define KB_ADD_PAGES_FLAG_ADDITIONAL_RANGES_EXIST 0x80000000UL
310
311 typedef struct _KBUGCHECK_REASON_CALLBACK_RECORD {
312 LIST_ENTRY Entry;
313 PKBUGCHECK_REASON_CALLBACK_ROUTINE CallbackRoutine;
314 PUCHAR Component;
315 ULONG_PTR Checksum;
316 KBUGCHECK_CALLBACK_REASON Reason;
317 UCHAR State;
318 } KBUGCHECK_REASON_CALLBACK_RECORD, *PKBUGCHECK_REASON_CALLBACK_RECORD;
319
320 typedef enum _KBUGCHECK_BUFFER_DUMP_STATE {
321 BufferEmpty,
322 BufferInserted,
323 BufferStarted,
324 BufferFinished,
325 BufferIncomplete
326 } KBUGCHECK_BUFFER_DUMP_STATE;
327
328 typedef VOID
329 (NTAPI KBUGCHECK_CALLBACK_ROUTINE)(
330 IN PVOID Buffer,
331 IN ULONG Length);
332 typedef KBUGCHECK_CALLBACK_ROUTINE *PKBUGCHECK_CALLBACK_ROUTINE;
333
334 typedef struct _KBUGCHECK_CALLBACK_RECORD {
335 LIST_ENTRY Entry;
336 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
337 PVOID Buffer;
338 ULONG Length;
339 PUCHAR Component;
340 ULONG_PTR Checksum;
341 UCHAR State;
342 } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
343
344 typedef BOOLEAN
345 (NTAPI NMI_CALLBACK)(
346 IN PVOID Context,
347 IN BOOLEAN Handled);
348 typedef NMI_CALLBACK *PNMI_CALLBACK;
349
350 typedef enum _KE_PROCESSOR_CHANGE_NOTIFY_STATE {
351 KeProcessorAddStartNotify = 0,
352 KeProcessorAddCompleteNotify,
353 KeProcessorAddFailureNotify
354 } KE_PROCESSOR_CHANGE_NOTIFY_STATE;
355
356 typedef struct _KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT {
357 KE_PROCESSOR_CHANGE_NOTIFY_STATE State;
358 ULONG NtNumber;
359 NTSTATUS Status;
360 #if (NTDDI_VERSION >= NTDDI_WIN7)
361 PROCESSOR_NUMBER ProcNumber;
362 #endif
363 } KE_PROCESSOR_CHANGE_NOTIFY_CONTEXT, *PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT;
364
365 typedef VOID
366 (NTAPI PROCESSOR_CALLBACK_FUNCTION)(
367 IN PVOID CallbackContext,
368 IN PKE_PROCESSOR_CHANGE_NOTIFY_CONTEXT ChangeContext,
369 IN OUT PNTSTATUS OperationStatus);
370 typedef PROCESSOR_CALLBACK_FUNCTION *PPROCESSOR_CALLBACK_FUNCTION;
371
372 #define KE_PROCESSOR_CHANGE_ADD_EXISTING 1
373
374 #define INVALID_PROCESSOR_INDEX 0xffffffff
375
376 typedef enum _KINTERRUPT_POLARITY {
377 InterruptPolarityUnknown,
378 InterruptActiveHigh,
379 InterruptActiveLow
380 } KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY;
381
382 typedef enum _KPROFILE_SOURCE {
383 ProfileTime,
384 ProfileAlignmentFixup,
385 ProfileTotalIssues,
386 ProfilePipelineDry,
387 ProfileLoadInstructions,
388 ProfilePipelineFrozen,
389 ProfileBranchInstructions,
390 ProfileTotalNonissues,
391 ProfileDcacheMisses,
392 ProfileIcacheMisses,
393 ProfileCacheMisses,
394 ProfileBranchMispredictions,
395 ProfileStoreInstructions,
396 ProfileFpInstructions,
397 ProfileIntegerInstructions,
398 Profile2Issue,
399 Profile3Issue,
400 Profile4Issue,
401 ProfileSpecialInstructions,
402 ProfileTotalCycles,
403 ProfileIcacheIssues,
404 ProfileDcacheAccesses,
405 ProfileMemoryBarrierCycles,
406 ProfileLoadLinkedIssues,
407 ProfileMaximum
408 } KPROFILE_SOURCE;
409
410 typedef enum _KWAIT_REASON {
411 Executive,
412 FreePage,
413 PageIn,
414 PoolAllocation,
415 DelayExecution,
416 Suspended,
417 UserRequest,
418 WrExecutive,
419 WrFreePage,
420 WrPageIn,
421 WrPoolAllocation,
422 WrDelayExecution,
423 WrSuspended,
424 WrUserRequest,
425 WrEventPair,
426 WrQueue,
427 WrLpcReceive,
428 WrLpcReply,
429 WrVirtualMemory,
430 WrPageOut,
431 WrRendezvous,
432 WrKeyedEvent,
433 WrTerminated,
434 WrProcessInSwap,
435 WrCpuRateControl,
436 WrCalloutStack,
437 WrKernel,
438 WrResource,
439 WrPushLock,
440 WrMutex,
441 WrQuantumEnd,
442 WrDispatchInt,
443 WrPreempted,
444 WrYieldExecution,
445 WrFastMutex,
446 WrGuardedMutex,
447 WrRundown,
448 MaximumWaitReason
449 } KWAIT_REASON;
450
451 typedef struct _KWAIT_BLOCK {
452 LIST_ENTRY WaitListEntry;
453 struct _KTHREAD *Thread;
454 PVOID Object;
455 struct _KWAIT_BLOCK *NextWaitBlock;
456 USHORT WaitKey;
457 UCHAR WaitType;
458 volatile UCHAR BlockState;
459 #if defined(_WIN64)
460 LONG SpareLong;
461 #endif
462 } KWAIT_BLOCK, *PKWAIT_BLOCK, *PRKWAIT_BLOCK;
463
464 typedef enum _KINTERRUPT_MODE {
465 LevelSensitive,
466 Latched
467 } KINTERRUPT_MODE;
468
469 #define THREAD_WAIT_OBJECTS 3
470
471 typedef VOID
472 (NTAPI KSTART_ROUTINE)(
473 IN PVOID StartContext);
474 typedef KSTART_ROUTINE *PKSTART_ROUTINE;
475
476 typedef VOID
477 (NTAPI *PKINTERRUPT_ROUTINE)(
478 VOID);
479
480 typedef BOOLEAN
481 (NTAPI KSERVICE_ROUTINE)(
482 IN struct _KINTERRUPT *Interrupt,
483 IN PVOID ServiceContext);
484 typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
485
486 typedef BOOLEAN
487 (NTAPI KMESSAGE_SERVICE_ROUTINE)(
488 IN struct _KINTERRUPT *Interrupt,
489 IN PVOID ServiceContext,
490 IN ULONG MessageID);
491 typedef KMESSAGE_SERVICE_ROUTINE *PKMESSAGE_SERVICE_ROUTINE;
492
493 typedef enum _KD_OPTION {
494 KD_OPTION_SET_BLOCK_ENABLE,
495 } KD_OPTION;
496
497 typedef VOID
498 (NTAPI *PKNORMAL_ROUTINE)(
499 IN PVOID NormalContext OPTIONAL,
500 IN PVOID SystemArgument1 OPTIONAL,
501 IN PVOID SystemArgument2 OPTIONAL);
502
503 typedef VOID
504 (NTAPI *PKRUNDOWN_ROUTINE)(
505 IN struct _KAPC *Apc);
506
507 typedef VOID
508 (NTAPI *PKKERNEL_ROUTINE)(
509 IN struct _KAPC *Apc,
510 IN OUT PKNORMAL_ROUTINE *NormalRoutine OPTIONAL,
511 IN OUT PVOID *NormalContext OPTIONAL,
512 IN OUT PVOID *SystemArgument1 OPTIONAL,
513 IN OUT PVOID *SystemArgument2 OPTIONAL);
514
515 typedef struct _KAPC {
516 UCHAR Type;
517 UCHAR SpareByte0;
518 UCHAR Size;
519 UCHAR SpareByte1;
520 ULONG SpareLong0;
521 struct _KTHREAD *Thread;
522 LIST_ENTRY ApcListEntry;
523 PKKERNEL_ROUTINE KernelRoutine;
524 PKRUNDOWN_ROUTINE RundownRoutine;
525 PKNORMAL_ROUTINE NormalRoutine;
526 PVOID NormalContext;
527 PVOID SystemArgument1;
528 PVOID SystemArgument2;
529 CCHAR ApcStateIndex;
530 KPROCESSOR_MODE ApcMode;
531 BOOLEAN Inserted;
532 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
533
534 #define KAPC_OFFSET_TO_SPARE_BYTE0 FIELD_OFFSET(KAPC, SpareByte0)
535 #define KAPC_OFFSET_TO_SPARE_BYTE1 FIELD_OFFSET(KAPC, SpareByte1)
536 #define KAPC_OFFSET_TO_SPARE_LONG FIELD_OFFSET(KAPC, SpareLong0)
537 #define KAPC_OFFSET_TO_SYSTEMARGUMENT1 FIELD_OFFSET(KAPC, SystemArgument1)
538 #define KAPC_OFFSET_TO_SYSTEMARGUMENT2 FIELD_OFFSET(KAPC, SystemArgument2)
539 #define KAPC_OFFSET_TO_APCSTATEINDEX FIELD_OFFSET(KAPC, ApcStateIndex)
540 #define KAPC_ACTUAL_LENGTH (FIELD_OFFSET(KAPC, Inserted) + sizeof(BOOLEAN))
541
542 typedef struct _KDEVICE_QUEUE_ENTRY {
543 LIST_ENTRY DeviceListEntry;
544 ULONG SortKey;
545 BOOLEAN Inserted;
546 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
547 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
548
549 typedef PVOID PKIPI_CONTEXT;
550
551 typedef VOID
552 (NTAPI *PKIPI_WORKER)(
553 IN OUT PKIPI_CONTEXT PacketContext,
554 IN PVOID Parameter1 OPTIONAL,
555 IN PVOID Parameter2 OPTIONAL,
556 IN PVOID Parameter3 OPTIONAL);
557
558 typedef struct _KIPI_COUNTS {
559 ULONG Freeze;
560 ULONG Packet;
561 ULONG DPC;
562 ULONG APC;
563 ULONG FlushSingleTb;
564 ULONG FlushMultipleTb;
565 ULONG FlushEntireTb;
566 ULONG GenericCall;
567 ULONG ChangeColor;
568 ULONG SweepDcache;
569 ULONG SweepIcache;
570 ULONG SweepIcacheRange;
571 ULONG FlushIoBuffers;
572 ULONG GratuitousDPC;
573 } KIPI_COUNTS, *PKIPI_COUNTS;
574
575 typedef ULONG_PTR
576 (NTAPI KIPI_BROADCAST_WORKER)(
577 IN ULONG_PTR Argument);
578 typedef KIPI_BROADCAST_WORKER *PKIPI_BROADCAST_WORKER;
579
580 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
581
582 typedef struct _KSPIN_LOCK_QUEUE {
583 struct _KSPIN_LOCK_QUEUE *volatile Next;
584 PKSPIN_LOCK volatile Lock;
585 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
586
587 typedef struct _KLOCK_QUEUE_HANDLE {
588 KSPIN_LOCK_QUEUE LockQueue;
589 KIRQL OldIrql;
590 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
591
592 #if defined(_AMD64_)
593
594 typedef ULONG64 KSPIN_LOCK_QUEUE_NUMBER;
595
596 #define LockQueueDispatcherLock 0
597 #define LockQueueExpansionLock 1
598 #define LockQueuePfnLock 2
599 #define LockQueueSystemSpaceLock 3
600 #define LockQueueVacbLock 4
601 #define LockQueueMasterLock 5
602 #define LockQueueNonPagedPoolLock 6
603 #define LockQueueIoCancelLock 7
604 #define LockQueueWorkQueueLock 8
605 #define LockQueueIoVpbLock 9
606 #define LockQueueIoDatabaseLock 10
607 #define LockQueueIoCompletionLock 11
608 #define LockQueueNtfsStructLock 12
609 #define LockQueueAfdWorkQueueLock 13
610 #define LockQueueBcbLock 14
611 #define LockQueueMmNonPagedPoolLock 15
612 #define LockQueueUnusedSpare16 16
613 #define LockQueueTimerTableLock 17
614 #define LockQueueMaximumLock (LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS)
615
616 #else
617
618 typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
619 LockQueueDispatcherLock,
620 LockQueueExpansionLock,
621 LockQueuePfnLock,
622 LockQueueSystemSpaceLock,
623 LockQueueVacbLock,
624 LockQueueMasterLock,
625 LockQueueNonPagedPoolLock,
626 LockQueueIoCancelLock,
627 LockQueueWorkQueueLock,
628 LockQueueIoVpbLock,
629 LockQueueIoDatabaseLock,
630 LockQueueIoCompletionLock,
631 LockQueueNtfsStructLock,
632 LockQueueAfdWorkQueueLock,
633 LockQueueBcbLock,
634 LockQueueMmNonPagedPoolLock,
635 LockQueueUnusedSpare16,
636 LockQueueTimerTableLock,
637 LockQueueMaximumLock = LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS
638 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
639
640 #endif /* defined(_AMD64_) */
641
642 typedef VOID
643 (NTAPI *PKDEFERRED_ROUTINE)(
644 IN struct _KDPC *Dpc,
645 IN PVOID DeferredContext OPTIONAL,
646 IN PVOID SystemArgument1 OPTIONAL,
647 IN PVOID SystemArgument2 OPTIONAL);
648
649 typedef enum _KDPC_IMPORTANCE {
650 LowImportance,
651 MediumImportance,
652 HighImportance,
653 MediumHighImportance
654 } KDPC_IMPORTANCE;
655
656 typedef struct _KDPC {
657 UCHAR Type;
658 UCHAR Importance;
659 volatile USHORT Number;
660 LIST_ENTRY DpcListEntry;
661 PKDEFERRED_ROUTINE DeferredRoutine;
662 PVOID DeferredContext;
663 PVOID SystemArgument1;
664 PVOID SystemArgument2;
665 volatile PVOID DpcData;
666 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
667
668 typedef struct _KDPC_WATCHDOG_INFORMATION {
669 ULONG DpcTimeLimit;
670 ULONG DpcTimeCount;
671 ULONG DpcWatchdogLimit;
672 ULONG DpcWatchdogCount;
673 ULONG Reserved;
674 } KDPC_WATCHDOG_INFORMATION, *PKDPC_WATCHDOG_INFORMATION;
675
676 typedef struct _KDEVICE_QUEUE {
677 CSHORT Type;
678 CSHORT Size;
679 LIST_ENTRY DeviceListHead;
680 KSPIN_LOCK Lock;
681 # if defined(_AMD64_)
682 _ANONYMOUS_UNION union {
683 BOOLEAN Busy;
684 _ANONYMOUS_STRUCT struct {
685 LONG64 Reserved:8;
686 LONG64 Hint:56;
687 } DUMMYSTRUCTNAME;
688 } DUMMYUNIONNAME;
689 # else
690 BOOLEAN Busy;
691 # endif
692 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
693
694 #define TIMER_EXPIRED_INDEX_BITS 6
695 #define TIMER_PROCESSOR_INDEX_BITS 5
696
697 typedef struct _DISPATCHER_HEADER {
698 _ANONYMOUS_UNION union {
699 _ANONYMOUS_STRUCT struct {
700 UCHAR Type;
701 _ANONYMOUS_UNION union {
702 _ANONYMOUS_UNION union {
703 UCHAR TimerControlFlags;
704 _ANONYMOUS_STRUCT struct {
705 UCHAR Absolute:1;
706 UCHAR Coalescable:1;
707 UCHAR KeepShifting:1;
708 UCHAR EncodedTolerableDelay:5;
709 } DUMMYSTRUCTNAME;
710 } DUMMYUNIONNAME;
711 UCHAR Abandoned;
712 #if (NTDDI_VERSION < NTDDI_WIN7)
713 UCHAR NpxIrql;
714 #endif
715 BOOLEAN Signalling;
716 } DUMMYUNIONNAME;
717 _ANONYMOUS_UNION union {
718 _ANONYMOUS_UNION union {
719 UCHAR ThreadControlFlags;
720 _ANONYMOUS_STRUCT struct {
721 UCHAR CpuThrottled:1;
722 UCHAR CycleProfiling:1;
723 UCHAR CounterProfiling:1;
724 UCHAR Reserved:5;
725 } DUMMYSTRUCTNAME;
726 } DUMMYUNIONNAME;
727 UCHAR Size;
728 UCHAR Hand;
729 } DUMMYUNIONNAME2;
730 _ANONYMOUS_UNION union {
731 #if (NTDDI_VERSION >= NTDDI_WIN7)
732 _ANONYMOUS_UNION union {
733 UCHAR TimerMiscFlags;
734 _ANONYMOUS_STRUCT struct {
735 #if !defined(_X86_)
736 UCHAR Index:TIMER_EXPIRED_INDEX_BITS;
737 #else
738 UCHAR Index:1;
739 UCHAR Processor:TIMER_PROCESSOR_INDEX_BITS;
740 #endif
741 UCHAR Inserted:1;
742 volatile UCHAR Expired:1;
743 } DUMMYSTRUCTNAME;
744 } DUMMYUNIONNAME;
745 #else
746 /* Pre Win7 compatibility fix to latest WDK */
747 UCHAR Inserted;
748 #endif
749 _ANONYMOUS_UNION union {
750 BOOLEAN DebugActive;
751 _ANONYMOUS_STRUCT struct {
752 BOOLEAN ActiveDR7:1;
753 BOOLEAN Instrumented:1;
754 BOOLEAN Reserved2:4;
755 BOOLEAN UmsScheduled:1;
756 BOOLEAN UmsPrimary:1;
757 } DUMMYSTRUCTNAME;
758 } DUMMYUNIONNAME; /* should probably be DUMMYUNIONNAME2, but this is what WDK says */
759 BOOLEAN DpcActive;
760 } DUMMYUNIONNAME3;
761 } DUMMYSTRUCTNAME;
762 volatile LONG Lock;
763 } DUMMYUNIONNAME;
764 LONG SignalState;
765 LIST_ENTRY WaitListHead;
766 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
767
768 typedef struct _KEVENT {
769 DISPATCHER_HEADER Header;
770 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
771
772 typedef struct _KSEMAPHORE {
773 DISPATCHER_HEADER Header;
774 LONG Limit;
775 } KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
776
777 #define KSEMAPHORE_ACTUAL_LENGTH (FIELD_OFFSET(KSEMAPHORE, Limit) + sizeof(LONG))
778
779 typedef struct _KGATE {
780 DISPATCHER_HEADER Header;
781 } KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
782
783 typedef struct _KGUARDED_MUTEX {
784 volatile LONG Count;
785 PKTHREAD Owner;
786 ULONG Contention;
787 KGATE Gate;
788 _ANONYMOUS_UNION union {
789 _ANONYMOUS_STRUCT struct {
790 SHORT KernelApcDisable;
791 SHORT SpecialApcDisable;
792 } DUMMYSTRUCTNAME;
793 ULONG CombinedApcDisable;
794 } DUMMYUNIONNAME;
795 } KGUARDED_MUTEX, *PKGUARDED_MUTEX;
796
797 typedef struct _KMUTANT {
798 DISPATCHER_HEADER Header;
799 LIST_ENTRY MutantListEntry;
800 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
801 BOOLEAN Abandoned;
802 UCHAR ApcDisable;
803 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
804
805 #define TIMER_TABLE_SIZE 512
806 #define TIMER_TABLE_SHIFT 9
807
808 typedef struct _KTIMER {
809 DISPATCHER_HEADER Header;
810 ULARGE_INTEGER DueTime;
811 LIST_ENTRY TimerListEntry;
812 struct _KDPC *Dpc;
813 # if !defined(_X86_)
814 ULONG Processor;
815 # endif
816 ULONG Period;
817 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
818
819 typedef enum _LOCK_OPERATION {
820 IoReadAccess,
821 IoWriteAccess,
822 IoModifyAccess
823 } LOCK_OPERATION;
824
825 #define KTIMER_ACTUAL_LENGTH (FIELD_OFFSET(KTIMER, Period) + sizeof(LONG))
826
827 typedef BOOLEAN
828 (NTAPI *PKSYNCHRONIZE_ROUTINE)(
829 IN PVOID SynchronizeContext);
830
831 typedef enum _POOL_TYPE {
832 NonPagedPool,
833 PagedPool,
834 NonPagedPoolMustSucceed,
835 DontUseThisType,
836 NonPagedPoolCacheAligned,
837 PagedPoolCacheAligned,
838 NonPagedPoolCacheAlignedMustS,
839 MaxPoolType,
840 NonPagedPoolSession = 32,
841 PagedPoolSession,
842 NonPagedPoolMustSucceedSession,
843 DontUseThisTypeSession,
844 NonPagedPoolCacheAlignedSession,
845 PagedPoolCacheAlignedSession,
846 NonPagedPoolCacheAlignedMustSSession
847 } POOL_TYPE;
848
849 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE {
850 StandardDesign,
851 NEC98x86,
852 EndAlternatives
853 } ALTERNATIVE_ARCHITECTURE_TYPE;
854
855 #ifndef _X86_
856
857 #ifndef IsNEC_98
858 #define IsNEC_98 (FALSE)
859 #endif
860
861 #ifndef IsNotNEC_98
862 #define IsNotNEC_98 (TRUE)
863 #endif
864
865 #ifndef SetNEC_98
866 #define SetNEC_98
867 #endif
868
869 #ifndef SetNotNEC_98
870 #define SetNotNEC_98
871 #endif
872
873 #endif
874
875 typedef struct _KSYSTEM_TIME {
876 ULONG LowPart;
877 LONG High1Time;
878 LONG High2Time;
879 } KSYSTEM_TIME, *PKSYSTEM_TIME;
880
881 typedef struct DECLSPEC_ALIGN(16) _M128A {
882 ULONGLONG Low;
883 LONGLONG High;
884 } M128A, *PM128A;
885
886 typedef struct DECLSPEC_ALIGN(16) _XSAVE_FORMAT {
887 USHORT ControlWord;
888 USHORT StatusWord;
889 UCHAR TagWord;
890 UCHAR Reserved1;
891 USHORT ErrorOpcode;
892 ULONG ErrorOffset;
893 USHORT ErrorSelector;
894 USHORT Reserved2;
895 ULONG DataOffset;
896 USHORT DataSelector;
897 USHORT Reserved3;
898 ULONG MxCsr;
899 ULONG MxCsr_Mask;
900 M128A FloatRegisters[8];
901 #if defined(_WIN64)
902 M128A XmmRegisters[16];
903 UCHAR Reserved4[96];
904 #else
905 M128A XmmRegisters[8];
906 UCHAR Reserved4[192];
907 ULONG StackControl[7];
908 ULONG Cr0NpxState;
909 #endif
910 } XSAVE_FORMAT, *PXSAVE_FORMAT;
911
912 typedef struct DECLSPEC_ALIGN(8) _XSAVE_AREA_HEADER {
913 ULONG64 Mask;
914 ULONG64 Reserved[7];
915 } XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER;
916
917 typedef struct DECLSPEC_ALIGN(16) _XSAVE_AREA {
918 XSAVE_FORMAT LegacyState;
919 XSAVE_AREA_HEADER Header;
920 } XSAVE_AREA, *PXSAVE_AREA;
921
922 typedef struct _XSTATE_CONTEXT {
923 ULONG64 Mask;
924 ULONG Length;
925 ULONG Reserved1;
926 PXSAVE_AREA Area;
927 #if defined(_X86_)
928 ULONG Reserved2;
929 #endif
930 PVOID Buffer;
931 #if defined(_X86_)
932 ULONG Reserved3;
933 #endif
934 } XSTATE_CONTEXT, *PXSTATE_CONTEXT;
935
936 typedef struct _XSTATE_SAVE {
937 #if defined(_AMD64_)
938 struct _XSTATE_SAVE* Prev;
939 struct _KTHREAD* Thread;
940 UCHAR Level;
941 XSTATE_CONTEXT XStateContext;
942 #elif defined(_IA64_)
943 ULONG Dummy;
944 #elif defined(_X86_)
945 _ANONYMOUS_UNION union {
946 _ANONYMOUS_STRUCT struct {
947 LONG64 Reserved1;
948 ULONG Reserved2;
949 struct _XSTATE_SAVE* Prev;
950 PXSAVE_AREA Reserved3;
951 struct _KTHREAD* Thread;
952 PVOID Reserved4;
953 UCHAR Level;
954 } DUMMYSTRUCTNAME;
955 XSTATE_CONTEXT XStateContext;
956 } DUMMYUNIONNAME;
957 #endif
958 } XSTATE_SAVE, *PXSTATE_SAVE;
959
960 #ifdef _X86_
961
962 #define MAXIMUM_SUPPORTED_EXTENSION 512
963
964 #if !defined(__midl) && !defined(MIDL_PASS)
965 C_ASSERT(sizeof(XSAVE_FORMAT) == MAXIMUM_SUPPORTED_EXTENSION);
966 #endif
967
968 #endif /* _X86_ */
969
970 #define XSAVE_ALIGN 64
971 #define MINIMAL_XSTATE_AREA_LENGTH sizeof(XSAVE_AREA)
972
973 #if !defined(__midl) && !defined(MIDL_PASS)
974 C_ASSERT((sizeof(XSAVE_FORMAT) & (XSAVE_ALIGN - 1)) == 0);
975 C_ASSERT((FIELD_OFFSET(XSAVE_AREA, Header) & (XSAVE_ALIGN - 1)) == 0);
976 C_ASSERT(MINIMAL_XSTATE_AREA_LENGTH == 512 + 64);
977 #endif
978
979 typedef struct _CONTEXT_CHUNK {
980 LONG Offset;
981 ULONG Length;
982 } CONTEXT_CHUNK, *PCONTEXT_CHUNK;
983
984 typedef struct _CONTEXT_EX {
985 CONTEXT_CHUNK All;
986 CONTEXT_CHUNK Legacy;
987 CONTEXT_CHUNK XState;
988 } CONTEXT_EX, *PCONTEXT_EX;
989
990 #define CONTEXT_EX_LENGTH ALIGN_UP_BY(sizeof(CONTEXT_EX), STACK_ALIGN)
991
992 #if (NTDDI_VERSION >= NTDDI_VISTA)
993 extern NTSYSAPI volatile CCHAR KeNumberProcessors;
994 #elif (NTDDI_VERSION >= NTDDI_WINXP)
995 extern NTSYSAPI CCHAR KeNumberProcessors;
996 #else
997 extern PCCHAR KeNumberProcessors;
998 #endif
999
1000 $endif /* _WDMDDK_ */
1001 $if (_NTDDK_)
1002
1003 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1004 #define NX_SUPPORT_POLICY_ALWAYSON 1
1005 #define NX_SUPPORT_POLICY_OPTIN 2
1006 #define NX_SUPPORT_POLICY_OPTOUT 3
1007
1008 typedef VOID
1009 (NTAPI *PEXPAND_STACK_CALLOUT)(
1010 IN PVOID Parameter OPTIONAL);
1011
1012 typedef VOID
1013 (NTAPI *PTIMER_APC_ROUTINE)(
1014 IN PVOID TimerContext,
1015 IN ULONG TimerLowValue,
1016 IN LONG TimerHighValue);
1017
1018 typedef enum _TIMER_SET_INFORMATION_CLASS {
1019 TimerSetCoalescableTimer,
1020 MaxTimerInfoClass
1021 } TIMER_SET_INFORMATION_CLASS;
1022
1023 #if (NTDDI_VERSION >= NTDDI_WIN7)
1024 typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
1025 IN LARGE_INTEGER DueTime;
1026 IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
1027 IN PVOID TimerContext OPTIONAL;
1028 IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
1029 IN ULONG Period OPTIONAL;
1030 IN ULONG TolerableDelay;
1031 OUT PBOOLEAN PreviousState OPTIONAL;
1032 } TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
1033 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1034
1035 #define XSTATE_LEGACY_FLOATING_POINT 0
1036 #define XSTATE_LEGACY_SSE 1
1037 #define XSTATE_GSSE 2
1038
1039 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT))
1040 #define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
1041 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1042 #define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
1043
1044 #define MAXIMUM_XSTATE_FEATURES 64
1045
1046 typedef struct _XSTATE_FEATURE {
1047 ULONG Offset;
1048 ULONG Size;
1049 } XSTATE_FEATURE, *PXSTATE_FEATURE;
1050
1051 typedef struct _XSTATE_CONFIGURATION {
1052 ULONG64 EnabledFeatures;
1053 ULONG Size;
1054 ULONG OptimizedSave:1;
1055 XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
1056 } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
1057
1058 #define MAX_WOW64_SHARED_ENTRIES 16
1059
1060 typedef struct _KUSER_SHARED_DATA {
1061 ULONG TickCountLowDeprecated;
1062 ULONG TickCountMultiplier;
1063 volatile KSYSTEM_TIME InterruptTime;
1064 volatile KSYSTEM_TIME SystemTime;
1065 volatile KSYSTEM_TIME TimeZoneBias;
1066 USHORT ImageNumberLow;
1067 USHORT ImageNumberHigh;
1068 WCHAR NtSystemRoot[260];
1069 ULONG MaxStackTraceDepth;
1070 ULONG CryptoExponent;
1071 ULONG TimeZoneId;
1072 ULONG LargePageMinimum;
1073 ULONG Reserved2[7];
1074 NT_PRODUCT_TYPE NtProductType;
1075 BOOLEAN ProductTypeIsValid;
1076 ULONG NtMajorVersion;
1077 ULONG NtMinorVersion;
1078 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
1079 ULONG Reserved1;
1080 ULONG Reserved3;
1081 volatile ULONG TimeSlip;
1082 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
1083 ULONG AltArchitecturePad[1];
1084 LARGE_INTEGER SystemExpirationDate;
1085 ULONG SuiteMask;
1086 BOOLEAN KdDebuggerEnabled;
1087 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
1088 UCHAR NXSupportPolicy;
1089 #endif
1090 volatile ULONG ActiveConsoleId;
1091 volatile ULONG DismountCount;
1092 ULONG ComPlusPackage;
1093 ULONG LastSystemRITEventTickCount;
1094 ULONG NumberOfPhysicalPages;
1095 BOOLEAN SafeBootMode;
1096 #if (NTDDI_VERSION >= NTDDI_WIN7)
1097 _ANONYMOUS_UNION union {
1098 UCHAR TscQpcData;
1099 _ANONYMOUS_STRUCT struct {
1100 UCHAR TscQpcEnabled:1;
1101 UCHAR TscQpcSpareFlag:1;
1102 UCHAR TscQpcShift:6;
1103 } DUMMYSTRUCTNAME;
1104 } DUMMYUNIONNAME;
1105 UCHAR TscQpcPad[2];
1106 #endif
1107 #if (NTDDI_VERSION >= NTDDI_VISTA)
1108 _ANONYMOUS_UNION union {
1109 ULONG SharedDataFlags;
1110 _ANONYMOUS_STRUCT struct {
1111 ULONG DbgErrorPortPresent:1;
1112 ULONG DbgElevationEnabled:1;
1113 ULONG DbgVirtEnabled:1;
1114 ULONG DbgInstallerDetectEnabled:1;
1115 ULONG DbgSystemDllRelocated:1;
1116 ULONG DbgDynProcessorEnabled:1;
1117 ULONG DbgSEHValidationEnabled:1;
1118 ULONG SpareBits:25;
1119 } DUMMYSTRUCTNAME2;
1120 } DUMMYUNIONNAME2;
1121 #else
1122 ULONG TraceLogging;
1123 #endif
1124 ULONG DataFlagsPad[1];
1125 ULONGLONG TestRetInstruction;
1126 ULONG SystemCall;
1127 ULONG SystemCallReturn;
1128 ULONGLONG SystemCallPad[3];
1129 _ANONYMOUS_UNION union {
1130 volatile KSYSTEM_TIME TickCount;
1131 volatile ULONG64 TickCountQuad;
1132 _ANONYMOUS_STRUCT struct {
1133 ULONG ReservedTickCountOverlay[3];
1134 ULONG TickCountPad[1];
1135 } DUMMYSTRUCTNAME;
1136 } DUMMYUNIONNAME3;
1137 ULONG Cookie;
1138 ULONG CookiePad[1];
1139 #if (NTDDI_VERSION >= NTDDI_WS03)
1140 LONGLONG ConsoleSessionForegroundProcessId;
1141 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
1142 #endif
1143 #if (NTDDI_VERSION >= NTDDI_VISTA)
1144 #if (NTDDI_VERSION >= NTDDI_WIN7)
1145 USHORT UserModeGlobalLogger[16];
1146 #else
1147 USHORT UserModeGlobalLogger[8];
1148 ULONG HeapTracingPid[2];
1149 ULONG CritSecTracingPid[2];
1150 #endif
1151 ULONG ImageFileExecutionOptions;
1152 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
1153 ULONG LangGenerationCount;
1154 #else
1155 /* 4 bytes padding */
1156 #endif
1157 ULONGLONG Reserved5;
1158 volatile ULONG64 InterruptTimeBias;
1159 #endif
1160 #if (NTDDI_VERSION >= NTDDI_WIN7)
1161 volatile ULONG64 TscQpcBias;
1162 volatile ULONG ActiveProcessorCount;
1163 volatile USHORT ActiveGroupCount;
1164 USHORT Reserved4;
1165 volatile ULONG AitSamplingValue;
1166 volatile ULONG AppCompatFlag;
1167 ULONGLONG SystemDllNativeRelocation;
1168 ULONG SystemDllWowRelocation;
1169 ULONG XStatePad[1];
1170 XSTATE_CONFIGURATION XState;
1171 #endif
1172 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
1173
1174 #if (NTDDI_VERSION >= NTDDI_VISTA)
1175 extern NTSYSAPI volatile CCHAR KeNumberProcessors;
1176 #elif (NTDDI_VERSION >= NTDDI_WINXP)
1177 extern NTSYSAPI CCHAR KeNumberProcessors;
1178 #else
1179 extern PCCHAR KeNumberProcessors;
1180 #endif
1181
1182 $endif /* _NTDDK_ */
1183