225 lines
4.6 KiB
C
225 lines
4.6 KiB
C
|
/*++ BUILD Version: 0003 // Increment this if a change has global effects
|
||
|
|
||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
||
|
Module Name:
|
||
|
|
||
|
ntkeapi.h
|
||
|
|
||
|
Abstract:
|
||
|
|
||
|
This module contains the include file for data types that are exported
|
||
|
by kernel for general use.
|
||
|
|
||
|
Author:
|
||
|
|
||
|
David N. Cutler (davec) 27-Jul-1989
|
||
|
|
||
|
Environment:
|
||
|
|
||
|
Any mode.
|
||
|
|
||
|
Revision History:
|
||
|
|
||
|
--*/
|
||
|
|
||
|
#ifndef _NTKEAPI_
|
||
|
#define _NTKEAPI_
|
||
|
|
||
|
#if _MSC_VER > 1000
|
||
|
#pragma once
|
||
|
#endif
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
// begin_ntddk begin_wdm begin_ntifs begin_nthal
|
||
|
|
||
|
#define LOW_PRIORITY 0 // Lowest thread priority level
|
||
|
#define LOW_REALTIME_PRIORITY 16 // Lowest realtime priority level
|
||
|
#define HIGH_PRIORITY 31 // Highest thread priority level
|
||
|
#define MAXIMUM_PRIORITY 32 // Number of thread priority levels
|
||
|
// begin_winnt
|
||
|
#define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects
|
||
|
|
||
|
#define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended
|
||
|
// end_winnt
|
||
|
|
||
|
//
|
||
|
// Define system time structure.
|
||
|
//
|
||
|
|
||
|
typedef struct _KSYSTEM_TIME {
|
||
|
ULONG LowPart;
|
||
|
LONG High1Time;
|
||
|
LONG High2Time;
|
||
|
} KSYSTEM_TIME, *PKSYSTEM_TIME;
|
||
|
|
||
|
//
|
||
|
// Thread priority
|
||
|
//
|
||
|
|
||
|
typedef LONG KPRIORITY;
|
||
|
|
||
|
//
|
||
|
// Spin Lock
|
||
|
//
|
||
|
|
||
|
// begin_ntndis begin_winnt
|
||
|
|
||
|
typedef ULONG_PTR KSPIN_LOCK;
|
||
|
typedef KSPIN_LOCK *PKSPIN_LOCK;
|
||
|
|
||
|
// end_ntndis end_winnt end_wdm
|
||
|
|
||
|
//
|
||
|
// Define per processor lock queue structure.
|
||
|
//
|
||
|
// N.B. The lock field of the spin lock queue structure contains the address
|
||
|
// of the associated kernel spin lock, an owner bit, and a lock bit. Bit
|
||
|
// 0 of the spin lock address is the wait bit and bit 1 is the owner bit.
|
||
|
// The use of this field is such that the bits can be set and cleared
|
||
|
// noninterlocked, however, the back pointer must be preserved.
|
||
|
//
|
||
|
// The lock wait bit is set when a processor enqueues itself on the lock
|
||
|
// queue and it is not the only entry in the queue. The processor will
|
||
|
// spin on this bit waiting for the lock to be granted.
|
||
|
//
|
||
|
// The owner bit is set when the processor owns the respective lock.
|
||
|
//
|
||
|
// The next field of the spin lock queue structure is used to line the
|
||
|
// queued lock structures together in fifo order. It also can set set and
|
||
|
// cleared noninterlocked.
|
||
|
//
|
||
|
|
||
|
#define LOCK_QUEUE_WAIT 1
|
||
|
#define LOCK_QUEUE_OWNER 2
|
||
|
|
||
|
typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
|
||
|
LockQueueDispatcherLock,
|
||
|
LockQueueContextSwapLock,
|
||
|
LockQueuePfnLock,
|
||
|
LockQueueSystemSpaceLock,
|
||
|
LockQueueVacbLock,
|
||
|
LockQueueMasterLock,
|
||
|
LockQueueNonPagedPoolLock,
|
||
|
LockQueueIoCancelLock,
|
||
|
LockQueueWorkQueueLock,
|
||
|
LockQueueIoVpbLock,
|
||
|
LockQueueIoDatabaseLock,
|
||
|
LockQueueIoCompletionLock,
|
||
|
LockQueueNtfsStructLock,
|
||
|
LockQueueAfdWorkQueueLock,
|
||
|
LockQueueBcbLock,
|
||
|
LockQueueMaximumLock
|
||
|
} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
|
||
|
|
||
|
typedef struct _KSPIN_LOCK_QUEUE {
|
||
|
struct _KSPIN_LOCK_QUEUE * volatile Next;
|
||
|
PKSPIN_LOCK volatile Lock;
|
||
|
} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
|
||
|
|
||
|
typedef struct _KLOCK_QUEUE_HANDLE {
|
||
|
KSPIN_LOCK_QUEUE LockQueue;
|
||
|
KIRQL OldIrql;
|
||
|
} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
|
||
|
|
||
|
// begin_wdm
|
||
|
//
|
||
|
// Interrupt routine (first level dispatch)
|
||
|
//
|
||
|
|
||
|
typedef
|
||
|
VOID
|
||
|
(*PKINTERRUPT_ROUTINE) (
|
||
|
VOID
|
||
|
);
|
||
|
|
||
|
//
|
||
|
// Profile source types
|
||
|
//
|
||
|
typedef enum _KPROFILE_SOURCE {
|
||
|
ProfileTime,
|
||
|
ProfileAlignmentFixup,
|
||
|
ProfileTotalIssues,
|
||
|
ProfilePipelineDry,
|
||
|
ProfileLoadInstructions,
|
||
|
ProfilePipelineFrozen,
|
||
|
ProfileBranchInstructions,
|
||
|
ProfileTotalNonissues,
|
||
|
ProfileDcacheMisses,
|
||
|
ProfileIcacheMisses,
|
||
|
ProfileCacheMisses,
|
||
|
ProfileBranchMispredictions,
|
||
|
ProfileStoreInstructions,
|
||
|
ProfileFpInstructions,
|
||
|
ProfileIntegerInstructions,
|
||
|
Profile2Issue,
|
||
|
Profile3Issue,
|
||
|
Profile4Issue,
|
||
|
ProfileSpecialInstructions,
|
||
|
ProfileTotalCycles,
|
||
|
ProfileIcacheIssues,
|
||
|
ProfileDcacheAccesses,
|
||
|
ProfileMemoryBarrierCycles,
|
||
|
ProfileLoadLinkedIssues,
|
||
|
ProfileMaximum
|
||
|
} KPROFILE_SOURCE;
|
||
|
|
||
|
// end_ntddk end_wdm end_ntifs end_nthal
|
||
|
|
||
|
//
|
||
|
// User mode callback return.
|
||
|
//
|
||
|
|
||
|
NTSYSCALLAPI
|
||
|
NTSTATUS
|
||
|
NTAPI
|
||
|
NtCallbackReturn (
|
||
|
IN PVOID OutputBuffer OPTIONAL,
|
||
|
IN ULONG OutputLength,
|
||
|
IN NTSTATUS Status
|
||
|
);
|
||
|
|
||
|
NTSYSCALLAPI
|
||
|
NTSTATUS
|
||
|
NTAPI
|
||
|
NtQueryDebugFilterState (
|
||
|
IN ULONG ComponentId,
|
||
|
IN ULONG Level
|
||
|
);
|
||
|
|
||
|
NTSYSCALLAPI
|
||
|
NTSTATUS
|
||
|
NTAPI
|
||
|
NtSetDebugFilterState (
|
||
|
IN ULONG ComponentId,
|
||
|
IN ULONG Level,
|
||
|
IN BOOLEAN State
|
||
|
);
|
||
|
|
||
|
NTSYSAPI
|
||
|
NTSTATUS
|
||
|
NTAPI
|
||
|
NtW32Call (
|
||
|
IN ULONG ApiNumber,
|
||
|
IN PVOID InputBuffer,
|
||
|
IN ULONG InputLength,
|
||
|
OUT PVOID *OutputBuffer,
|
||
|
OUT PULONG OutputLength
|
||
|
);
|
||
|
|
||
|
NTSYSCALLAPI
|
||
|
NTSTATUS
|
||
|
NTAPI
|
||
|
NtYieldExecution (
|
||
|
VOID
|
||
|
);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif // _NTKEAPI_
|