ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ketypes.h
Go to the documentation of this file.
00001 /*++ NDK Version: 0098
00002 
00003 Copyright (c) Alex Ionescu.  All rights reserved.
00004 
00005 Header Name:
00006 
00007     lpctypes.h
00008 
00009 Abstract:
00010 
00011     Type definitions for the Loader.
00012 
00013 Author:
00014 
00015     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
00016 
00017 --*/
00018 
00019 #ifndef _KETYPES_H
00020 #define _KETYPES_H
00021 
00022 //
00023 // Dependencies
00024 //
00025 #include <umtypes.h>
00026 #ifndef NTOS_MODE_USER
00027 #include <haltypes.h>
00028 #include <potypes.h>
00029 #include <ifssupp.h>
00030 #endif
00031 
00032 //
00033 // Context Record Flags
00034 //
00035 #define CONTEXT_DEBUGGER                (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
00036 
00037 //
00038 // Maximum System Descriptor Table Entries
00039 //
00040 #define SSDT_MAX_ENTRIES                2
00041 
00042 //
00043 // Processor Architectures
00044 //
00045 #define PROCESSOR_ARCHITECTURE_INTEL    0
00046 #define PROCESSOR_ARCHITECTURE_MIPS     1
00047 #define PROCESSOR_ARCHITECTURE_ALPHA    2
00048 #define PROCESSOR_ARCHITECTURE_PPC      3
00049 #define PROCESSOR_ARCHITECTURE_SHX      4
00050 #define PROCESSOR_ARCHITECTURE_ARM      5
00051 #define PROCESSOR_ARCHITECTURE_IA64     6
00052 #define PROCESSOR_ARCHITECTURE_ALPHA64  7
00053 #define PROCESSOR_ARCHITECTURE_MSIL     8
00054 #define PROCESSOR_ARCHITECTURE_AMD64    9
00055 #define PROCESSOR_ARCHITECTURE_UNKNOWN  0xFFFF
00056 
00057 //
00058 // Object Type Mask for Kernel Dispatcher Objects
00059 //
00060 #define KOBJECT_TYPE_MASK               0x7F
00061 #define KOBJECT_LOCK_BIT                0x80
00062 
00063 //
00064 // Dispatcher Priority increments
00065 //
00066 #define THREAD_ALERT_INCREMENT          2
00067 
00068 //
00069 // Physical memory offset of KUSER_SHARED_DATA
00070 //
00071 #define KI_USER_SHARED_DATA_PHYSICAL    0x41000
00072 
00073 //
00074 // Quantum values and decrements
00075 //
00076 #define MAX_QUANTUM                     0x7F
00077 #define WAIT_QUANTUM_DECREMENT          1
00078 #define CLOCK_QUANTUM_DECREMENT         3
00079 
00080 //
00081 // Kernel Feature Bits
00082 //
00083 #define KF_V86_VIS                      0x00000001
00084 #define KF_RDTSC                        0x00000002
00085 #define KF_CR4                          0x00000004
00086 #define KF_CMOV                         0x00000008
00087 #define KF_GLOBAL_PAGE                  0x00000010
00088 #define KF_LARGE_PAGE                   0x00000020
00089 #define KF_MTRR                         0x00000040
00090 #define KF_CMPXCHG8B                    0x00000080
00091 #define KF_MMX                          0x00000100
00092 #define KF_WORKING_PTE                  0x00000200
00093 #define KF_PAT                          0x00000400
00094 #define KF_FXSR                         0x00000800
00095 #define KF_FAST_SYSCALL                 0x00001000
00096 #define KF_XMMI                         0x00002000
00097 #define KF_3DNOW                        0x00004000
00098 #define KF_AMDK6MTRR                    0x00008000
00099 #define KF_XMMI64                       0x00010000
00100 #define KF_DTS                          0x00020000
00101 #define KF_NX_BIT                       0x20000000
00102 #define KF_NX_DISABLED                  0x40000000
00103 #define KF_NX_ENABLED                   0x80000000
00104 
00105 //
00106 // Internal Exception Codes
00107 //
00108 #define KI_EXCEPTION_INTERNAL           0x10000000
00109 #define KI_EXCEPTION_ACCESS_VIOLATION   (KI_EXCEPTION_INTERNAL | 0x04)
00110 
00111 #ifndef NTOS_MODE_USER
00112 //
00113 // Number of dispatch codes supported by KINTERRUPT
00114 //
00115 #ifdef _M_AMD64
00116 #define DISPATCH_LENGTH                 4
00117 #elif (NTDDI_VERSION >= NTDDI_LONGHORN)
00118 #define DISPATCH_LENGTH                 135
00119 #else
00120 #define DISPATCH_LENGTH                 106
00121 #endif
00122 
00123 #else
00124 
00125 //
00126 // KPROCESSOR_MODE Type
00127 //
00128 typedef CCHAR KPROCESSOR_MODE;
00129 
00130 //
00131 // Dereferencable pointer to KUSER_SHARED_DATA in User-Mode
00132 //
00133 #define SharedUserData                  ((KUSER_SHARED_DATA *)USER_SHARED_DATA)
00134 
00135 //
00136 // Maximum WOW64 Entries in KUSER_SHARED_DATA
00137 //
00138 #define MAX_WOW64_SHARED_ENTRIES        16
00139 
00140 //
00141 // Maximum Processor Features supported in KUSER_SHARED_DATA
00142 //
00143 #define PROCESSOR_FEATURE_MAX           64
00144 
00145 //
00146 // Event Types
00147 //
00148 typedef enum _EVENT_TYPE
00149 {
00150     NotificationEvent,
00151     SynchronizationEvent
00152 } EVENT_TYPE;
00153 
00154 //
00155 // Timer Types
00156 //
00157 typedef enum _TIMER_TYPE
00158 {
00159     NotificationTimer,
00160     SynchronizationTimer
00161 } TIMER_TYPE;
00162 
00163 //
00164 // Wait Types
00165 //
00166 typedef enum _WAIT_TYPE
00167 {
00168     WaitAll,
00169     WaitAny
00170 } WAIT_TYPE;
00171 
00172 //
00173 // Processor Execution Modes
00174 //
00175 typedef enum _MODE
00176 {
00177     KernelMode,
00178     UserMode,
00179     MaximumMode
00180 } MODE;
00181 
00182 //
00183 // Wait Reasons
00184 //
00185 typedef enum _KWAIT_REASON
00186 {
00187     Executive,
00188     FreePage,
00189     PageIn,
00190     PoolAllocation,
00191     DelayExecution,
00192     Suspended,
00193     UserRequest,
00194     WrExecutive,
00195     WrFreePage,
00196     WrPageIn,
00197     WrPoolAllocation,
00198     WrDelayExecution,
00199     WrSuspended,
00200     WrUserRequest,
00201     WrEventPair,
00202     WrQueue,
00203     WrLpcReceive,
00204     WrLpcReply,
00205     WrVirtualMemory,
00206     WrPageOut,
00207     WrRendezvous,
00208     Spare2,
00209     WrGuardedMutex,
00210     Spare4,
00211     Spare5,
00212     Spare6,
00213     WrKernel,
00214     WrResource,
00215     WrPushLock,
00216     WrMutex,
00217     WrQuantumEnd,
00218     WrDispatchInt,
00219     WrPreempted,
00220     WrYieldExecution,
00221     MaximumWaitReason
00222 } KWAIT_REASON;
00223 
00224 //
00225 // Profiling Sources
00226 //
00227 typedef enum _KPROFILE_SOURCE
00228 {
00229     ProfileTime,
00230     ProfileAlignmentFixup,
00231     ProfileTotalIssues,
00232     ProfilePipelineDry,
00233     ProfileLoadInstructions,
00234     ProfilePipelineFrozen,
00235     ProfileBranchInstructions,
00236     ProfileTotalNonissues,
00237     ProfileDcacheMisses,
00238     ProfileIcacheMisses,
00239     ProfileCacheMisses,
00240     ProfileBranchMispredictions,
00241     ProfileStoreInstructions,
00242     ProfileFpInstructions,
00243     ProfileIntegerInstructions,
00244     Profile2Issue,
00245     Profile3Issue,
00246     Profile4Issue,
00247     ProfileSpecialInstructions,
00248     ProfileTotalCycles,
00249     ProfileIcacheIssues,
00250     ProfileDcacheAccesses,
00251     ProfileMemoryBarrierCycles,
00252     ProfileLoadLinkedIssues,
00253     ProfileMaximum
00254 } KPROFILE_SOURCE;
00255 
00256 //
00257 // NT Product and Architecture Types
00258 //
00259 typedef enum _NT_PRODUCT_TYPE
00260 {
00261     NtProductWinNt = 1,
00262     NtProductLanManNt,
00263     NtProductServer
00264 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
00265 
00266 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
00267 {
00268     StandardDesign,
00269     NEC98x86,
00270     EndAlternatives
00271 } ALTERNATIVE_ARCHITECTURE_TYPE;
00272 
00273 #endif
00274 
00275 //
00276 // Thread States
00277 //
00278 typedef enum _KTHREAD_STATE
00279 {
00280     Initialized,
00281     Ready,
00282     Running,
00283     Standby,
00284     Terminated,
00285     Waiting,
00286     Transition,
00287     DeferredReady,
00288 #if (NTDDI_VERSION >= NTDDI_WS03)
00289     GateWait
00290 #endif
00291 } KTHREAD_STATE, *PKTHREAD_STATE;
00292 
00293 //
00294 // Kernel Object Types
00295 //
00296 typedef enum _KOBJECTS
00297 {
00298     EventNotificationObject = 0,
00299     EventSynchronizationObject = 1,
00300     MutantObject = 2,
00301     ProcessObject = 3,
00302     QueueObject = 4,
00303     SemaphoreObject = 5,
00304     ThreadObject = 6,
00305     GateObject = 7,
00306     TimerNotificationObject = 8,
00307     TimerSynchronizationObject = 9,
00308     Spare2Object = 10,
00309     Spare3Object = 11,
00310     Spare4Object = 12,
00311     Spare5Object = 13,
00312     Spare6Object = 14,
00313     Spare7Object = 15,
00314     Spare8Object = 16,
00315     Spare9Object = 17,
00316     ApcObject = 18,
00317     DpcObject = 19,
00318     DeviceQueueObject = 20,
00319     EventPairObject = 21,
00320     InterruptObject = 22,
00321     ProfileObject = 23,
00322     ThreadedDpcObject = 24,
00323     MaximumKernelObject = 25
00324 } KOBJECTS;
00325 
00326 //
00327 // Adjust reasons
00328 //
00329 typedef enum _ADJUST_REASON
00330 {
00331     AdjustNone = 0,
00332     AdjustUnwait = 1,
00333     AdjustBoost = 2
00334 } ADJUST_REASON;
00335 
00336 //
00337 // Continue Status
00338 //
00339 typedef enum _KCONTINUE_STATUS
00340 {
00341     ContinueError = 0,
00342     ContinueSuccess,
00343     ContinueProcessorReselected,
00344     ContinueNextProcessor
00345 } KCONTINUE_STATUS;
00346 
00347 //
00348 // Process States
00349 //
00350 typedef enum _KPROCESS_STATE
00351 {
00352     ProcessInMemory,
00353     ProcessOutOfMemory,
00354     ProcessInTransition,
00355     ProcessInSwap,
00356     ProcessOutSwap,
00357 } KPROCESS_STATE, *PKPROCESS_STATE;
00358 
00359 //
00360 // NtVdmControl Classes
00361 //
00362 typedef enum _VDMSERVICECLASS
00363 {
00364    VdmStartExecution = 0,
00365    VdmQueueInterrupt = 1,
00366    VdmDelayInterrupt = 2,
00367    VdmInitialize = 3,
00368    VdmFeatures = 4,
00369    VdmSetInt21Handler = 5,
00370    VdmQueryDir = 6,
00371    VdmPrinterDirectIoOpen = 7,
00372    VdmPrinterDirectIoClose = 8,
00373    VdmPrinterInitialize = 9,
00374    VdmSetLdtEntries = 10,
00375    VdmSetProcessLdtInfo = 11,
00376    VdmAdlibEmulation = 12,
00377    VdmPMCliControl = 13,
00378    VdmQueryVdmProcess = 14,
00379 } VDMSERVICECLASS;
00380 
00381 #ifdef NTOS_MODE_USER
00382 
00383 //
00384 // APC Normal Routine
00385 //
00386 typedef VOID
00387 (NTAPI *PKNORMAL_ROUTINE)(
00388     IN PVOID NormalContext,
00389     IN PVOID SystemArgument1,
00390     IN PVOID SystemArgument2
00391 );
00392 
00393 //
00394 // Timer Routine
00395 //
00396 typedef VOID
00397 (NTAPI *PTIMER_APC_ROUTINE)(
00398     IN PVOID TimerContext,
00399     IN ULONG TimerLowValue,
00400     IN LONG TimerHighValue
00401 );
00402 
00403 //
00404 // System Time Structure
00405 //
00406 typedef struct _KSYSTEM_TIME
00407 {
00408     ULONG LowPart;
00409     LONG High1Time;
00410     LONG High2Time;
00411 } KSYSTEM_TIME, *PKSYSTEM_TIME;
00412 
00413 //
00414 // Shared Kernel User Data
00415 //
00416 typedef struct _KUSER_SHARED_DATA
00417 {
00418     ULONG TickCountLowDeprecated;
00419     ULONG TickCountMultiplier;
00420     volatile KSYSTEM_TIME InterruptTime;
00421     volatile KSYSTEM_TIME SystemTime;
00422     volatile KSYSTEM_TIME TimeZoneBias;
00423     USHORT ImageNumberLow;
00424     USHORT ImageNumberHigh;
00425     WCHAR NtSystemRoot[260];
00426     ULONG MaxStackTraceDepth;
00427     ULONG CryptoExponent;
00428     ULONG TimeZoneId;
00429     ULONG LargePageMinimum;
00430     ULONG Reserved2[7];
00431     NT_PRODUCT_TYPE NtProductType;
00432     BOOLEAN ProductTypeIsValid;
00433     ULONG NtMajorVersion;
00434     ULONG NtMinorVersion;
00435     BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
00436     ULONG Reserved1;
00437     ULONG Reserved3;
00438     volatile ULONG TimeSlip;
00439     ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
00440     LARGE_INTEGER SystemExpirationDate;
00441     ULONG SuiteMask;
00442     BOOLEAN KdDebuggerEnabled;
00443 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
00444     UCHAR NXSupportPolicy;
00445 #endif
00446     volatile ULONG ActiveConsoleId;
00447     volatile ULONG DismountCount;
00448     ULONG ComPlusPackage;
00449     ULONG LastSystemRITEventTickCount;
00450     ULONG NumberOfPhysicalPages;
00451     BOOLEAN SafeBootMode;
00452     ULONG TraceLogging;
00453     ULONG Fill0;
00454     ULONGLONG TestRetInstruction;
00455     ULONG SystemCall;
00456     ULONG SystemCallReturn;
00457     ULONGLONG SystemCallPad[3];
00458     union {
00459         volatile KSYSTEM_TIME TickCount;
00460         volatile ULONG64 TickCountQuad;
00461     };
00462     ULONG Cookie;
00463 #if (NTDDI_VERSION >= NTDDI_WS03)
00464     LONGLONG ConsoleSessionForegroundProcessId;
00465     ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
00466 #endif
00467 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
00468     USHORT UserModeGlobalLogger[8];
00469     ULONG HeapTracingPid[2];
00470     ULONG CritSecTracingPid[2];
00471     union
00472     {
00473         ULONG SharedDataFlags;
00474         struct
00475         {
00476             ULONG DbgErrorPortPresent:1;
00477             ULONG DbgElevationEnabled:1;
00478             ULONG DbgVirtEnabled:1;
00479             ULONG DbgInstallerDetectEnabled:1;
00480             ULONG SpareBits:28;
00481         };
00482     };
00483     ULONG ImageFileExecutionOptions;
00484     KAFFINITY ActiveProcessorAffinity;
00485 #endif
00486 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
00487 
00488 //
00489 // VDM Structures
00490 //
00491 #include "pshpack1.h"
00492 typedef struct _VdmVirtualIca
00493 {
00494     LONG ica_count[8];
00495     LONG ica_int_line;
00496     LONG ica_cpu_int;
00497     USHORT ica_base;
00498     USHORT ica_hipiri;
00499     USHORT ica_mode;
00500     UCHAR ica_master;
00501     UCHAR ica_irr;
00502     UCHAR ica_isr;
00503     UCHAR ica_imr;
00504     UCHAR ica_ssr;
00505 } VDMVIRTUALICA, *PVDMVIRTUALICA;
00506 #include "poppack.h"
00507 
00508 typedef struct _VdmIcaUserData
00509 {
00510     PVOID pIcaLock;
00511     PVDMVIRTUALICA pIcaMaster;
00512     PVDMVIRTUALICA pIcaSlave;
00513     PULONG pDelayIrq;
00514     PULONG pUndelayIrq;
00515     PULONG pDelayIret;
00516     PULONG pIretHooked;
00517     PULONG pAddrIretBopTable;
00518     PHANDLE phWowIdleEvent;
00519     PLARGE_INTEGER pIcaTimeout;
00520     PHANDLE phMainThreadSuspended;
00521 } VDMICAUSERDATA, *PVDMICAUSERDATA;
00522 
00523 typedef struct _VDM_INITIALIZE_DATA
00524 {
00525     PVOID TrapcHandler;
00526     PVDMICAUSERDATA IcaUserData;
00527 } VDM_INITIALIZE_DATA, *PVDM_INITIALIZE_DATA;
00528 
00529 #else
00530 
00531 //
00532 // System Thread Start Routine
00533 //
00534 typedef
00535 VOID
00536 (NTAPI *PKSYSTEM_ROUTINE)(
00537     PKSTART_ROUTINE StartRoutine,
00538     PVOID StartContext
00539 );
00540 
00541 //
00542 // APC Environment Types
00543 //
00544 typedef enum _KAPC_ENVIRONMENT
00545 {
00546     OriginalApcEnvironment,
00547     AttachedApcEnvironment,
00548     CurrentApcEnvironment,
00549     InsertApcEnvironment
00550 } KAPC_ENVIRONMENT;
00551 
00552 //
00553 // PRCB DPC Data
00554 //
00555 typedef struct _KDPC_DATA
00556 {
00557     LIST_ENTRY DpcListHead;
00558     ULONG_PTR DpcLock;
00559 #ifdef _M_AMD64
00560     volatile LONG DpcQueueDepth;
00561 #else
00562     volatile ULONG DpcQueueDepth;
00563 #endif
00564     ULONG DpcCount;
00565 } KDPC_DATA, *PKDPC_DATA;
00566 
00567 //
00568 // Per-Processor Lookaside List
00569 //
00570 typedef struct _PP_LOOKASIDE_LIST
00571 {
00572     struct _GENERAL_LOOKASIDE *P;
00573     struct _GENERAL_LOOKASIDE *L;
00574 } PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
00575 
00576 //
00577 // Architectural Types
00578 //
00579 #include <arch/ketypes.h>
00580 
00581 //
00582 // Kernel Memory Node
00583 //
00584 #include <pshpack1.h>
00585 typedef struct _KNODE
00586 {
00587     SLIST_HEADER DeadStackList;
00588     SLIST_HEADER PfnDereferenceSListHead;
00589     KAFFINITY ProcessorMask;
00590     ULONG Color;
00591     UCHAR Seed;
00592     UCHAR NodeNumber;
00593     ULONG Flags;
00594     ULONG MmShiftedColor;
00595     ULONG FreeCount[2];
00596     struct _SINGLE_LIST_ENTRY *PfnDeferredList;
00597 } KNODE, *PKNODE;
00598 #include <poppack.h>
00599 
00600 //
00601 // Kernel Profile Object
00602 //
00603 typedef struct _KPROFILE
00604 {
00605     CSHORT Type;
00606     CSHORT Size;
00607     LIST_ENTRY ProfileListEntry;
00608     struct _KPROCESS *Process;
00609     PVOID RangeBase;
00610     PVOID RangeLimit;
00611     ULONG BucketShift;
00612     PVOID Buffer;
00613     ULONG_PTR Segment;
00614     KAFFINITY Affinity;
00615     KPROFILE_SOURCE Source;
00616     BOOLEAN Started;
00617 } KPROFILE, *PKPROFILE;
00618 
00619 //
00620 // Kernel Interrupt Object
00621 //
00622 typedef struct _KINTERRUPT
00623 {
00624     CSHORT Type;
00625     CSHORT Size;
00626     LIST_ENTRY InterruptListEntry;
00627     PKSERVICE_ROUTINE ServiceRoutine;
00628 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
00629     PKSERVICE_ROUTINE MessageServiceRoutine;
00630     ULONG MessageIndex;
00631 #endif
00632     PVOID ServiceContext;
00633     KSPIN_LOCK SpinLock;
00634     ULONG TickCount;
00635     PKSPIN_LOCK ActualLock;
00636     PKINTERRUPT_ROUTINE DispatchAddress;
00637     ULONG Vector;
00638     KIRQL Irql;
00639     KIRQL SynchronizeIrql;
00640     BOOLEAN FloatingSave;
00641     BOOLEAN Connected;
00642     CCHAR Number;
00643     BOOLEAN ShareVector;
00644     KINTERRUPT_MODE Mode;
00645 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
00646     KINTERRUPT_POLARITY Polarity;
00647 #endif
00648     ULONG ServiceCount;
00649     ULONG DispatchCount;
00650 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
00651     ULONGLONG Rsvd1;
00652 #endif
00653 #ifdef _M_AMD64
00654     PKTRAP_FRAME TrapFrame;
00655     PVOID Reserved;
00656 #endif
00657     ULONG DispatchCode[DISPATCH_LENGTH];
00658 } KINTERRUPT;
00659 
00660 //
00661 // Kernel Event Pair Object
00662 //
00663 typedef struct _KEVENT_PAIR
00664 {
00665     CSHORT Type;
00666     CSHORT Size;
00667     KEVENT LowEvent;
00668     KEVENT HighEvent;
00669 } KEVENT_PAIR, *PKEVENT_PAIR;
00670 
00671 //
00672 // Kernel No Execute Options
00673 //
00674 typedef struct _KEXECUTE_OPTIONS
00675 {
00676     UCHAR ExecuteDisable:1;
00677     UCHAR ExecuteEnable:1;
00678     UCHAR DisableThunkEmulation:1;
00679     UCHAR Permanent:1;
00680     UCHAR ExecuteDispatchEnable:1;
00681     UCHAR ImageDispatchEnable:1;
00682     UCHAR Spare:2;
00683 } KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
00684 
00685 #if (NTDDI_VERSION >= NTDDI_WIN7)
00686 typedef union _KWAIT_STATUS_REGISTER
00687 {
00688     UCHAR Flags;
00689     struct
00690     {
00691         UCHAR State:2;
00692         UCHAR Affinity:1;
00693         UCHAR Priority:1;
00694         UCHAR Apc:1;
00695         UCHAR UserApc:1;
00696         UCHAR Alert:1;
00697         UCHAR Unused:1;
00698     };
00699 } KWAIT_STATUS_REGISTER, *PKWAIT_STATUS_REGISTER;
00700 
00701 typedef struct _COUNTER_READING
00702 {
00703     enum _HARDWARE_COUNTER_TYPE Type;
00704     ULONG Index;
00705     ULONG64 Start;
00706     ULONG64 Total;
00707 }COUNTER_READING, *PCOUNTER_READING;
00708 
00709 typedef struct _KTHREAD_COUNTERS
00710 {
00711     ULONG64 WaitReasonBitMap;
00712     struct _THREAD_PERFORMANCE_DATA* UserData;
00713     ULONG Flags;
00714     ULONG ContextSwitches;
00715     ULONG64 CycleTimeBias;
00716     ULONG64 HardwareCounters;
00717     COUNTER_READING HwCounter[16];
00718 }KTHREAD_COUNTERS, *PKTHREAD_COUNTERS;
00719 #endif
00720 
00721 //
00722 // Kernel Thread (KTHREAD)
00723 //
00724 typedef struct _KTHREAD
00725 {
00726     DISPATCHER_HEADER Header;
00727 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00728     ULONGLONG CycleTime;
00729 #ifndef _WIN64 // [
00730     ULONG HighCycleTime;
00731 #endif // ]
00732     ULONGLONG QuantumTarget;
00733 #else // ][
00734     LIST_ENTRY MutantListHead;
00735 #endif // ]
00736     PVOID InitialStack;
00737     ULONG_PTR StackLimit; // FIXME: PVOID
00738     PVOID KernelStack;
00739     KSPIN_LOCK ThreadLock;
00740 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00741     KWAIT_STATUS_REGISTER WaitRegister;
00742     BOOLEAN Running;
00743     BOOLEAN Alerted[2];
00744     union
00745     {
00746         struct
00747         {
00748             ULONG KernelStackResident:1;
00749             ULONG ReadyTransition:1;
00750             ULONG ProcessReadyQueue:1;
00751             ULONG WaitNext:1;
00752             ULONG SystemAffinityActive:1;
00753             ULONG Alertable:1;
00754             ULONG GdiFlushActive:1;
00755             ULONG UserStackWalkActive:1;
00756             ULONG ApcInterruptRequest:1;
00757             ULONG ForceDeferSchedule:1;
00758             ULONG QuantumEndMigrate:1;
00759             ULONG UmsDirectedSwitchEnable:1;
00760             ULONG TimerActive:1;
00761             ULONG Reserved:19;
00762         };
00763         LONG MiscFlags;
00764     };
00765 #endif // ]
00766     union
00767     {
00768         KAPC_STATE ApcState;
00769         struct
00770         {
00771             UCHAR ApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1];
00772 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00773             SCHAR Priority;
00774 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00775             /* On x86, the following members "fall out" of the union */
00776             volatile ULONG NextProcessor;
00777             volatile ULONG DeferredProcessor;
00778 #else // ][
00779             /* On x86, the following members "fall out" of the union */
00780             volatile USHORT NextProcessor;
00781             volatile USHORT DeferredProcessor;
00782 #endif // ]
00783 #else // ][
00784             UCHAR ApcQueueable;
00785             /* On x86, the following members "fall out" of the union */
00786             volatile UCHAR NextProcessor;
00787             volatile UCHAR DeferredProcessor;
00788             UCHAR AdjustReason;
00789             SCHAR AdjustIncrement;
00790 #endif // ]
00791         };
00792     };
00793     KSPIN_LOCK ApcQueueLock;
00794 #ifndef _M_AMD64 // [
00795     ULONG ContextSwitches;
00796     volatile UCHAR State;
00797     UCHAR NpxState;
00798     KIRQL WaitIrql;
00799     KPROCESSOR_MODE WaitMode;
00800 #endif // ]
00801     LONG_PTR WaitStatus;
00802 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00803     PKWAIT_BLOCK WaitBlockList;
00804 #else // ][
00805     union
00806     {
00807         PKWAIT_BLOCK WaitBlockList;
00808         PKGATE GateObject;
00809     };
00810 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00811     union
00812     {
00813         struct
00814         {
00815             ULONG KernelStackResident:1;
00816             ULONG ReadyTransition:1;
00817             ULONG ProcessReadyQueue:1;
00818             ULONG WaitNext:1;
00819             ULONG SystemAffinityActive:1;
00820             ULONG Alertable:1;
00821             ULONG GdiFlushActive:1;
00822             ULONG Reserved:25;
00823         };
00824         LONG MiscFlags;
00825     };
00826 #else // ][
00827     BOOLEAN Alertable;
00828     BOOLEAN WaitNext;
00829 #endif // ]
00830     UCHAR WaitReason;
00831 #if (NTDDI_VERSION < NTDDI_LONGHORN)
00832     SCHAR Priority;
00833     BOOLEAN EnableStackSwap;
00834 #endif // ]
00835     volatile UCHAR SwapBusy;
00836     BOOLEAN Alerted[MaximumMode];
00837 #endif // ]
00838     union
00839     {
00840         LIST_ENTRY WaitListEntry;
00841         SINGLE_LIST_ENTRY SwapListEntry;
00842     };
00843     PKQUEUE Queue;
00844 #ifndef _M_AMD64 // [
00845     ULONG WaitTime;
00846     union
00847     {
00848         struct
00849         {
00850             SHORT KernelApcDisable;
00851             SHORT SpecialApcDisable;
00852         };
00853         ULONG CombinedApcDisable;
00854     };
00855 #endif // ]
00856     struct _TEB *Teb;
00857 
00858 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00859     KTIMER Timer;
00860 #else // ][
00861     union
00862     {
00863         KTIMER Timer;
00864         struct
00865         {
00866             UCHAR TimerFill[FIELD_OFFSET(KTIMER, Period) + sizeof(LONG)];
00867 #if !defined(_WIN64) // [
00868         };
00869     };
00870 #endif // ]
00871 #endif // ]
00872             union
00873             {
00874                 struct
00875                 {
00876                     ULONG AutoAlignment:1;
00877                     ULONG DisableBoost:1;
00878 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00879                     ULONG EtwStackTraceApc1Inserted:1;
00880                     ULONG EtwStackTraceApc2Inserted:1;
00881                     ULONG CycleChargePending:1;
00882                     ULONG CalloutActive:1;
00883                     ULONG ApcQueueable:1;
00884                     ULONG EnableStackSwap:1;
00885                     ULONG GuiThread:1;
00886                     ULONG ReservedFlags:23;
00887 #else // ][
00888                     LONG ReservedFlags:30;
00889 #endif // ]
00890                 };
00891                 LONG ThreadFlags;
00892             };
00893 #if defined(_WIN64) && (NTDDI_VERSION < NTDDI_WIN7) // [
00894         };
00895     };
00896 #endif // ]
00897 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00898 #if defined(_WIN64) // [
00899     ULONG Spare0;
00900 #else // ][
00901     PVOID ServiceTable;
00902 #endif // ]
00903 #endif // ]
00904     union
00905     {
00906         DECLSPEC_ALIGN(8) KWAIT_BLOCK WaitBlock[THREAD_WAIT_OBJECTS + 1];
00907 #if (NTDDI_VERSION < NTDDI_WIN7) // [
00908         struct
00909         {
00910             UCHAR WaitBlockFill0[FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 32bit = 23, 64bit = 43
00911 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00912             UCHAR IdealProcessor;
00913 #else // ][
00914             BOOLEAN SystemAffinityActive;
00915 #endif // ]
00916         };
00917         struct
00918         {
00919             UCHAR WaitBlockFill1[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 47 / 91
00920             CCHAR PreviousMode;
00921         };
00922         struct
00923         {
00924             UCHAR WaitBlockFill2[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 71 / 139
00925             UCHAR ResourceIndex;
00926         };
00927         struct
00928         {
00929             UCHAR WaitBlockFill3[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 95 / 187
00930             UCHAR LargeStack;
00931         };
00932 #endif // ]
00933 #ifdef _M_AMD64 // [
00934         struct
00935         {
00936             UCHAR WaitBlockFill4[FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
00937             ULONG ContextSwitches;
00938         };
00939         struct
00940         {
00941             UCHAR WaitBlockFill5[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
00942             UCHAR State;
00943             UCHAR NpxState;
00944             UCHAR WaitIrql;
00945             CHAR WaitMode;
00946         };
00947         struct
00948         {
00949             UCHAR WaitBlockFill6[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
00950             ULONG WaitTime;
00951         };
00952 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00953         struct
00954         {
00955             UCHAR WaitBlockFill7[168];
00956             PVOID TebMappedLowVa;
00957             struct _UMS_CONTROL_BLOCK* Ucb;
00958         };
00959 #endif // ]
00960         struct
00961         {
00962 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
00963             UCHAR WaitBlockFill8[188];
00964 #else // ][
00965             UCHAR WaitBlockFill7[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
00966 #endif // ]
00967             union
00968             {
00969                 struct
00970                 {
00971                     SHORT KernelApcDisable;
00972                     SHORT SpecialApcDisable;
00973                 };
00974                 ULONG CombinedApcDisable;
00975             };
00976         };
00977 #endif // ]
00978     };
00979     LIST_ENTRY QueueListEntry;
00980     PKTRAP_FRAME TrapFrame;
00981 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
00982     PVOID FirstArgument;
00983     union                                               // 2 elements, 0x8 bytes (sizeof)
00984     {
00985         PVOID CallbackStack;
00986         ULONG_PTR CallbackDepth;
00987     };
00988 #else // ][
00989     PVOID CallbackStack;
00990 #endif // ]
00991 #if (NTDDI_VERSION < NTDDI_LONGHORN) || ((NTDDI_VERSION < NTDDI_WIN7) && !defined(_WIN64)) // [
00992     PVOID ServiceTable;
00993 #endif // ]
00994 #if (NTDDI_VERSION < NTDDI_LONGHORN) && defined(_WIN64) // [
00995     ULONG KernelLimit;
00996 #endif // ]
00997     UCHAR ApcStateIndex;
00998 #if (NTDDI_VERSION < NTDDI_LONGHORN) // [
00999     UCHAR IdealProcessor;
01000     BOOLEAN Preempted;
01001     BOOLEAN ProcessReadyQueue;
01002 #ifdef _WIN64 // [
01003     PVOID Win32kTable;
01004     ULONG Win32kLimit;
01005 #endif // ]
01006     BOOLEAN KernelStackResident;
01007 #endif // ]
01008     SCHAR BasePriority;
01009     SCHAR PriorityDecrement;
01010 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
01011     BOOLEAN Preempted;
01012     UCHAR AdjustReason;
01013     CHAR AdjustIncrement;
01014 #if (NTDDI_VERSION >= NTDDI_WIN7)
01015     UCHAR PreviousMode;
01016 #else
01017     UCHAR Spare01;
01018 #endif
01019 #endif // ]
01020     CHAR Saturation;
01021 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
01022     ULONG SystemCallNumber;
01023 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01024     ULONG FreezeCount;
01025 #else // ][
01026     ULONG Spare02;
01027 #endif // ]
01028 #endif // ]
01029 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01030     GROUP_AFFINITY UserAffinity;
01031     struct _KPROCESS *Process;
01032     GROUP_AFFINITY Affinity;
01033     ULONG IdealProcessor;
01034     ULONG UserIdealProcessor;
01035 #else // ][
01036     KAFFINITY UserAffinity;
01037     struct _KPROCESS *Process;
01038     KAFFINITY Affinity;
01039 #endif // ]
01040     PKAPC_STATE ApcStatePointer[2];
01041     union
01042     {
01043         KAPC_STATE SavedApcState;
01044         struct
01045         {
01046             UCHAR SavedApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1];
01047 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01048             UCHAR WaitReason;
01049 #else // ][
01050             CCHAR FreezeCount;
01051 #endif // ]
01052 #ifndef _WIN64 // [
01053         };
01054     };
01055 #endif // ]
01056             CCHAR SuspendCount;
01057 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01058             CCHAR Spare1;
01059 #else // ][
01060             UCHAR UserIdealProcessor;
01061 #endif // ]
01062 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01063 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
01064             UCHAR Spare03;
01065 #else // ][
01066             UCHAR CalloutActive;
01067 #endif // ]
01068 #ifdef _WIN64 // [
01069             UCHAR CodePatchInProgress;
01070         };
01071     };
01072 #endif // ]
01073 #if defined(_M_IX86) // [
01074 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
01075     UCHAR OtherPlatformFill;
01076 #else // ][
01077     UCHAR Iopl;
01078 #endif // ]
01079 #endif // ]
01080     PVOID Win32Thread;
01081     PVOID StackBase;
01082     union
01083     {
01084         KAPC SuspendApc;
01085         struct
01086         {
01087             UCHAR SuspendApcFill0[1];
01088 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01089             UCHAR ResourceIndex;
01090 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
01091             CHAR Spare04;
01092 #else // ][
01093             SCHAR Quantum;
01094 #endif // ]
01095         };
01096         struct
01097         {
01098             UCHAR SuspendApcFill1[3];
01099             UCHAR QuantumReset;
01100         };
01101         struct
01102         {
01103             UCHAR SuspendApcFill2[4];
01104             ULONG KernelTime;
01105         };
01106         struct
01107         {
01108             UCHAR SuspendApcFill3[FIELD_OFFSET(KAPC, SystemArgument1)];
01109 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
01110             PKPRCB WaitPrcb;
01111 #else
01112             PVOID TlsArray;
01113 #endif
01114         };
01115         struct
01116         {
01117             UCHAR SuspendApcFill4[FIELD_OFFSET(KAPC, SystemArgument2)]; // 40 / 72
01118             PVOID LegoData;
01119         };
01120         struct
01121         {
01122             UCHAR SuspendApcFill5[FIELD_OFFSET(KAPC, Inserted) + 1]; // 47 / 83
01123 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01124             UCHAR LargeStack;
01125 #else // ][
01126             UCHAR PowerState;
01127 #endif // ]
01128 #ifdef _WIN64 // [
01129             ULONG UserTime;
01130 #endif // ]
01131         };
01132     };
01133 #ifndef _WIN64 // [
01134     ULONG UserTime;
01135 #endif // ]
01136     union
01137     {
01138         KSEMAPHORE SuspendSemaphore;
01139         struct
01140         {
01141             UCHAR SuspendSemaphorefill[FIELD_OFFSET(KSEMAPHORE, Limit) + 4]; // 20 / 28
01142 #ifdef _WIN64 // [
01143             ULONG SListFaultCount;
01144 #endif // ]
01145         };
01146     };
01147 #ifndef _WIN64 // [
01148     ULONG SListFaultCount;
01149 #endif // ]
01150     LIST_ENTRY ThreadListEntry;
01151 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
01152     LIST_ENTRY MutantListHead;
01153 #endif // ]
01154     PVOID SListFaultAddress;
01155 #ifdef _M_AMD64 // [
01156     LONG64 ReadOperationCount;
01157     LONG64 WriteOperationCount;
01158     LONG64 OtherOperationCount;
01159     LONG64 ReadTransferCount;
01160     LONG64 WriteTransferCount;
01161     LONG64 OtherTransferCount;
01162 #endif // ]
01163 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
01164     PKTHREAD_COUNTERS ThreadCounters;
01165     PXSTATE_SAVE XStateSave;
01166 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
01167     PVOID MdlForLockedTeb;
01168 #endif // ]
01169 } KTHREAD;
01170 
01171 #define ASSERT_THREAD(object) \
01172     ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ThreadObject))
01173 
01174 //
01175 // Kernel Process (KPROCESS)
01176 //
01177 typedef struct _KPROCESS
01178 {
01179     DISPATCHER_HEADER Header;
01180     LIST_ENTRY ProfileListHead;
01181 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
01182     ULONG_PTR DirectoryTableBase;
01183     ULONG Unused0;
01184 #else
01185     ULONG_PTR DirectoryTableBase[2];
01186 #endif
01187 #if defined(_M_IX86)
01188     KGDTENTRY LdtDescriptor;
01189     KIDTENTRY Int21Descriptor;
01190 #endif
01191     USHORT IopmOffset;
01192 #if defined(_M_IX86)
01193     UCHAR Iopl;
01194     UCHAR Unused;
01195 #endif
01196     volatile ULONG ActiveProcessors;
01197     ULONG KernelTime;
01198     ULONG UserTime;
01199     LIST_ENTRY ReadyListHead;
01200     SINGLE_LIST_ENTRY SwapListEntry;
01201     PVOID VdmTrapcHandler;
01202     LIST_ENTRY ThreadListHead;
01203     KSPIN_LOCK ProcessLock;
01204     KAFFINITY Affinity;
01205     union
01206     {
01207         struct
01208         {
01209             LONG AutoAlignment:1;
01210             LONG DisableBoost:1;
01211             LONG DisableQuantum:1;
01212             LONG ReservedFlags:29;
01213         };
01214         LONG ProcessFlags;
01215     };
01216     SCHAR BasePriority;
01217     SCHAR QuantumReset;
01218     UCHAR State;
01219     UCHAR ThreadSeed;
01220     UCHAR PowerState;
01221     UCHAR IdealNode;
01222     UCHAR Visited;
01223     union
01224     {
01225         KEXECUTE_OPTIONS Flags;
01226         UCHAR ExecuteOptions;
01227     };
01228     ULONG StackCount;
01229     LIST_ENTRY ProcessListEntry;
01230 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
01231     ULONGLONG CycleTime;
01232 #endif // ]
01233 } KPROCESS;
01234 
01235 #define ASSERT_PROCESS(object) \
01236     ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ProcessObject))
01237 
01238 //
01239 // System Service Table Descriptor
01240 //
01241 typedef struct _KSERVICE_TABLE_DESCRIPTOR
01242 {
01243     PULONG_PTR Base;
01244     PULONG Count;
01245     ULONG Limit;
01246 #if defined(_IA64_)
01247     LONG TableBaseGpOffset;
01248 #endif
01249     PUCHAR Number;
01250 } KSERVICE_TABLE_DESCRIPTOR, *PKSERVICE_TABLE_DESCRIPTOR;
01251 
01252 //
01253 // Exported Loader Parameter Block
01254 //
01255 extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
01256 
01257 //
01258 // Exported Hardware Data
01259 //
01260 extern KAFFINITY NTSYSAPI KeActiveProcessors;
01261 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
01262 extern volatile CCHAR NTSYSAPI KeNumberProcessors;
01263 #else
01264 #if (NTDDI_VERSION >= NTDDI_WINXP)
01265 extern CCHAR NTSYSAPI KeNumberProcessors;
01266 #else
01267 //extern PCCHAR KeNumberProcessors;
01268 extern NTSYSAPI CCHAR KeNumberProcessors; //FIXME: Note to Alex: I won't fix this atm, since I prefer to discuss this with you first.
01269 #endif
01270 #endif
01271 extern ULONG NTSYSAPI KiDmaIoCoherency;
01272 extern ULONG NTSYSAPI KeMaximumIncrement;
01273 extern ULONG NTSYSAPI KeMinimumIncrement;
01274 extern ULONG NTSYSAPI KeDcacheFlushCount;
01275 extern ULONG NTSYSAPI KeIcacheFlushCount;
01276 extern ULONG_PTR NTSYSAPI KiBugCheckData[];
01277 extern BOOLEAN NTSYSAPI KiEnableTimerWatchdog;
01278 
01279 //
01280 // Exported System Service Descriptor Tables
01281 //
01282 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTable[SSDT_MAX_ENTRIES];
01283 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
01284 
01285 #endif // !NTOS_MODE_USER
01286 
01287 #endif // _KETYPES_H

Generated on Sun May 27 2012 04:30:47 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.