1 use winapi::shared::ntdef::{BOOLEAN, NTSTATUS, PVOID, ULONG}; 2 pub const LOW_PRIORITY: u32 = 0; 3 pub const LOW_REALTIME_PRIORITY: u32 = 16; 4 pub const HIGH_PRIORITY: u32 = 31; 5 pub const MAXIMUM_PRIORITY: u32 = 32; 6 ENUM!{enum KTHREAD_STATE { 7 Initialized = 0, 8 Ready = 1, 9 Running = 2, 10 Standby = 3, 11 Terminated = 4, 12 Waiting = 5, 13 Transition = 6, 14 DeferredReady = 7, 15 GateWaitObsolete = 8, 16 WaitingForProcessInSwap = 9, 17 MaximumThreadState = 10, 18 }} 19 pub type PKTHREAD_STATE = *mut KTHREAD_STATE; 20 ENUM!{enum KHETERO_CPU_POLICY { 21 KHeteroCpuPolicyAll = 0, 22 KHeteroCpuPolicyLarge = 1, 23 KHeteroCpuPolicyLargeOrIdle = 2, 24 KHeteroCpuPolicySmall = 3, 25 KHeteroCpuPolicySmallOrIdle = 4, 26 KHeteroCpuPolicyDynamic = 5, 27 KHeteroCpuPolicyStaticMax = 6, 28 KHeteroCpuPolicyBiasedSmall = 7, 29 KHeteroCpuPolicyBiasedLarge = 8, 30 KHeteroCpuPolicyDefault = 9, 31 KHeteroCpuPolicyMax = 10, 32 }} 33 pub type PKHETERO_CPU_POLICY = *mut KHETERO_CPU_POLICY; 34 ENUM!{enum KWAIT_REASON { 35 Executive = 0, 36 FreePage = 1, 37 PageIn = 2, 38 PoolAllocation = 3, 39 DelayExecution = 4, 40 Suspended = 5, 41 UserRequest = 6, 42 WrExecutive = 7, 43 WrFreePage = 8, 44 WrPageIn = 9, 45 WrPoolAllocation = 10, 46 WrDelayExecution = 11, 47 WrSuspended = 12, 48 WrUserRequest = 13, 49 WrEventPair = 14, 50 WrQueue = 15, 51 WrLpcReceive = 16, 52 WrLpcReply = 17, 53 WrVirtualMemory = 18, 54 WrPageOut = 19, 55 WrRendezvous = 20, 56 WrKeyedEvent = 21, 57 WrTerminated = 22, 58 WrProcessInSwap = 23, 59 WrCpuRateControl = 24, 60 WrCalloutStack = 25, 61 WrKernel = 26, 62 WrResource = 27, 63 WrPushLock = 28, 64 WrMutex = 29, 65 WrQuantumEnd = 30, 66 WrDispatchInt = 31, 67 WrPreempted = 32, 68 WrYieldExecution = 33, 69 WrFastMutex = 34, 70 WrGuardedMutex = 35, 71 WrRundown = 36, 72 WrAlertByThreadId = 37, 73 WrDeferredPreempt = 38, 74 MaximumWaitReason = 39, 75 }} 76 pub type PKWAIT_REASON = *mut KWAIT_REASON; 77 ENUM!{enum KPROFILE_SOURCE { 78 ProfileTime = 0, 79 ProfileAlignmentFixup = 1, 80 ProfileTotalIssues = 2, 81 ProfilePipelineDry = 3, 82 ProfileLoadInstructions = 4, 83 ProfilePipelineFrozen = 5, 84 ProfileBranchInstructions = 6, 85 ProfileTotalNonissues = 7, 86 ProfileDcacheMisses = 8, 87 ProfileIcacheMisses = 9, 88 ProfileCacheMisses = 10, 89 ProfileBranchMispredictions = 11, 90 ProfileStoreInstructions = 12, 91 ProfileFpInstructions = 13, 92 ProfileIntegerInstructions = 14, 93 Profile2Issue = 15, 94 Profile3Issue = 16, 95 Profile4Issue = 17, 96 ProfileSpecialInstructions = 18, 97 ProfileTotalCycles = 19, 98 ProfileIcacheIssues = 20, 99 ProfileDcacheAccesses = 21, 100 ProfileMemoryBarrierCycles = 22, 101 ProfileLoadLinkedIssues = 23, 102 ProfileMaximum = 24, 103 }} 104 EXTERN!{extern "system" { 105 fn NtCallbackReturn( 106 OutputBuffer: PVOID, 107 OutputLength: ULONG, 108 Status: NTSTATUS, 109 ) -> NTSTATUS; 110 fn NtFlushProcessWriteBuffers(); 111 fn NtQueryDebugFilterState( 112 ComponentId: ULONG, 113 Level: ULONG, 114 ) -> NTSTATUS; 115 fn NtSetDebugFilterState( 116 ComponentId: ULONG, 117 Level: ULONG, 118 State: BOOLEAN, 119 ) -> NTSTATUS; 120 fn NtYieldExecution() -> NTSTATUS; 121 }} 122