[DDK/XDK]
[reactos.git] / reactos / 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 KDEFERRED_ROUTINE)(
644 IN struct _KDPC *Dpc,
645 IN PVOID DeferredContext OPTIONAL,
646 IN PVOID SystemArgument1 OPTIONAL,
647 IN PVOID SystemArgument2 OPTIONAL);
648 typedef KDEFERRED_ROUTINE *PKDEFERRED_ROUTINE;
649
650 typedef enum _KDPC_IMPORTANCE {
651 LowImportance,
652 MediumImportance,
653 HighImportance,
654 MediumHighImportance
655 } KDPC_IMPORTANCE;
656
657 typedef struct _KDPC {
658 UCHAR Type;
659 UCHAR Importance;
660 volatile USHORT Number;
661 LIST_ENTRY DpcListEntry;
662 PKDEFERRED_ROUTINE DeferredRoutine;
663 PVOID DeferredContext;
664 PVOID SystemArgument1;
665 PVOID SystemArgument2;
666 volatile PVOID DpcData;
667 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
668
669 typedef struct _KDPC_WATCHDOG_INFORMATION {
670 ULONG DpcTimeLimit;
671 ULONG DpcTimeCount;
672 ULONG DpcWatchdogLimit;
673 ULONG DpcWatchdogCount;
674 ULONG Reserved;
675 } KDPC_WATCHDOG_INFORMATION, *PKDPC_WATCHDOG_INFORMATION;
676
677 typedef struct _KDEVICE_QUEUE {
678 CSHORT Type;
679 CSHORT Size;
680 LIST_ENTRY DeviceListHead;
681 KSPIN_LOCK Lock;
682 # if defined(_AMD64_)
683 _ANONYMOUS_UNION union {
684 BOOLEAN Busy;
685 _ANONYMOUS_STRUCT struct {
686 LONG64 Reserved:8;
687 LONG64 Hint:56;
688 } DUMMYSTRUCTNAME;
689 } DUMMYUNIONNAME;
690 # else
691 BOOLEAN Busy;
692 # endif
693 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
694
695 #define TIMER_EXPIRED_INDEX_BITS 6
696 #define TIMER_PROCESSOR_INDEX_BITS 5
697
698 typedef struct _DISPATCHER_HEADER {
699 _ANONYMOUS_UNION union {
700 _ANONYMOUS_STRUCT struct {
701 UCHAR Type;
702 _ANONYMOUS_UNION union {
703 _ANONYMOUS_UNION union {
704 UCHAR TimerControlFlags;
705 _ANONYMOUS_STRUCT struct {
706 UCHAR Absolute:1;
707 UCHAR Coalescable:1;
708 UCHAR KeepShifting:1;
709 UCHAR EncodedTolerableDelay:5;
710 } DUMMYSTRUCTNAME;
711 } DUMMYUNIONNAME;
712 UCHAR Abandoned;
713 #if (NTDDI_VERSION < NTDDI_WIN7)
714 UCHAR NpxIrql;
715 #endif
716 BOOLEAN Signalling;
717 } DUMMYUNIONNAME;
718 _ANONYMOUS_UNION union {
719 _ANONYMOUS_UNION union {
720 UCHAR ThreadControlFlags;
721 _ANONYMOUS_STRUCT struct {
722 UCHAR CpuThrottled:1;
723 UCHAR CycleProfiling:1;
724 UCHAR CounterProfiling:1;
725 UCHAR Reserved:5;
726 } DUMMYSTRUCTNAME;
727 } DUMMYUNIONNAME;
728 UCHAR Size;
729 UCHAR Hand;
730 } DUMMYUNIONNAME2;
731 _ANONYMOUS_UNION union {
732 #if (NTDDI_VERSION >= NTDDI_WIN7)
733 _ANONYMOUS_UNION union {
734 UCHAR TimerMiscFlags;
735 _ANONYMOUS_STRUCT struct {
736 #if !defined(_X86_)
737 UCHAR Index:TIMER_EXPIRED_INDEX_BITS;
738 #else
739 UCHAR Index:1;
740 UCHAR Processor:TIMER_PROCESSOR_INDEX_BITS;
741 #endif
742 UCHAR Inserted:1;
743 volatile UCHAR Expired:1;
744 } DUMMYSTRUCTNAME;
745 } DUMMYUNIONNAME;
746 #else
747 /* Pre Win7 compatibility fix to latest WDK */
748 UCHAR Inserted;
749 #endif
750 _ANONYMOUS_UNION union {
751 BOOLEAN DebugActive;
752 _ANONYMOUS_STRUCT struct {
753 BOOLEAN ActiveDR7:1;
754 BOOLEAN Instrumented:1;
755 BOOLEAN Reserved2:4;
756 BOOLEAN UmsScheduled:1;
757 BOOLEAN UmsPrimary:1;
758 } DUMMYSTRUCTNAME;
759 } DUMMYUNIONNAME; /* should probably be DUMMYUNIONNAME2, but this is what WDK says */
760 BOOLEAN DpcActive;
761 } DUMMYUNIONNAME3;
762 } DUMMYSTRUCTNAME;
763 volatile LONG Lock;
764 } DUMMYUNIONNAME;
765 LONG SignalState;
766 LIST_ENTRY WaitListHead;
767 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
768
769 typedef struct _KEVENT {
770 DISPATCHER_HEADER Header;
771 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
772
773 typedef struct _KSEMAPHORE {
774 DISPATCHER_HEADER Header;
775 LONG Limit;
776 } KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
777
778 #define KSEMAPHORE_ACTUAL_LENGTH (FIELD_OFFSET(KSEMAPHORE, Limit) + sizeof(LONG))
779
780 typedef struct _KGATE {
781 DISPATCHER_HEADER Header;
782 } KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
783
784 typedef struct _KGUARDED_MUTEX {
785 volatile LONG Count;
786 PKTHREAD Owner;
787 ULONG Contention;
788 KGATE Gate;
789 _ANONYMOUS_UNION union {
790 _ANONYMOUS_STRUCT struct {
791 SHORT KernelApcDisable;
792 SHORT SpecialApcDisable;
793 } DUMMYSTRUCTNAME;
794 ULONG CombinedApcDisable;
795 } DUMMYUNIONNAME;
796 } KGUARDED_MUTEX, *PKGUARDED_MUTEX;
797
798 typedef struct _KMUTANT {
799 DISPATCHER_HEADER Header;
800 LIST_ENTRY MutantListEntry;
801 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
802 BOOLEAN Abandoned;
803 UCHAR ApcDisable;
804 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
805
806 #define TIMER_TABLE_SIZE 512
807 #define TIMER_TABLE_SHIFT 9
808
809 typedef struct _KTIMER {
810 DISPATCHER_HEADER Header;
811 ULARGE_INTEGER DueTime;
812 LIST_ENTRY TimerListEntry;
813 struct _KDPC *Dpc;
814 # if !defined(_X86_)
815 ULONG Processor;
816 # endif
817 ULONG Period;
818 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
819
820 typedef enum _LOCK_OPERATION {
821 IoReadAccess,
822 IoWriteAccess,
823 IoModifyAccess
824 } LOCK_OPERATION;
825
826 #define KTIMER_ACTUAL_LENGTH (FIELD_OFFSET(KTIMER, Period) + sizeof(LONG))
827
828 typedef BOOLEAN
829 (NTAPI KSYNCHRONIZE_ROUTINE)(
830 IN PVOID SynchronizeContext);
831 typedef KSYNCHRONIZE_ROUTINE *PKSYNCHRONIZE_ROUTINE;
832
833 typedef enum _POOL_TYPE {
834 NonPagedPool,
835 PagedPool,
836 NonPagedPoolMustSucceed,
837 DontUseThisType,
838 NonPagedPoolCacheAligned,
839 PagedPoolCacheAligned,
840 NonPagedPoolCacheAlignedMustS,
841 MaxPoolType,
842 NonPagedPoolSession = 32,
843 PagedPoolSession,
844 NonPagedPoolMustSucceedSession,
845 DontUseThisTypeSession,
846 NonPagedPoolCacheAlignedSession,
847 PagedPoolCacheAlignedSession,
848 NonPagedPoolCacheAlignedMustSSession
849 } POOL_TYPE;
850
851 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE {
852 StandardDesign,
853 NEC98x86,
854 EndAlternatives
855 } ALTERNATIVE_ARCHITECTURE_TYPE;
856
857 #ifndef _X86_
858
859 #ifndef IsNEC_98
860 #define IsNEC_98 (FALSE)
861 #endif
862
863 #ifndef IsNotNEC_98
864 #define IsNotNEC_98 (TRUE)
865 #endif
866
867 #ifndef SetNEC_98
868 #define SetNEC_98
869 #endif
870
871 #ifndef SetNotNEC_98
872 #define SetNotNEC_98
873 #endif
874
875 #endif
876
877 typedef struct _KSYSTEM_TIME {
878 ULONG LowPart;
879 LONG High1Time;
880 LONG High2Time;
881 } KSYSTEM_TIME, *PKSYSTEM_TIME;
882
883 typedef struct DECLSPEC_ALIGN(16) _M128A {
884 ULONGLONG Low;
885 LONGLONG High;
886 } M128A, *PM128A;
887
888 typedef struct DECLSPEC_ALIGN(16) _XSAVE_FORMAT {
889 USHORT ControlWord;
890 USHORT StatusWord;
891 UCHAR TagWord;
892 UCHAR Reserved1;
893 USHORT ErrorOpcode;
894 ULONG ErrorOffset;
895 USHORT ErrorSelector;
896 USHORT Reserved2;
897 ULONG DataOffset;
898 USHORT DataSelector;
899 USHORT Reserved3;
900 ULONG MxCsr;
901 ULONG MxCsr_Mask;
902 M128A FloatRegisters[8];
903 #if defined(_WIN64)
904 M128A XmmRegisters[16];
905 UCHAR Reserved4[96];
906 #else
907 M128A XmmRegisters[8];
908 UCHAR Reserved4[192];
909 ULONG StackControl[7];
910 ULONG Cr0NpxState;
911 #endif
912 } XSAVE_FORMAT, *PXSAVE_FORMAT;
913
914 typedef struct DECLSPEC_ALIGN(8) _XSAVE_AREA_HEADER {
915 ULONG64 Mask;
916 ULONG64 Reserved[7];
917 } XSAVE_AREA_HEADER, *PXSAVE_AREA_HEADER;
918
919 typedef struct DECLSPEC_ALIGN(16) _XSAVE_AREA {
920 XSAVE_FORMAT LegacyState;
921 XSAVE_AREA_HEADER Header;
922 } XSAVE_AREA, *PXSAVE_AREA;
923
924 typedef struct _XSTATE_CONTEXT {
925 ULONG64 Mask;
926 ULONG Length;
927 ULONG Reserved1;
928 PXSAVE_AREA Area;
929 #if defined(_X86_)
930 ULONG Reserved2;
931 #endif
932 PVOID Buffer;
933 #if defined(_X86_)
934 ULONG Reserved3;
935 #endif
936 } XSTATE_CONTEXT, *PXSTATE_CONTEXT;
937
938 typedef struct _XSTATE_SAVE {
939 #if defined(_AMD64_)
940 struct _XSTATE_SAVE* Prev;
941 struct _KTHREAD* Thread;
942 UCHAR Level;
943 XSTATE_CONTEXT XStateContext;
944 #elif defined(_IA64_)
945 ULONG Dummy;
946 #elif defined(_X86_)
947 _ANONYMOUS_UNION union {
948 _ANONYMOUS_STRUCT struct {
949 LONG64 Reserved1;
950 ULONG Reserved2;
951 struct _XSTATE_SAVE* Prev;
952 PXSAVE_AREA Reserved3;
953 struct _KTHREAD* Thread;
954 PVOID Reserved4;
955 UCHAR Level;
956 } DUMMYSTRUCTNAME;
957 XSTATE_CONTEXT XStateContext;
958 } DUMMYUNIONNAME;
959 #endif
960 } XSTATE_SAVE, *PXSTATE_SAVE;
961
962 #ifdef _X86_
963
964 #define MAXIMUM_SUPPORTED_EXTENSION 512
965
966 #if !defined(__midl) && !defined(MIDL_PASS)
967 C_ASSERT(sizeof(XSAVE_FORMAT) == MAXIMUM_SUPPORTED_EXTENSION);
968 #endif
969
970 #endif /* _X86_ */
971
972 #define XSAVE_ALIGN 64
973 #define MINIMAL_XSTATE_AREA_LENGTH sizeof(XSAVE_AREA)
974
975 #if !defined(__midl) && !defined(MIDL_PASS)
976 C_ASSERT((sizeof(XSAVE_FORMAT) & (XSAVE_ALIGN - 1)) == 0);
977 C_ASSERT((FIELD_OFFSET(XSAVE_AREA, Header) & (XSAVE_ALIGN - 1)) == 0);
978 C_ASSERT(MINIMAL_XSTATE_AREA_LENGTH == 512 + 64);
979 #endif
980
981 typedef struct _CONTEXT_CHUNK {
982 LONG Offset;
983 ULONG Length;
984 } CONTEXT_CHUNK, *PCONTEXT_CHUNK;
985
986 typedef struct _CONTEXT_EX {
987 CONTEXT_CHUNK All;
988 CONTEXT_CHUNK Legacy;
989 CONTEXT_CHUNK XState;
990 } CONTEXT_EX, *PCONTEXT_EX;
991
992 #define CONTEXT_EX_LENGTH ALIGN_UP_BY(sizeof(CONTEXT_EX), STACK_ALIGN)
993
994 #if (NTDDI_VERSION >= NTDDI_VISTA)
995 extern NTSYSAPI volatile CCHAR KeNumberProcessors;
996 #elif (NTDDI_VERSION >= NTDDI_WINXP)
997 extern NTSYSAPI CCHAR KeNumberProcessors;
998 #else
999 extern PCCHAR KeNumberProcessors;
1000 #endif
1001
1002 $endif /* _WDMDDK_ */
1003 $if (_NTDDK_)
1004
1005 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1006 #define NX_SUPPORT_POLICY_ALWAYSON 1
1007 #define NX_SUPPORT_POLICY_OPTIN 2
1008 #define NX_SUPPORT_POLICY_OPTOUT 3
1009
1010 typedef VOID
1011 (NTAPI EXPAND_STACK_CALLOUT)(
1012 IN PVOID Parameter OPTIONAL);
1013 typedef EXPAND_STACK_CALLOUT *PEXPAND_STACK_CALLOUT;
1014
1015 typedef VOID
1016 (NTAPI *PTIMER_APC_ROUTINE)(
1017 IN PVOID TimerContext,
1018 IN ULONG TimerLowValue,
1019 IN LONG TimerHighValue);
1020
1021 typedef enum _TIMER_SET_INFORMATION_CLASS {
1022 TimerSetCoalescableTimer,
1023 MaxTimerInfoClass
1024 } TIMER_SET_INFORMATION_CLASS;
1025
1026 #if (NTDDI_VERSION >= NTDDI_WIN7)
1027 typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
1028 IN LARGE_INTEGER DueTime;
1029 IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
1030 IN PVOID TimerContext OPTIONAL;
1031 IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
1032 IN ULONG Period OPTIONAL;
1033 IN ULONG TolerableDelay;
1034 OUT PBOOLEAN PreviousState OPTIONAL;
1035 } TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
1036 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1037
1038 #define XSTATE_LEGACY_FLOATING_POINT 0
1039 #define XSTATE_LEGACY_SSE 1
1040 #define XSTATE_GSSE 2
1041
1042 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT))
1043 #define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
1044 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1045 #define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
1046
1047 #define MAXIMUM_XSTATE_FEATURES 64
1048
1049 typedef struct _XSTATE_FEATURE {
1050 ULONG Offset;
1051 ULONG Size;
1052 } XSTATE_FEATURE, *PXSTATE_FEATURE;
1053
1054 typedef struct _XSTATE_CONFIGURATION {
1055 ULONG64 EnabledFeatures;
1056 ULONG Size;
1057 ULONG OptimizedSave:1;
1058 XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
1059 } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
1060
1061 #define MAX_WOW64_SHARED_ENTRIES 16
1062
1063 typedef struct _KUSER_SHARED_DATA {
1064 ULONG TickCountLowDeprecated;
1065 ULONG TickCountMultiplier;
1066 volatile KSYSTEM_TIME InterruptTime;
1067 volatile KSYSTEM_TIME SystemTime;
1068 volatile KSYSTEM_TIME TimeZoneBias;
1069 USHORT ImageNumberLow;
1070 USHORT ImageNumberHigh;
1071 WCHAR NtSystemRoot[260];
1072 ULONG MaxStackTraceDepth;
1073 ULONG CryptoExponent;
1074 ULONG TimeZoneId;
1075 ULONG LargePageMinimum;
1076 ULONG Reserved2[7];
1077 NT_PRODUCT_TYPE NtProductType;
1078 BOOLEAN ProductTypeIsValid;
1079 ULONG NtMajorVersion;
1080 ULONG NtMinorVersion;
1081 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
1082 ULONG Reserved1;
1083 ULONG Reserved3;
1084 volatile ULONG TimeSlip;
1085 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
1086 ULONG AltArchitecturePad[1];
1087 LARGE_INTEGER SystemExpirationDate;
1088 ULONG SuiteMask;
1089 BOOLEAN KdDebuggerEnabled;
1090 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
1091 UCHAR NXSupportPolicy;
1092 #endif
1093 volatile ULONG ActiveConsoleId;
1094 volatile ULONG DismountCount;
1095 ULONG ComPlusPackage;
1096 ULONG LastSystemRITEventTickCount;
1097 ULONG NumberOfPhysicalPages;
1098 BOOLEAN SafeBootMode;
1099 #if (NTDDI_VERSION >= NTDDI_WIN7)
1100 _ANONYMOUS_UNION union {
1101 UCHAR TscQpcData;
1102 _ANONYMOUS_STRUCT struct {
1103 UCHAR TscQpcEnabled:1;
1104 UCHAR TscQpcSpareFlag:1;
1105 UCHAR TscQpcShift:6;
1106 } DUMMYSTRUCTNAME;
1107 } DUMMYUNIONNAME;
1108 UCHAR TscQpcPad[2];
1109 #endif
1110 #if (NTDDI_VERSION >= NTDDI_VISTA)
1111 _ANONYMOUS_UNION union {
1112 ULONG SharedDataFlags;
1113 _ANONYMOUS_STRUCT struct {
1114 ULONG DbgErrorPortPresent:1;
1115 ULONG DbgElevationEnabled:1;
1116 ULONG DbgVirtEnabled:1;
1117 ULONG DbgInstallerDetectEnabled:1;
1118 ULONG DbgSystemDllRelocated:1;
1119 ULONG DbgDynProcessorEnabled:1;
1120 ULONG DbgSEHValidationEnabled:1;
1121 ULONG SpareBits:25;
1122 } DUMMYSTRUCTNAME2;
1123 } DUMMYUNIONNAME2;
1124 #else
1125 ULONG TraceLogging;
1126 #endif
1127 ULONG DataFlagsPad[1];
1128 ULONGLONG TestRetInstruction;
1129 ULONG SystemCall;
1130 ULONG SystemCallReturn;
1131 ULONGLONG SystemCallPad[3];
1132 _ANONYMOUS_UNION union {
1133 volatile KSYSTEM_TIME TickCount;
1134 volatile ULONG64 TickCountQuad;
1135 _ANONYMOUS_STRUCT struct {
1136 ULONG ReservedTickCountOverlay[3];
1137 ULONG TickCountPad[1];
1138 } DUMMYSTRUCTNAME;
1139 } DUMMYUNIONNAME3;
1140 ULONG Cookie;
1141 ULONG CookiePad[1];
1142 #if (NTDDI_VERSION >= NTDDI_WS03)
1143 LONGLONG ConsoleSessionForegroundProcessId;
1144 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
1145 #endif
1146 #if (NTDDI_VERSION >= NTDDI_VISTA)
1147 #if (NTDDI_VERSION >= NTDDI_WIN7)
1148 USHORT UserModeGlobalLogger[16];
1149 #else
1150 USHORT UserModeGlobalLogger[8];
1151 ULONG HeapTracingPid[2];
1152 ULONG CritSecTracingPid[2];
1153 #endif
1154 ULONG ImageFileExecutionOptions;
1155 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
1156 ULONG LangGenerationCount;
1157 #else
1158 /* 4 bytes padding */
1159 #endif
1160 ULONGLONG Reserved5;
1161 volatile ULONG64 InterruptTimeBias;
1162 #endif
1163 #if (NTDDI_VERSION >= NTDDI_WIN7)
1164 volatile ULONG64 TscQpcBias;
1165 volatile ULONG ActiveProcessorCount;
1166 volatile USHORT ActiveGroupCount;
1167 USHORT Reserved4;
1168 volatile ULONG AitSamplingValue;
1169 volatile ULONG AppCompatFlag;
1170 ULONGLONG SystemDllNativeRelocation;
1171 ULONG SystemDllWowRelocation;
1172 ULONG XStatePad[1];
1173 XSTATE_CONFIGURATION XState;
1174 #endif
1175 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
1176
1177 #if (NTDDI_VERSION >= NTDDI_VISTA)
1178 extern NTSYSAPI volatile CCHAR KeNumberProcessors;
1179 #elif (NTDDI_VERSION >= NTDDI_WINXP)
1180 extern NTSYSAPI CCHAR KeNumberProcessors;
1181 #else
1182 extern PCCHAR KeNumberProcessors;
1183 #endif
1184
1185 $endif /* _NTDDK_ */
1186