xref: /reactos/sdk/include/ndk/extypes.h (revision 845faec4)
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     extypes.h
8 
9 Abstract:
10 
11     Type definitions for the Executive.
12 
13 Author:
14 
15     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _EXTYPES_H
20 #define _EXTYPES_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <cfg.h>
27 #if !defined(NTOS_MODE_USER)
28 #include <ntimage.h>
29 #endif
30 #include <cmtypes.h>
31 #include <ketypes.h>
32 #include <potypes.h>
33 #include <lpctypes.h>
34 #ifdef NTOS_MODE_USER
35 #include <obtypes.h>
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //
43 // GCC compatibility
44 //
45 #if defined(__GNUC__)
46 #define __ALIGNED(n)    __attribute__((aligned (n)))
47 #elif defined(_MSC_VER)
48 #define __ALIGNED(n)    __declspec(align(n))
49 #else
50 #error __ALIGNED not defined for your compiler!
51 #endif
52 
53 //
54 // Rtl Atom
55 //
56 typedef USHORT RTL_ATOM, *PRTL_ATOM;
57 
58 #ifndef NTOS_MODE_USER
59 
60 //
61 // Kernel Exported Object Types
62 //
63 extern POBJECT_TYPE NTSYSAPI ExDesktopObjectType;
64 extern POBJECT_TYPE NTSYSAPI ExWindowStationObjectType;
65 extern POBJECT_TYPE NTSYSAPI ExIoCompletionType;
66 extern POBJECT_TYPE NTSYSAPI ExMutantObjectType;
67 extern POBJECT_TYPE NTSYSAPI ExTimerType;
68 
69 //
70 // Exported NT Build Number
71 //
72 extern ULONG NTSYSAPI NtBuildNumber;
73 
74 //
75 // Invalid Handle Value Constant
76 //
77 #define INVALID_HANDLE_VALUE                (HANDLE)-1
78 
79 #endif
80 
81 //
82 // Increments
83 //
84 #define MUTANT_INCREMENT                    1
85 
86 //
87 // Callback Object Access Mask
88 //
89 #define CALLBACK_MODIFY_STATE               0x0001
90 #define CALLBACK_ALL_ACCESS                 (STANDARD_RIGHTS_REQUIRED | \
91                                              SYNCHRONIZE | \
92                                              CALLBACK_MODIFY_STATE)
93 
94 //
95 // Event Object Access Masks
96 //
97 #ifdef NTOS_MODE_USER
98 #define EVENT_QUERY_STATE                   0x0001
99 
100 //
101 // Semaphore Object Access Masks
102 //
103 #define SEMAPHORE_QUERY_STATE               0x0001
104 #else
105 
106 //
107 // Mutant Object Access Masks
108 //
109 #define MUTANT_QUERY_STATE                  0x0001
110 #define MUTANT_ALL_ACCESS                   (STANDARD_RIGHTS_REQUIRED | \
111                                              SYNCHRONIZE | \
112                                              MUTANT_QUERY_STATE)
113 
114 #define TIMER_QUERY_STATE                   0x0001
115 #define TIMER_MODIFY_STATE                  0x0002
116 #define TIMER_ALL_ACCESS                    (STANDARD_RIGHTS_REQUIRED | \
117                                              SYNCHRONIZE | \
118                                              TIMER_QUERY_STATE | \
119                                              TIMER_MODIFY_STATE)
120 #endif
121 
122 //
123 // Event Pair Access Masks
124 //
125 #define EVENT_PAIR_ALL_ACCESS               0x1F0000L
126 
127 //
128 // Profile Object Access Masks
129 //
130 #define PROFILE_CONTROL                     0x0001
131 #define PROFILE_ALL_ACCESS                  (STANDARD_RIGHTS_REQUIRED | PROFILE_CONTROL)
132 
133 //
134 // Keyed Event Object Access Masks
135 //
136 #define KEYEDEVENT_WAIT                     0x0001
137 #define KEYEDEVENT_WAKE                     0x0002
138 #define KEYEDEVENT_ALL_ACCESS               (STANDARD_RIGHTS_REQUIRED | \
139                                              KEYEDEVENT_WAIT | \
140                                              KEYEDEVENT_WAKE)
141 
142 //
143 // NtRaiseHardError-related parameters
144 //
145 #define MAXIMUM_HARDERROR_PARAMETERS        4
146 #define HARDERROR_OVERRIDE_ERRORMODE        0x10000000
147 
148 //
149 // Pushlock bits
150 //
151 #define EX_PUSH_LOCK_LOCK_V                 ((ULONG_PTR)0x0)
152 #define EX_PUSH_LOCK_LOCK                   ((ULONG_PTR)0x1)
153 #define EX_PUSH_LOCK_WAITING                ((ULONG_PTR)0x2)
154 #define EX_PUSH_LOCK_WAKING                 ((ULONG_PTR)0x4)
155 #define EX_PUSH_LOCK_MULTIPLE_SHARED        ((ULONG_PTR)0x8)
156 #define EX_PUSH_LOCK_SHARE_INC              ((ULONG_PTR)0x10)
157 #define EX_PUSH_LOCK_PTR_BITS               ((ULONG_PTR)0xf)
158 
159 //
160 // Pushlock Wait Block Flags
161 //
162 #define EX_PUSH_LOCK_FLAGS_EXCLUSIVE        1
163 #define EX_PUSH_LOCK_FLAGS_WAIT_V           1
164 #define EX_PUSH_LOCK_FLAGS_WAIT             2
165 
166 //
167 // Resource (ERESOURCE) Flags
168 //
169 #define ResourceHasDisabledPriorityBoost    0x08
170 
171 //
172 // Shutdown types for NtShutdownSystem
173 //
174 typedef enum _SHUTDOWN_ACTION
175 {
176     ShutdownNoReboot,
177     ShutdownReboot,
178     ShutdownPowerOff
179 } SHUTDOWN_ACTION;
180 
181 //
182 // Responses for NtRaiseHardError
183 //
184 typedef enum _HARDERROR_RESPONSE_OPTION
185 {
186     OptionAbortRetryIgnore,
187     OptionOk,
188     OptionOkCancel,
189     OptionRetryCancel,
190     OptionYesNo,
191     OptionYesNoCancel,
192     OptionShutdownSystem,
193     OptionOkNoWait,
194     OptionCancelTryContinue
195 } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION;
196 
197 typedef enum _HARDERROR_RESPONSE
198 {
199     ResponseReturnToCaller,
200     ResponseNotHandled,
201     ResponseAbort,
202     ResponseCancel,
203     ResponseIgnore,
204     ResponseNo,
205     ResponseOk,
206     ResponseRetry,
207     ResponseYes,
208     ResponseTryAgain,
209     ResponseContinue
210 } HARDERROR_RESPONSE, *PHARDERROR_RESPONSE;
211 
212 //
213 //  System Information Classes for NtQuerySystemInformation
214 //
215 typedef enum _SYSTEM_INFORMATION_CLASS
216 {
217     SystemBasicInformation,
218     SystemProcessorInformation,
219     SystemPerformanceInformation,
220     SystemTimeOfDayInformation,
221     SystemPathInformation, /// Obsolete: Use KUSER_SHARED_DATA
222     SystemProcessInformation,
223     SystemCallCountInformation,
224     SystemDeviceInformation,
225     SystemProcessorPerformanceInformation,
226     SystemFlagsInformation,
227     SystemCallTimeInformation,
228     SystemModuleInformation,
229     SystemLocksInformation,
230     SystemStackTraceInformation,
231     SystemPagedPoolInformation,
232     SystemNonPagedPoolInformation,
233     SystemHandleInformation,
234     SystemObjectInformation,
235     SystemPageFileInformation,
236     SystemVdmInstemulInformation,
237     SystemVdmBopInformation,
238     SystemFileCacheInformation,
239     SystemPoolTagInformation,
240     SystemInterruptInformation,
241     SystemDpcBehaviorInformation,
242     SystemFullMemoryInformation,
243     SystemLoadGdiDriverInformation,
244     SystemUnloadGdiDriverInformation,
245     SystemTimeAdjustmentInformation,
246     SystemSummaryMemoryInformation,
247     SystemMirrorMemoryInformation,
248     SystemPerformanceTraceInformation,
249     SystemObsolete0,
250     SystemExceptionInformation,
251     SystemCrashDumpStateInformation,
252     SystemKernelDebuggerInformation,
253     SystemContextSwitchInformation,
254     SystemRegistryQuotaInformation,
255     SystemExtendServiceTableInformation,
256     SystemPrioritySeperation,
257     SystemPlugPlayBusInformation,
258     SystemDockInformation,
259     SystemPowerInformationNative,
260     SystemProcessorSpeedInformation,
261     SystemCurrentTimeZoneInformation,
262     SystemLookasideInformation,
263     SystemTimeSlipNotification,
264     SystemSessionCreate,
265     SystemSessionDetach,
266     SystemSessionInformation,
267     SystemRangeStartInformation,
268     SystemVerifierInformation,
269     SystemAddVerifier,
270     SystemSessionProcessesInformation,
271     SystemLoadGdiDriverInSystemSpaceInformation,
272     SystemNumaProcessorMap,
273     SystemPrefetcherInformation,
274     SystemExtendedProcessInformation,
275     SystemRecommendedSharedDataAlignment,
276     SystemComPlusPackage,
277     SystemNumaAvailableMemory,
278     SystemProcessorPowerInformation,
279     SystemEmulationBasicInformation,
280     SystemEmulationProcessorInformation,
281     SystemExtendedHandleInformation,
282     SystemLostDelayedWriteInformation,
283     SystemBigPoolInformation,
284     SystemSessionPoolTagInformation,
285     SystemSessionMappedViewInformation,
286     SystemHotpatchInformation,
287     SystemObjectSecurityMode,
288     SystemWatchDogTimerHandler,
289     SystemWatchDogTimerInformation,
290     SystemLogicalProcessorInformation,
291     SystemWow64SharedInformationObsolete,
292     SystemRegisterFirmwareTableInformationHandler,
293     SystemFirmwareTableInformation,
294     SystemModuleInformationEx,
295     SystemVerifierTriageInformation,
296     SystemSuperfetchInformation,
297     SystemMemoryListInformation,
298     SystemFileCacheInformationEx,
299     SystemThreadPriorityClientIdInformation,
300     SystemProcessorIdleCycleTimeInformation,
301     SystemVerifierCancellationInformation,
302     SystemProcessorPowerInformationEx,
303     SystemRefTraceInformation,
304     SystemSpecialPoolInformation,
305     SystemProcessIdInformation,
306     SystemErrorPortInformation,
307     SystemBootEnvironmentInformation,
308     SystemHypervisorInformation,
309     SystemVerifierInformationEx,
310     SystemTimeZoneInformation,
311     SystemImageFileExecutionOptionsInformation,
312     SystemCoverageInformation,
313     SystemPrefetchPathInformation,
314     SystemVerifierFaultsInformation,
315     MaxSystemInfoClass,
316 } SYSTEM_INFORMATION_CLASS;
317 
318 //
319 //  System Information Classes for NtQueryMutant
320 //
321 typedef enum _MUTANT_INFORMATION_CLASS
322 {
323     MutantBasicInformation,
324     MutantOwnerInformation
325 } MUTANT_INFORMATION_CLASS;
326 
327 //
328 //  System Information Classes for NtQueryAtom
329 //
330 typedef enum _ATOM_INFORMATION_CLASS
331 {
332     AtomBasicInformation,
333     AtomTableInformation,
334 } ATOM_INFORMATION_CLASS;
335 
336 //
337 //  System Information Classes for NtQueryTimer
338 //
339 typedef enum _TIMER_INFORMATION_CLASS
340 {
341     TimerBasicInformation
342 } TIMER_INFORMATION_CLASS;
343 
344 //
345 //  System Information Classes for NtQuerySemaphore
346 //
347 typedef enum _SEMAPHORE_INFORMATION_CLASS
348 {
349     SemaphoreBasicInformation
350 } SEMAPHORE_INFORMATION_CLASS;
351 
352 //
353 //  System Information Classes for NtQueryEvent
354 //
355 typedef enum _EVENT_INFORMATION_CLASS
356 {
357     EventBasicInformation
358 } EVENT_INFORMATION_CLASS;
359 
360 #ifdef NTOS_MODE_USER
361 
362 //
363 // Firmware Table Actions for SystemFirmwareTableInformation
364 //
365 typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION
366 {
367     SystemFirmwareTable_Enumerate = 0,
368     SystemFirmwareTable_Get = 1,
369 } SYSTEM_FIRMWARE_TABLE_ACTION, *PSYSTEM_FIRMWARE_TABLE_ACTION;
370 
371 //
372 // Firmware Handler Callback
373 //
374 struct _SYSTEM_FIRMWARE_TABLE_INFORMATION;
375 typedef
376 NTSTATUS
377 (__cdecl *PFNFTH)(
378     _In_ struct _SYSTEM_FIRMWARE_TABLE_INFORMATION *FirmwareTableInformation
379 );
380 
381 #else
382 
383 //
384 // Handle Enumeration Callback
385 //
386 struct _HANDLE_TABLE_ENTRY;
387 typedef BOOLEAN
388 (NTAPI *PEX_ENUM_HANDLE_CALLBACK)(
389     _In_ struct _HANDLE_TABLE_ENTRY *HandleTableEntry,
390     _In_ HANDLE Handle,
391     _In_ PVOID Context
392 );
393 
394 //
395 // Executive Work Queue Structures
396 //
397 typedef struct _EX_QUEUE_WORKER_INFO
398 {
399     ULONG QueueDisabled:1;
400     ULONG MakeThreadsAsNecessary:1;
401     ULONG WaitMode:1;
402     ULONG WorkerCount:29;
403 } EX_QUEUE_WORKER_INFO, *PEX_QUEUE_WORKER_INFO;
404 
405 typedef struct _EX_WORK_QUEUE
406 {
407     KQUEUE WorkerQueue;
408     LONG DynamicThreadCount;
409     ULONG WorkItemsProcessed;
410     ULONG WorkItemsProcessedLastPass;
411     ULONG QueueDepthLastPass;
412     EX_QUEUE_WORKER_INFO Info;
413 } EX_WORK_QUEUE, *PEX_WORK_QUEUE;
414 
415 //
416 // Executive Fast Reference Structure
417 //
418 typedef struct _EX_FAST_REF
419 {
420     union
421     {
422         PVOID Object;
423         ULONG_PTR RefCnt:3;
424         ULONG_PTR Value;
425     };
426 } EX_FAST_REF, *PEX_FAST_REF;
427 
428 //
429 // Executive Cache-Aware Rundown Reference Descriptor
430 //
431 typedef struct _EX_RUNDOWN_REF_CACHE_AWARE
432 {
433     PEX_RUNDOWN_REF RunRefs;
434     PVOID PoolToFree;
435     ULONG RunRefSize;
436     ULONG Number;
437 } EX_RUNDOWN_REF_CACHE_AWARE;
438 
439 //
440 // Executive Rundown Wait Block
441 //
442 typedef struct _EX_RUNDOWN_WAIT_BLOCK
443 {
444     ULONG_PTR Count;
445     KEVENT WakeEvent;
446 } EX_RUNDOWN_WAIT_BLOCK, *PEX_RUNDOWN_WAIT_BLOCK;
447 
448 //
449 // Executive Pushlock
450 //
451 #undef EX_PUSH_LOCK
452 #undef PEX_PUSH_LOCK
453 typedef struct _EX_PUSH_LOCK
454 {
455     union
456     {
457         struct
458         {
459             ULONG_PTR Locked:1;
460             ULONG_PTR Waiting:1;
461             ULONG_PTR Waking:1;
462             ULONG_PTR MultipleShared:1;
463             ULONG_PTR Shared:sizeof (ULONG_PTR) * 8 - 4;
464         };
465         ULONG_PTR Value;
466         PVOID Ptr;
467     };
468 } EX_PUSH_LOCK, *PEX_PUSH_LOCK;
469 
470 //
471 // Executive Pushlock Wait Block
472 //
473 
474 //
475 // The wait block has to be properly aligned
476 // on a non-checked build even if the debug data isn't there.
477 //
478 #if defined(_MSC_VER)
479 #pragma warning(push)
480 #pragma warning(disable:4324)
481 #endif
482 
483 typedef __ALIGNED(16) struct _EX_PUSH_LOCK_WAIT_BLOCK
484 {
485     union
486     {
487         KGATE WakeGate;
488         KEVENT WakeEvent;
489     };
490     struct _EX_PUSH_LOCK_WAIT_BLOCK *Next;
491     struct _EX_PUSH_LOCK_WAIT_BLOCK *Last;
492     struct _EX_PUSH_LOCK_WAIT_BLOCK *Previous;
493     LONG ShareCount;
494     LONG Flags;
495 #if DBG
496     BOOLEAN Signaled;
497     EX_PUSH_LOCK NewValue;
498     EX_PUSH_LOCK OldValue;
499     PEX_PUSH_LOCK PushLock;
500 #endif
501 } EX_PUSH_LOCK_WAIT_BLOCK, *PEX_PUSH_LOCK_WAIT_BLOCK;
502 
503 #if defined(_MSC_VER)
504 #pragma warning(pop)
505 #endif
506 
507 //
508 // Callback Object
509 //
510 typedef struct _CALLBACK_OBJECT
511 {
512     ULONG Signature;
513     KSPIN_LOCK Lock;
514     LIST_ENTRY RegisteredCallbacks;
515     BOOLEAN AllowMultipleCallbacks;
516     UCHAR reserved[3];
517 } CALLBACK_OBJECT;
518 
519 //
520 // Callback Handle
521 //
522 typedef struct _CALLBACK_REGISTRATION
523 {
524     LIST_ENTRY Link;
525     PCALLBACK_OBJECT CallbackObject;
526     PCALLBACK_FUNCTION CallbackFunction;
527     PVOID CallbackContext;
528     ULONG Busy;
529     BOOLEAN UnregisterWaiting;
530 } CALLBACK_REGISTRATION, *PCALLBACK_REGISTRATION;
531 
532 //
533 // Internal Callback Object
534 //
535 typedef struct _EX_CALLBACK_ROUTINE_BLOCK
536 {
537     EX_RUNDOWN_REF RundownProtect;
538     PEX_CALLBACK_FUNCTION Function;
539     PVOID Context;
540 } EX_CALLBACK_ROUTINE_BLOCK, *PEX_CALLBACK_ROUTINE_BLOCK;
541 
542 //
543 // Internal Callback Handle
544 //
545 typedef struct _EX_CALLBACK
546 {
547     EX_FAST_REF RoutineBlock;
548 } EX_CALLBACK, *PEX_CALLBACK;
549 
550 //
551 // Profile Object
552 //
553 typedef struct _EPROFILE
554 {
555     PEPROCESS Process;
556     PVOID RangeBase;
557     SIZE_T RangeSize;
558     PVOID Buffer;
559     ULONG BufferSize;
560     ULONG BucketSize;
561     PKPROFILE ProfileObject;
562     PVOID LockedBufferAddress;
563     PMDL Mdl;
564     ULONG_PTR Segment;
565     KPROFILE_SOURCE ProfileSource;
566     KAFFINITY Affinity;
567 } EPROFILE, *PEPROFILE;
568 
569 //
570 // Handle Table Structures
571 //
572 typedef struct _HANDLE_TRACE_DB_ENTRY
573 {
574     CLIENT_ID ClientId;
575     HANDLE Handle;
576     ULONG Type;
577     PVOID StackTrace[16];
578 } HANDLE_TRACE_DB_ENTRY, *PHANDLE_TRACE_DB_ENTRY;
579 
580 typedef struct _HANDLE_TRACE_DEBUG_INFO
581 {
582     LONG RefCount;
583     ULONG TableSize;
584     ULONG BitMaskFlags;
585     FAST_MUTEX CloseCompatcionLock;
586     ULONG CurrentStackIndex;
587     HANDLE_TRACE_DB_ENTRY TraceDb[1];
588 } HANDLE_TRACE_DEBUG_INFO, *PHANDLE_TRACE_DEBUG_INFO;
589 
590 typedef struct _HANDLE_TABLE_ENTRY_INFO
591 {
592     ULONG AuditMask;
593 } HANDLE_TABLE_ENTRY_INFO, *PHANDLE_TABLE_ENTRY_INFO;
594 
595 typedef struct _HANDLE_TABLE_ENTRY
596 {
597     union
598     {
599         PVOID Object;
600         ULONG_PTR ObAttributes;
601         PHANDLE_TABLE_ENTRY_INFO InfoTable;
602         ULONG_PTR Value;
603     };
604     union
605     {
606         ULONG GrantedAccess;
607         struct
608         {
609             USHORT GrantedAccessIndex;
610             USHORT CreatorBackTraceIndex;
611         };
612         LONG NextFreeTableEntry;
613     };
614 } HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
615 
616 typedef struct _HANDLE_TABLE
617 {
618 #if (NTDDI_VERSION >= NTDDI_WINXP)
619     ULONG_PTR TableCode;
620 #else
621     PHANDLE_TABLE_ENTRY **Table;
622 #endif
623     PEPROCESS QuotaProcess;
624     PVOID UniqueProcessId;
625 #if (NTDDI_VERSION >= NTDDI_WINXP)
626     EX_PUSH_LOCK HandleTableLock[4];
627     LIST_ENTRY HandleTableList;
628     EX_PUSH_LOCK HandleContentionEvent;
629 #else
630     ERESOURCE HandleLock;
631     LIST_ENTRY HandleTableList;
632     KEVENT HandleContentionEvent;
633 #endif
634     PHANDLE_TRACE_DEBUG_INFO DebugInfo;
635     LONG ExtraInfoPages;
636 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
637     union
638     {
639         ULONG Flags;
640         UCHAR StrictFIFO:1;
641     };
642     LONG FirstFreeHandle;
643     PHANDLE_TABLE_ENTRY LastFreeHandleEntry;
644     LONG HandleCount;
645     ULONG NextHandleNeedingPool;
646 #else
647     ULONG FirstFree;
648     ULONG LastFree;
649     ULONG NextHandleNeedingPool;
650     LONG HandleCount;
651     union
652     {
653         ULONG Flags;
654         UCHAR StrictFIFO:1;
655     };
656 #endif
657 } HANDLE_TABLE, *PHANDLE_TABLE;
658 
659 #endif
660 
661 //
662 // Hard Error LPC Message
663 //
664 typedef struct _HARDERROR_MSG
665 {
666     PORT_MESSAGE h;
667     NTSTATUS Status;
668     LARGE_INTEGER ErrorTime;
669     ULONG ValidResponseOptions;
670     ULONG Response;
671     ULONG NumberOfParameters;
672     ULONG UnicodeStringParameterMask;
673     ULONG_PTR Parameters[MAXIMUM_HARDERROR_PARAMETERS];
674 } HARDERROR_MSG, *PHARDERROR_MSG;
675 
676 //
677 // Information Structures for NtQueryMutant
678 //
679 typedef struct _MUTANT_BASIC_INFORMATION
680 {
681     LONG CurrentCount;
682     BOOLEAN OwnedByCaller;
683     BOOLEAN AbandonedState;
684 } MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
685 
686 typedef struct _MUTANT_OWNER_INFORMATION
687 {
688     CLIENT_ID ClientId;
689 } MUTANT_OWNER_INFORMATION, *PMUTANT_OWNER_INFORMATION;
690 
691 //
692 // Information Structures for NtQueryAtom
693 //
694 typedef struct _ATOM_BASIC_INFORMATION
695 {
696     USHORT UsageCount;
697     USHORT Flags;
698     USHORT NameLength;
699     WCHAR Name[1];
700 } ATOM_BASIC_INFORMATION, *PATOM_BASIC_INFORMATION;
701 
702 typedef struct _ATOM_TABLE_INFORMATION
703 {
704     ULONG NumberOfAtoms;
705     USHORT Atoms[1];
706 } ATOM_TABLE_INFORMATION, *PATOM_TABLE_INFORMATION;
707 
708 //
709 // Information Structures for NtQueryTimer
710 //
711 typedef struct _TIMER_BASIC_INFORMATION
712 {
713     LARGE_INTEGER TimeRemaining;
714     BOOLEAN SignalState;
715 } TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
716 
717 //
718 // Information Structures for NtQuerySemaphore
719 //
720 typedef struct _SEMAPHORE_BASIC_INFORMATION
721 {
722     LONG CurrentCount;
723     LONG MaximumCount;
724 } SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
725 
726 //
727 // Information Structures for NtQueryEvent
728 //
729 typedef struct _EVENT_BASIC_INFORMATION
730 {
731     EVENT_TYPE EventType;
732     LONG EventState;
733 } EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
734 
735 //
736 // Information Structures for NtQuerySystemInformation
737 //
738 typedef struct _SYSTEM_BASIC_INFORMATION
739 {
740     ULONG Reserved;
741     ULONG TimerResolution;
742     ULONG PageSize;
743     ULONG NumberOfPhysicalPages;
744     ULONG LowestPhysicalPageNumber;
745     ULONG HighestPhysicalPageNumber;
746     ULONG AllocationGranularity;
747     ULONG_PTR MinimumUserModeAddress;
748     ULONG_PTR MaximumUserModeAddress;
749     ULONG_PTR ActiveProcessorsAffinityMask;
750     CCHAR NumberOfProcessors;
751 } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
752 
753 // Class 1
754 typedef struct _SYSTEM_PROCESSOR_INFORMATION
755 {
756     USHORT ProcessorArchitecture;
757     USHORT ProcessorLevel;
758     USHORT ProcessorRevision;
759     USHORT Reserved;
760     ULONG ProcessorFeatureBits;
761 } SYSTEM_PROCESSOR_INFORMATION, *PSYSTEM_PROCESSOR_INFORMATION;
762 
763 // Class 2
764 typedef struct _SYSTEM_PERFORMANCE_INFORMATION
765 {
766     LARGE_INTEGER IdleProcessTime;
767     LARGE_INTEGER IoReadTransferCount;
768     LARGE_INTEGER IoWriteTransferCount;
769     LARGE_INTEGER IoOtherTransferCount;
770     ULONG IoReadOperationCount;
771     ULONG IoWriteOperationCount;
772     ULONG IoOtherOperationCount;
773     ULONG AvailablePages;
774     ULONG CommittedPages;
775     ULONG CommitLimit;
776     ULONG PeakCommitment;
777     ULONG PageFaultCount;
778     ULONG CopyOnWriteCount;
779     ULONG TransitionCount;
780     ULONG CacheTransitionCount;
781     ULONG DemandZeroCount;
782     ULONG PageReadCount;
783     ULONG PageReadIoCount;
784     ULONG CacheReadCount;
785     ULONG CacheIoCount;
786     ULONG DirtyPagesWriteCount;
787     ULONG DirtyWriteIoCount;
788     ULONG MappedPagesWriteCount;
789     ULONG MappedWriteIoCount;
790     ULONG PagedPoolPages;
791     ULONG NonPagedPoolPages;
792     ULONG PagedPoolAllocs;
793     ULONG PagedPoolFrees;
794     ULONG NonPagedPoolAllocs;
795     ULONG NonPagedPoolFrees;
796     ULONG FreeSystemPtes;
797     ULONG ResidentSystemCodePage;
798     ULONG TotalSystemDriverPages;
799     ULONG TotalSystemCodePages;
800     ULONG NonPagedPoolLookasideHits;
801     ULONG PagedPoolLookasideHits;
802     ULONG Spare3Count;
803     ULONG ResidentSystemCachePage;
804     ULONG ResidentPagedPoolPage;
805     ULONG ResidentSystemDriverPage;
806     ULONG CcFastReadNoWait;
807     ULONG CcFastReadWait;
808     ULONG CcFastReadResourceMiss;
809     ULONG CcFastReadNotPossible;
810     ULONG CcFastMdlReadNoWait;
811     ULONG CcFastMdlReadWait;
812     ULONG CcFastMdlReadResourceMiss;
813     ULONG CcFastMdlReadNotPossible;
814     ULONG CcMapDataNoWait;
815     ULONG CcMapDataWait;
816     ULONG CcMapDataNoWaitMiss;
817     ULONG CcMapDataWaitMiss;
818     ULONG CcPinMappedDataCount;
819     ULONG CcPinReadNoWait;
820     ULONG CcPinReadWait;
821     ULONG CcPinReadNoWaitMiss;
822     ULONG CcPinReadWaitMiss;
823     ULONG CcCopyReadNoWait;
824     ULONG CcCopyReadWait;
825     ULONG CcCopyReadNoWaitMiss;
826     ULONG CcCopyReadWaitMiss;
827     ULONG CcMdlReadNoWait;
828     ULONG CcMdlReadWait;
829     ULONG CcMdlReadNoWaitMiss;
830     ULONG CcMdlReadWaitMiss;
831     ULONG CcReadAheadIos;
832     ULONG CcLazyWriteIos;
833     ULONG CcLazyWritePages;
834     ULONG CcDataFlushes;
835     ULONG CcDataPages;
836     ULONG ContextSwitches;
837     ULONG FirstLevelTbFills;
838     ULONG SecondLevelTbFills;
839     ULONG SystemCalls;
840 } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
841 
842 // Class 3
843 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION
844 {
845     LARGE_INTEGER BootTime;
846     LARGE_INTEGER CurrentTime;
847     LARGE_INTEGER TimeZoneBias;
848     ULONG TimeZoneId;
849     ULONG Reserved;
850 #if (NTDDI_VERSION >= NTDDI_WIN2K)
851     ULONGLONG BootTimeBias;
852     ULONGLONG SleepTimeBias;
853 #endif
854 } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;
855 
856 // Class 4
857 // This class is obsolete, please use KUSER_SHARED_DATA instead
858 
859 // Class 5
860 typedef struct _SYSTEM_THREAD_INFORMATION
861 {
862     LARGE_INTEGER KernelTime;
863     LARGE_INTEGER UserTime;
864     LARGE_INTEGER CreateTime;
865     ULONG WaitTime;
866     PVOID StartAddress;
867     CLIENT_ID ClientId;
868     KPRIORITY Priority;
869     LONG BasePriority;
870     ULONG ContextSwitches;
871     ULONG ThreadState;
872     ULONG WaitReason;
873     ULONG PadPadAlignment;
874 } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
875 #ifndef _WIN64
876 C_ASSERT(sizeof(SYSTEM_THREAD_INFORMATION) == 0x40); // Must be 8-byte aligned
877 #endif
878 
879 typedef struct _SYSTEM_PROCESS_INFORMATION
880 {
881     ULONG NextEntryOffset;
882     ULONG NumberOfThreads;
883     LARGE_INTEGER WorkingSetPrivateSize; //VISTA
884     ULONG HardFaultCount; //WIN7
885     ULONG NumberOfThreadsHighWatermark; //WIN7
886     ULONGLONG CycleTime; //WIN7
887     LARGE_INTEGER CreateTime;
888     LARGE_INTEGER UserTime;
889     LARGE_INTEGER KernelTime;
890     UNICODE_STRING ImageName;
891     KPRIORITY BasePriority;
892     HANDLE UniqueProcessId;
893     HANDLE InheritedFromUniqueProcessId;
894     ULONG HandleCount;
895     ULONG SessionId;
896     ULONG_PTR PageDirectoryBase;
897 
898     //
899     // This part corresponds to VM_COUNTERS_EX.
900     // NOTE: *NOT* THE SAME AS VM_COUNTERS!
901     //
902     SIZE_T PeakVirtualSize;
903     SIZE_T VirtualSize;
904     ULONG PageFaultCount;
905     SIZE_T PeakWorkingSetSize;
906     SIZE_T WorkingSetSize;
907     SIZE_T QuotaPeakPagedPoolUsage;
908     SIZE_T QuotaPagedPoolUsage;
909     SIZE_T QuotaPeakNonPagedPoolUsage;
910     SIZE_T QuotaNonPagedPoolUsage;
911     SIZE_T PagefileUsage;
912     SIZE_T PeakPagefileUsage;
913     SIZE_T PrivatePageCount;
914 
915     //
916     // This part corresponds to IO_COUNTERS
917     //
918     LARGE_INTEGER ReadOperationCount;
919     LARGE_INTEGER WriteOperationCount;
920     LARGE_INTEGER OtherOperationCount;
921     LARGE_INTEGER ReadTransferCount;
922     LARGE_INTEGER WriteTransferCount;
923     LARGE_INTEGER OtherTransferCount;
924 //    SYSTEM_THREAD_INFORMATION TH[1];
925 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
926 #ifndef _WIN64
927 C_ASSERT(sizeof(SYSTEM_PROCESS_INFORMATION) == 0xB8); // Must be 8-byte aligned
928 #endif
929 
930 //
931 // Class 6
932 typedef struct _SYSTEM_CALL_COUNT_INFORMATION
933 {
934     ULONG Length;
935     ULONG NumberOfTables;
936 } SYSTEM_CALL_COUNT_INFORMATION, *PSYSTEM_CALL_COUNT_INFORMATION;
937 
938 // Class 7
939 typedef struct _SYSTEM_DEVICE_INFORMATION
940 {
941     ULONG NumberOfDisks;
942     ULONG NumberOfFloppies;
943     ULONG NumberOfCdRoms;
944     ULONG NumberOfTapes;
945     ULONG NumberOfSerialPorts;
946     ULONG NumberOfParallelPorts;
947 } SYSTEM_DEVICE_INFORMATION, *PSYSTEM_DEVICE_INFORMATION;
948 
949 // Class 8
950 typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
951 {
952     LARGE_INTEGER IdleTime;
953     LARGE_INTEGER KernelTime;
954     LARGE_INTEGER UserTime;
955     LARGE_INTEGER DpcTime;
956     LARGE_INTEGER InterruptTime;
957     ULONG InterruptCount;
958 } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
959 
960 // Class 9
961 typedef struct _SYSTEM_FLAGS_INFORMATION
962 {
963     ULONG Flags;
964 } SYSTEM_FLAGS_INFORMATION, *PSYSTEM_FLAGS_INFORMATION;
965 
966 // Class 10
967 typedef struct _SYSTEM_CALL_TIME_INFORMATION
968 {
969     ULONG Length;
970     ULONG TotalCalls;
971     LARGE_INTEGER TimeOfCalls[1];
972 } SYSTEM_CALL_TIME_INFORMATION, *PSYSTEM_CALL_TIME_INFORMATION;
973 
974 // Class 11 - See RTL_PROCESS_MODULES
975 
976 // Class 12 - See RTL_PROCESS_LOCKS
977 
978 // Class 13 - See RTL_PROCESS_BACKTRACES
979 
980 // Class 14 - 15
981 typedef struct _SYSTEM_POOL_ENTRY
982 {
983     BOOLEAN Allocated;
984     BOOLEAN Spare0;
985     USHORT AllocatorBackTraceIndex;
986     ULONG Size;
987     union
988     {
989         UCHAR Tag[4];
990         ULONG TagUlong;
991         PVOID ProcessChargedQuota;
992     };
993 } SYSTEM_POOL_ENTRY, *PSYSTEM_POOL_ENTRY;
994 
995 typedef struct _SYSTEM_POOL_INFORMATION
996 {
997     SIZE_T TotalSize;
998     PVOID FirstEntry;
999     USHORT EntryOverhead;
1000     BOOLEAN PoolTagPresent;
1001     BOOLEAN Spare0;
1002     ULONG NumberOfEntries;
1003     SYSTEM_POOL_ENTRY Entries[1];
1004 } SYSTEM_POOL_INFORMATION, *PSYSTEM_POOL_INFORMATION;
1005 
1006 // Class 16
1007 typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO
1008 {
1009     USHORT UniqueProcessId;
1010     USHORT CreatorBackTraceIndex;
1011     UCHAR ObjectTypeIndex;
1012     UCHAR HandleAttributes;
1013     USHORT HandleValue;
1014     PVOID Object;
1015     ULONG GrantedAccess;
1016 } SYSTEM_HANDLE_TABLE_ENTRY_INFO, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO;
1017 
1018 typedef struct _SYSTEM_HANDLE_INFORMATION
1019 {
1020     ULONG NumberOfHandles;
1021     SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[1];
1022 } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
1023 
1024 // Class 17
1025 typedef struct _SYSTEM_OBJECTTYPE_INFORMATION
1026 {
1027     ULONG NextEntryOffset;
1028     ULONG NumberOfObjects;
1029     ULONG NumberOfHandles;
1030     ULONG TypeIndex;
1031     ULONG InvalidAttributes;
1032     GENERIC_MAPPING GenericMapping;
1033     ULONG ValidAccessMask;
1034     ULONG PoolType;
1035     BOOLEAN SecurityRequired;
1036     BOOLEAN WaitableObject;
1037     UNICODE_STRING TypeName;
1038 } SYSTEM_OBJECTTYPE_INFORMATION, *PSYSTEM_OBJECTTYPE_INFORMATION;
1039 
1040 typedef struct _SYSTEM_OBJECT_INFORMATION
1041 {
1042     ULONG NextEntryOffset;
1043     PVOID Object;
1044     HANDLE CreatorUniqueProcess;
1045     USHORT CreatorBackTraceIndex;
1046     USHORT Flags;
1047     LONG PointerCount;
1048     LONG HandleCount;
1049     ULONG PagedPoolCharge;
1050     ULONG NonPagedPoolCharge;
1051     HANDLE ExclusiveProcessId;
1052     PVOID SecurityDescriptor;
1053     OBJECT_NAME_INFORMATION NameInfo;
1054 } SYSTEM_OBJECT_INFORMATION, *PSYSTEM_OBJECT_INFORMATION;
1055 
1056 // Class 18
1057 typedef struct _SYSTEM_PAGEFILE_INFORMATION
1058 {
1059     ULONG NextEntryOffset;
1060     ULONG TotalSize;
1061     ULONG TotalInUse;
1062     ULONG PeakUsage;
1063     UNICODE_STRING PageFileName;
1064 } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
1065 
1066 // Class 19
1067 typedef struct _SYSTEM_VDM_INSTEMUL_INFO
1068 {
1069     ULONG SegmentNotPresent;
1070     ULONG VdmOpcode0F;
1071     ULONG OpcodeESPrefix;
1072     ULONG OpcodeCSPrefix;
1073     ULONG OpcodeSSPrefix;
1074     ULONG OpcodeDSPrefix;
1075     ULONG OpcodeFSPrefix;
1076     ULONG OpcodeGSPrefix;
1077     ULONG OpcodeOPER32Prefix;
1078     ULONG OpcodeADDR32Prefix;
1079     ULONG OpcodeINSB;
1080     ULONG OpcodeINSW;
1081     ULONG OpcodeOUTSB;
1082     ULONG OpcodeOUTSW;
1083     ULONG OpcodePUSHF;
1084     ULONG OpcodePOPF;
1085     ULONG OpcodeINTnn;
1086     ULONG OpcodeINTO;
1087     ULONG OpcodeIRET;
1088     ULONG OpcodeINBimm;
1089     ULONG OpcodeINWimm;
1090     ULONG OpcodeOUTBimm;
1091     ULONG OpcodeOUTWimm ;
1092     ULONG OpcodeINB;
1093     ULONG OpcodeINW;
1094     ULONG OpcodeOUTB;
1095     ULONG OpcodeOUTW;
1096     ULONG OpcodeLOCKPrefix;
1097     ULONG OpcodeREPNEPrefix;
1098     ULONG OpcodeREPPrefix;
1099     ULONG OpcodeHLT;
1100     ULONG OpcodeCLI;
1101     ULONG OpcodeSTI;
1102     ULONG BopCount;
1103 } SYSTEM_VDM_INSTEMUL_INFO, *PSYSTEM_VDM_INSTEMUL_INFO;
1104 
1105 // Class 20 - ULONG VDMBOPINFO
1106 
1107 // Class 21
1108 typedef struct _SYSTEM_FILECACHE_INFORMATION
1109 {
1110     SIZE_T CurrentSize;
1111     SIZE_T PeakSize;
1112     ULONG PageFaultCount;
1113     SIZE_T MinimumWorkingSet;
1114     SIZE_T MaximumWorkingSet;
1115     SIZE_T CurrentSizeIncludingTransitionInPages;
1116     SIZE_T PeakSizeIncludingTransitionInPages;
1117     ULONG TransitionRePurposeCount;
1118     ULONG Flags;
1119 } SYSTEM_FILECACHE_INFORMATION, *PSYSTEM_FILECACHE_INFORMATION;
1120 
1121 // Class 22
1122 typedef struct _SYSTEM_POOLTAG
1123 {
1124     union
1125     {
1126         UCHAR Tag[4];
1127         ULONG TagUlong;
1128     };
1129     ULONG PagedAllocs;
1130     ULONG PagedFrees;
1131     SIZE_T PagedUsed;
1132     ULONG NonPagedAllocs;
1133     ULONG NonPagedFrees;
1134     SIZE_T NonPagedUsed;
1135 } SYSTEM_POOLTAG, *PSYSTEM_POOLTAG;
1136 
1137 typedef struct _SYSTEM_POOLTAG_INFORMATION
1138 {
1139     ULONG Count;
1140     SYSTEM_POOLTAG TagInfo[1];
1141 } SYSTEM_POOLTAG_INFORMATION, *PSYSTEM_POOLTAG_INFORMATION;
1142 
1143 // Class 23
1144 typedef struct _SYSTEM_INTERRUPT_INFORMATION
1145 {
1146     ULONG ContextSwitches;
1147     ULONG DpcCount;
1148     ULONG DpcRate;
1149     ULONG TimeIncrement;
1150     ULONG DpcBypassCount;
1151     ULONG ApcBypassCount;
1152 } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
1153 
1154 // Class 24
1155 typedef struct _SYSTEM_DPC_BEHAVIOR_INFORMATION
1156 {
1157     ULONG Spare;
1158     ULONG DpcQueueDepth;
1159     ULONG MinimumDpcRate;
1160     ULONG AdjustDpcThreshold;
1161     ULONG IdealDpcRate;
1162 } SYSTEM_DPC_BEHAVIOR_INFORMATION, *PSYSTEM_DPC_BEHAVIOR_INFORMATION;
1163 
1164 // Class 25
1165 typedef struct _SYSTEM_MEMORY_INFO
1166 {
1167     PUCHAR StringOffset;
1168     USHORT ValidCount;
1169     USHORT TransitionCount;
1170     USHORT ModifiedCount;
1171     USHORT PageTableCount;
1172 } SYSTEM_MEMORY_INFO, *PSYSTEM_MEMORY_INFO;
1173 
1174 typedef struct _SYSTEM_MEMORY_INFORMATION
1175 {
1176     ULONG InfoSize;
1177     ULONG StringStart;
1178     SYSTEM_MEMORY_INFO Memory[1];
1179 } SYSTEM_MEMORY_INFORMATION, *PSYSTEM_MEMORY_INFORMATION;
1180 
1181 // Class 26
1182 typedef struct _SYSTEM_GDI_DRIVER_INFORMATION
1183 {
1184     UNICODE_STRING DriverName;
1185     PVOID ImageAddress;
1186     PVOID SectionPointer;
1187     PVOID EntryPoint;
1188     PIMAGE_EXPORT_DIRECTORY ExportSectionPointer;
1189     ULONG ImageLength;
1190 } SYSTEM_GDI_DRIVER_INFORMATION, *PSYSTEM_GDI_DRIVER_INFORMATION;
1191 
1192 // Class 27
1193 // Not an actually class, simply a PVOID to the ImageAddress
1194 
1195 // Class 28
1196 typedef struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION
1197 {
1198     ULONG TimeAdjustment;
1199     ULONG TimeIncrement;
1200     BOOLEAN Enable;
1201 } SYSTEM_QUERY_TIME_ADJUST_INFORMATION, *PSYSTEM_QUERY_TIME_ADJUST_INFORMATION;
1202 
1203 typedef struct _SYSTEM_SET_TIME_ADJUST_INFORMATION
1204 {
1205     ULONG TimeAdjustment;
1206     BOOLEAN Enable;
1207 } SYSTEM_SET_TIME_ADJUST_INFORMATION, *PSYSTEM_SET_TIME_ADJUST_INFORMATION;
1208 
1209 // Class 29 - Same as 25
1210 
1211 // FIXME: Class 30
1212 
1213 // Class 31
1214 typedef struct _SYSTEM_REF_TRACE_INFORMATION
1215 {
1216    UCHAR TraceEnable;
1217    UCHAR TracePermanent;
1218    UNICODE_STRING TraceProcessName;
1219    UNICODE_STRING TracePoolTags;
1220 } SYSTEM_REF_TRACE_INFORMATION, *PSYSTEM_REF_TRACE_INFORMATION;
1221 
1222 // Class 32 - OBSOLETE
1223 
1224 // Class 33
1225 typedef struct _SYSTEM_EXCEPTION_INFORMATION
1226 {
1227     ULONG AlignmentFixupCount;
1228     ULONG ExceptionDispatchCount;
1229     ULONG FloatingEmulationCount;
1230     ULONG ByteWordEmulationCount;
1231 } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
1232 
1233 // Class 34
1234 typedef struct _SYSTEM_CRASH_STATE_INFORMATION
1235 {
1236     ULONG ValidCrashDump;
1237 } SYSTEM_CRASH_STATE_INFORMATION, *PSYSTEM_CRASH_STATE_INFORMATION;
1238 
1239 // Class 35
1240 typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION
1241 {
1242     BOOLEAN KernelDebuggerEnabled;
1243     BOOLEAN KernelDebuggerNotPresent;
1244 } SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
1245 
1246 // Class 36
1247 typedef struct _SYSTEM_CONTEXT_SWITCH_INFORMATION
1248 {
1249     ULONG ContextSwitches;
1250     ULONG FindAny;
1251     ULONG FindLast;
1252     ULONG FindIdeal;
1253     ULONG IdleAny;
1254     ULONG IdleCurrent;
1255     ULONG IdleLast;
1256     ULONG IdleIdeal;
1257     ULONG PreemptAny;
1258     ULONG PreemptCurrent;
1259     ULONG PreemptLast;
1260     ULONG SwitchToIdle;
1261 } SYSTEM_CONTEXT_SWITCH_INFORMATION, *PSYSTEM_CONTEXT_SWITCH_INFORMATION;
1262 
1263 // Class 37
1264 typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION
1265 {
1266     ULONG RegistryQuotaAllowed;
1267     ULONG RegistryQuotaUsed;
1268     SIZE_T PagedPoolSize;
1269 } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
1270 
1271 // Class 38
1272 // Not a structure, simply send the UNICODE_STRING
1273 
1274 // Class 39
1275 // Not a structure, simply send a ULONG containing the new separation
1276 
1277 // Class 40
1278 typedef struct _SYSTEM_PLUGPLAY_BUS_INFORMATION
1279 {
1280     ULONG BusCount;
1281     PLUGPLAY_BUS_INSTANCE BusInstance[1];
1282 } SYSTEM_PLUGPLAY_BUS_INFORMATION, *PSYSTEM_PLUGPLAY_BUS_INFORMATION;
1283 
1284 // Class 41
1285 typedef struct _SYSTEM_DOCK_INFORMATION
1286 {
1287     SYSTEM_DOCK_STATE DockState;
1288     INTERFACE_TYPE DeviceBusType;
1289     ULONG DeviceBusNumber;
1290     ULONG SlotNumber;
1291 } SYSTEM_DOCK_INFORMATION, *PSYSTEM_DOCK_INFORMATION;
1292 
1293 // Class 42
1294 typedef struct _SYSTEM_POWER_INFORMATION_NATIVE
1295 {
1296     BOOLEAN SystemSuspendSupported;
1297     BOOLEAN SystemHibernateSupported;
1298     BOOLEAN ResumeTimerSupportsSuspend;
1299     BOOLEAN ResumeTimerSupportsHibernate;
1300     BOOLEAN LidSupported;
1301     BOOLEAN TurboSettingSupported;
1302     BOOLEAN TurboMode;
1303     BOOLEAN SystemAcOrDc;
1304     BOOLEAN PowerDownDisabled;
1305     LARGE_INTEGER SpindownDrives;
1306 } SYSTEM_POWER_INFORMATION_NATIVE, *PSYSTEM_POWER_INFORMATION_NATIVE;
1307 
1308 // Class 43
1309 typedef struct _SYSTEM_LEGACY_DRIVER_INFORMATION
1310 {
1311     PNP_VETO_TYPE VetoType;
1312     UNICODE_STRING VetoDriver;
1313 } SYSTEM_LEGACY_DRIVER_INFORMATION, *PSYSTEM_LEGACY_DRIVER_INFORMATION;
1314 
1315 // Class 44
1316 //typedef struct _TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION;
1317 
1318 // Class 45
1319 typedef struct _SYSTEM_LOOKASIDE_INFORMATION
1320 {
1321     USHORT CurrentDepth;
1322     USHORT MaximumDepth;
1323     ULONG TotalAllocates;
1324     ULONG AllocateMisses;
1325     ULONG TotalFrees;
1326     ULONG FreeMisses;
1327     ULONG Type;
1328     ULONG Tag;
1329     ULONG Size;
1330 } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
1331 
1332 // Class 46
1333 // Not a structure. Only a HANDLE for the SlipEvent;
1334 
1335 // Class 47
1336 // Not a structure. Only a ULONG for the SessionId;
1337 
1338 // Class 48
1339 // Not a structure. Only a ULONG for the SessionId;
1340 
1341 // FIXME: Class 49
1342 
1343 // Class 50
1344 // Not a structure. Only a ULONG_PTR for the SystemRangeStart
1345 
1346 // Class 51
1347 typedef struct _SYSTEM_VERIFIER_INFORMATION
1348 {
1349    ULONG NextEntryOffset;
1350    ULONG Level;
1351    UNICODE_STRING DriverName;
1352    ULONG RaiseIrqls;
1353    ULONG AcquireSpinLocks;
1354    ULONG SynchronizeExecutions;
1355    ULONG AllocationsAttempted;
1356    ULONG AllocationsSucceeded;
1357    ULONG AllocationsSucceededSpecialPool;
1358    ULONG AllocationsWithNoTag;
1359    ULONG TrimRequests;
1360    ULONG Trims;
1361    ULONG AllocationsFailed;
1362    ULONG AllocationsFailedDeliberately;
1363    ULONG Loads;
1364    ULONG Unloads;
1365    ULONG UnTrackedPool;
1366    ULONG CurrentPagedPoolAllocations;
1367    ULONG CurrentNonPagedPoolAllocations;
1368    ULONG PeakPagedPoolAllocations;
1369    ULONG PeakNonPagedPoolAllocations;
1370    SIZE_T PagedPoolUsageInBytes;
1371    SIZE_T NonPagedPoolUsageInBytes;
1372    SIZE_T PeakPagedPoolUsageInBytes;
1373    SIZE_T PeakNonPagedPoolUsageInBytes;
1374 } SYSTEM_VERIFIER_INFORMATION, *PSYSTEM_VERIFIER_INFORMATION;
1375 
1376 // FIXME: Class 52
1377 
1378 // Class 53
1379 typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION
1380 {
1381     ULONG SessionId;
1382     ULONG SizeOfBuf;
1383     PVOID Buffer; // Same format as in SystemProcessInformation
1384 } SYSTEM_SESSION_PROCESS_INFORMATION, *PSYSTEM_SESSION_PROCESS_INFORMATION;
1385 
1386 // FIXME: Class 54
1387 
1388 // Class 55
1389 #define MAXIMUM_NUMA_NODES 16
1390 typedef struct _SYSTEM_NUMA_INFORMATION
1391 {
1392     ULONG HighestNodeNumber;
1393     ULONG Reserved;
1394     union
1395     {
1396         ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES];
1397         ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES];
1398     };
1399 } SYSTEM_NUMA_INFORMATION, *PSYSTEM_NUMA_INFORMATION;
1400 
1401 // FIXME: Class 56-63
1402 
1403 // Class 64
1404 typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
1405 {
1406     PVOID Object;
1407     ULONG_PTR UniqueProcessId;
1408     ULONG_PTR HandleValue;
1409     ULONG GrantedAccess;
1410     USHORT CreatorBackTraceIndex;
1411     USHORT ObjectTypeIndex;
1412     ULONG HandleAttributes;
1413     ULONG Reserved;
1414 } SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO_EX;
1415 
1416 typedef struct _SYSTEM_HANDLE_INFORMATION_EX
1417 {
1418     ULONG_PTR Count;
1419     ULONG_PTR Reserved;
1420     SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handle[1];
1421 } SYSTEM_HANDLE_INFORMATION_EX, *PSYSTEM_HANDLE_INFORMATION_EX;
1422 
1423 // FIXME: Class 65-97
1424 
1425 //
1426 // Hotpatch flags
1427 //
1428 #define RTL_HOTPATCH_SUPPORTED_FLAG         0x01
1429 #define RTL_HOTPATCH_SWAP_OBJECT_NAMES      0x08 << 24
1430 #define RTL_HOTPATCH_SYNC_RENAME_FILES      0x10 << 24
1431 #define RTL_HOTPATCH_PATCH_USER_MODE        0x20 << 24
1432 #define RTL_HOTPATCH_REMAP_SYSTEM_DLL       0x40 << 24
1433 #define RTL_HOTPATCH_PATCH_KERNEL_MODE      0x80 << 24
1434 
1435 
1436 // Class 69
1437 typedef struct _SYSTEM_HOTPATCH_CODE_INFORMATION
1438 {
1439     ULONG Flags;
1440     ULONG InfoSize;
1441     union
1442     {
1443         struct
1444         {
1445             ULONG Foo;
1446         } CodeInfo;
1447         struct
1448         {
1449             USHORT NameOffset;
1450             USHORT NameLength;
1451         } KernelInfo;
1452         struct
1453         {
1454             USHORT NameOffset;
1455             USHORT NameLength;
1456             USHORT TargetNameOffset;
1457             USHORT TargetNameLength;
1458             UCHAR PatchingFinished;
1459         } UserModeInfo;
1460         struct
1461         {
1462             USHORT NameOffset;
1463             USHORT NameLength;
1464             USHORT TargetNameOffset;
1465             USHORT TargetNameLength;
1466             UCHAR PatchingFinished;
1467             NTSTATUS ReturnCode;
1468             HANDLE TargetProcess;
1469         } InjectionInfo;
1470         struct
1471         {
1472             HANDLE FileHandle1;
1473             PIO_STATUS_BLOCK IoStatusBlock1;
1474             PVOID RenameInformation1;
1475             PVOID RenameInformationLength1;
1476             HANDLE FileHandle2;
1477             PIO_STATUS_BLOCK IoStatusBlock2;
1478             PVOID RenameInformation2;
1479             PVOID RenameInformationLength2;
1480         } RenameInfo;
1481         struct
1482         {
1483             HANDLE ParentDirectory;
1484             HANDLE ObjectHandle1;
1485             HANDLE ObjectHandle2;
1486         } AtomicSwap;
1487     };
1488 } SYSTEM_HOTPATCH_CODE_INFORMATION, *PSYSTEM_HOTPATCH_CODE_INFORMATION;
1489 
1490 //
1491 // Class 75
1492 //
1493 #ifdef NTOS_MODE_USER
1494 typedef struct _SYSTEM_FIRMWARE_TABLE_HANDLER
1495 {
1496     ULONG ProviderSignature;
1497     BOOLEAN Register;
1498     PFNFTH FirmwareTableHandler;
1499     PVOID DriverObject;
1500 } SYSTEM_FIRMWARE_TABLE_HANDLER, *PSYSTEM_FIRMWARE_TABLE_HANDLER;
1501 
1502 //
1503 // Class 76
1504 //
1505 typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION
1506 {
1507     ULONG ProviderSignature;
1508     SYSTEM_FIRMWARE_TABLE_ACTION Action;
1509     ULONG TableID;
1510     ULONG TableBufferLength;
1511     UCHAR TableBuffer[1];
1512 } SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION;
1513 
1514 //
1515 // Class 81
1516 //
1517 typedef struct _SYSTEM_MEMORY_LIST_INFORMATION
1518 {
1519    SIZE_T ZeroPageCount;
1520    SIZE_T FreePageCount;
1521    SIZE_T ModifiedPageCount;
1522    SIZE_T ModifiedNoWritePageCount;
1523    SIZE_T BadPageCount;
1524    SIZE_T PageCountByPriority[8];
1525    SIZE_T RepurposedPagesByPriority[8];
1526    SIZE_T ModifiedPageCountPageFile;
1527 } SYSTEM_MEMORY_LIST_INFORMATION, *PSYSTEM_MEMORY_LIST_INFORMATION;
1528 
1529 #endif // !NTOS_MODE_USER
1530 
1531 #ifdef __cplusplus
1532 }; // extern "C"
1533 #endif
1534 
1535 #endif // !_EXTYPES_H
1536