Author: akhaldi
Date: Wed Mar 17 00:33:28 2010
New Revision: 46234
URL:
http://svn.reactos.org/svn/reactos?rev=46234&view=rev
Log:
[NTDDK]
- Group related definitions
- Add CmResourceTypeMaximum, SINGLE_GROUP_LEGACY_API, MAXIMUM_EXPANSION_SIZE,
EXPAND_STACK_CALLOUT and several SYSTEM_*, TIMER_SET_*, XSTATE_*, SHARED_*, EX_*,
PCCARD_*, PAUSE_PROCESSOR and Ke*
Modified:
branches/header-work/include/ddk/ntddk.h
Modified: branches/header-work/include/ddk/ntddk.h
URL:
http://svn.reactos.org/svn/reactos/branches/header-work/include/ddk/ntddk.h…
==============================================================================
--- branches/header-work/include/ddk/ntddk.h [iso-8859-1] (original)
+++ branches/header-work/include/ddk/ntddk.h [iso-8859-1] Wed Mar 17 00:33:28 2010
@@ -1893,665 +1893,52 @@
IN ULONG ProcessInformationLength,
OUT PULONG ReturnLength OPTIONAL);
-struct _LOADER_PARAMETER_BLOCK;
-struct _CREATE_DISK;
-struct _DRIVE_LAYOUT_INFORMATION_EX;
-struct _SET_PARTITION_INFORMATION_EX;
-
-//
-// GUID and UUID
-//
-#ifndef GUID_DEFINED
-#include <guiddef.h>
-#endif
-typedef GUID UUID;
-
-#define MAX_WOW64_SHARED_ENTRIES 16
-
-#define NX_SUPPORT_POLICY_ALWAYSOFF 0
-#define NX_SUPPORT_POLICY_ALWAYSON 1
-#define NX_SUPPORT_POLICY_OPTIN 2
-#define NX_SUPPORT_POLICY_OPTOUT 3
-
-/*
-** IRP function codes
-*/
-
-#define IRP_MN_QUERY_DIRECTORY 0x01
-#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
-
-#define IRP_MN_USER_FS_REQUEST 0x00
-#define IRP_MN_MOUNT_VOLUME 0x01
-#define IRP_MN_VERIFY_VOLUME 0x02
-#define IRP_MN_LOAD_FILE_SYSTEM 0x03
-#define IRP_MN_TRACK_LINK 0x04
-#define IRP_MN_KERNEL_CALL 0x04
-
-#define IRP_MN_LOCK 0x01
-#define IRP_MN_UNLOCK_SINGLE 0x02
-#define IRP_MN_UNLOCK_ALL 0x03
-#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
-
-#define IRP_MN_FLUSH_AND_PURGE 0x01
-
-#define IRP_MN_NORMAL 0x00
-#define IRP_MN_DPC 0x01
-#define IRP_MN_MDL 0x02
-#define IRP_MN_COMPLETE 0x04
-#define IRP_MN_COMPRESSED 0x08
-
-#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
-#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
-#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
-
-#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
-
-/* DEVICE_OBJECT.Flags */
-
-#define DO_DEVICE_HAS_NAME 0x00000040
-#define DO_SYSTEM_BOOT_PARTITION 0x00000100
-#define DO_LONG_TERM_REQUESTS 0x00000200
-#define DO_NEVER_LAST_DEVICE 0x00000400
-#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
-#define DO_SUPPORTS_TRANSACTIONS 0x00040000
-#define DO_FORCE_NEITHER_IO 0x00080000
-#define DO_VOLUME_DEVICE_OBJECT 0x00100000
-#define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
-#define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
-#define DO_DISALLOW_EXECUTE 0x00800000
-
-#define DRVO_REINIT_REGISTERED 0x00000008
-#define DRVO_INITIALIZED 0x00000010
-#define DRVO_BOOTREINIT_REGISTERED 0x00000020
-#define DRVO_LEGACY_RESOURCES 0x00000040
-
-typedef enum _ARBITER_REQUEST_SOURCE {
- ArbiterRequestUndefined = -1,
- ArbiterRequestLegacyReported,
- ArbiterRequestHalReported,
- ArbiterRequestLegacyAssigned,
- ArbiterRequestPnpDetected,
- ArbiterRequestPnpEnumerated
-} ARBITER_REQUEST_SOURCE;
-
-typedef enum _ARBITER_RESULT {
- ArbiterResultUndefined = -1,
- ArbiterResultSuccess,
- ArbiterResultExternalConflict,
- ArbiterResultNullRequest
-} ARBITER_RESULT;
-
-typedef enum _ARBITER_ACTION {
- ArbiterActionTestAllocation,
- ArbiterActionRetestAllocation,
- ArbiterActionCommitAllocation,
- ArbiterActionRollbackAllocation,
- ArbiterActionQueryAllocatedResources,
- ArbiterActionWriteReservedResources,
- ArbiterActionQueryConflict,
- ArbiterActionQueryArbitrate,
- ArbiterActionAddReserved,
- ArbiterActionBootAllocation
-} ARBITER_ACTION, *PARBITER_ACTION;
-
-typedef struct _ARBITER_CONFLICT_INFO {
- PDEVICE_OBJECT OwningObject;
- ULONGLONG Start;
- ULONGLONG End;
-} ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO;
-
-typedef struct _ARBITER_PARAMETERS {
- union {
- struct {
- IN OUT PLIST_ENTRY ArbitrationList;
- IN ULONG AllocateFromCount;
- IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
- } TestAllocation;
- struct {
- IN OUT PLIST_ENTRY ArbitrationList;
- IN ULONG AllocateFromCount;
- IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
- } RetestAllocation;
- struct {
- IN OUT PLIST_ENTRY ArbitrationList;
- } BootAllocation;
- struct {
- OUT PCM_PARTIAL_RESOURCE_LIST *AllocatedResources;
- } QueryAllocatedResources;
- struct {
- IN PDEVICE_OBJECT PhysicalDeviceObject;
- IN PIO_RESOURCE_DESCRIPTOR ConflictingResource;
- OUT PULONG ConflictCount;
- OUT PARBITER_CONFLICT_INFO *Conflicts;
- } QueryConflict;
- struct {
- IN PLIST_ENTRY ArbitrationList;
- } QueryArbitrate;
- struct {
- IN PDEVICE_OBJECT ReserveDevice;
- } AddReserved;
- } Parameters;
-} ARBITER_PARAMETERS, *PARBITER_PARAMETERS;
-
-#define ARBITER_FLAG_BOOT_CONFIG 0x00000001
-
-typedef struct _ARBITER_LIST_ENTRY {
- LIST_ENTRY ListEntry;
- ULONG AlternativeCount;
- PIO_RESOURCE_DESCRIPTOR Alternatives;
- PDEVICE_OBJECT PhysicalDeviceObject;
- ARBITER_REQUEST_SOURCE RequestSource;
- ULONG Flags;
- LONG_PTR WorkSpace;
- INTERFACE_TYPE InterfaceType;
- ULONG SlotNumber;
- ULONG BusNumber;
- PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment;
- PIO_RESOURCE_DESCRIPTOR SelectedAlternative;
- ARBITER_RESULT Result;
-} ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY;
+typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION {
+ SystemFirmwareTable_Enumerate,
+ SystemFirmwareTable_Get
+} SYSTEM_FIRMWARE_TABLE_ACTION;
+
+typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION {
+ ULONG ProviderSignature;
+ SYSTEM_FIRMWARE_TABLE_ACTION Action;
+ ULONG TableID;
+ ULONG TableBufferLength;
+ UCHAR TableBuffer[ANYSIZE_ARRAY];
+} SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION;
typedef NTSTATUS
-(NTAPI *PARBITER_HANDLER)(
- IN OUT PVOID Context,
- IN ARBITER_ACTION Action,
- IN OUT PARBITER_PARAMETERS Parameters);
-
-#define ARBITER_PARTIAL 0x00000001
-
-typedef struct _ARBITER_INTERFACE {
- USHORT Size;
- USHORT Version;
- PVOID Context;
- PINTERFACE_REFERENCE InterfaceReference;
- PINTERFACE_DEREFERENCE InterfaceDereference;
- PARBITER_HANDLER ArbiterHandler;
- ULONG Flags;
-} ARBITER_INTERFACE, *PARBITER_INTERFACE;
-
-typedef enum _HAL_QUERY_INFORMATION_CLASS {
- HalInstalledBusInformation,
- HalProfileSourceInformation,
- HalInformationClassUnused1,
- HalPowerInformation,
- HalProcessorSpeedInformation,
- HalCallbackInformation,
- HalMapRegisterInformation,
- HalMcaLogInformation,
- HalFrameBufferCachingInformation,
- HalDisplayBiosInformation,
- HalProcessorFeatureInformation,
- HalNumaTopologyInterface,
- HalErrorInformation,
- HalCmcLogInformation,
- HalCpeLogInformation,
- HalQueryMcaInterface,
- HalQueryAMLIIllegalIOPortAddresses,
- HalQueryMaxHotPlugMemoryAddress,
- HalPartitionIpiInterface,
- HalPlatformInformation,
- HalQueryProfileSourceList,
- HalInitLogInformation,
- HalFrequencyInformation,
- HalProcessorBrandString,
- HalHypervisorInformation,
- HalPlatformTimerInformation,
- HalAcpiAuditInformation
-} HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS;
-
-typedef enum _HAL_SET_INFORMATION_CLASS {
- HalProfileSourceInterval,
- HalProfileSourceInterruptHandler,
- HalMcaRegisterDriver,
- HalKernelErrorHandler,
- HalCmcRegisterDriver,
- HalCpeRegisterDriver,
- HalMcaLog,
- HalCmcLog,
- HalCpeLog,
- HalGenerateCmcInterrupt,
- HalProfileSourceTimerHandler,
- HalEnlightenment,
- HalProfileDpgoSourceInterruptHandler
-} HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS;
-
-typedef struct _HAL_PROFILE_SOURCE_INTERVAL {
- KPROFILE_SOURCE Source;
- ULONG_PTR Interval;
-} HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL;
-
-typedef struct _HAL_PROFILE_SOURCE_INFORMATION {
- KPROFILE_SOURCE Source;
- BOOLEAN Supported;
- ULONG Interval;
-} HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION;
-
-typedef struct _MAP_REGISTER_ENTRY {
- PVOID MapRegister;
- BOOLEAN WriteToDevice;
-} MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
-
-typedef struct _DEBUG_DEVICE_ADDRESS {
- UCHAR Type;
- BOOLEAN Valid;
- UCHAR Reserved[2];
- PUCHAR TranslatedAddress;
- ULONG Length;
-} DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS;
-
-typedef struct _DEBUG_MEMORY_REQUIREMENTS {
- PHYSICAL_ADDRESS Start;
- PHYSICAL_ADDRESS MaxEnd;
- PVOID VirtualAddress;
- ULONG Length;
- BOOLEAN Cached;
- BOOLEAN Aligned;
-} DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS;
-
-typedef struct _DEBUG_DEVICE_DESCRIPTOR {
- ULONG Bus;
- ULONG Slot;
- USHORT Segment;
- USHORT VendorID;
- USHORT DeviceID;
- UCHAR BaseClass;
- UCHAR SubClass;
- UCHAR ProgIf;
- BOOLEAN Initialized;
- BOOLEAN Configured;
- DEBUG_DEVICE_ADDRESS BaseAddress[6];
- DEBUG_MEMORY_REQUIREMENTS Memory;
-} DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR;
-
-typedef struct _PM_DISPATCH_TABLE {
- ULONG Signature;
- ULONG Version;
- PVOID Function[1];
-} PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE;
-
-typedef enum _RESOURCE_TRANSLATION_DIRECTION {
- TranslateChildToParent,
- TranslateParentToChild
-} RESOURCE_TRANSLATION_DIRECTION;
-
-typedef NTSTATUS
-(NTAPI *PTRANSLATE_RESOURCE_HANDLER)(
- IN OUT PVOID Context,
- IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Source,
- IN RESOURCE_TRANSLATION_DIRECTION Direction,
- IN ULONG AlternativesCount OPTIONAL,
- IN IO_RESOURCE_DESCRIPTOR Alternatives[],
- IN PDEVICE_OBJECT PhysicalDeviceObject,
- OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target);
-
-typedef NTSTATUS
-(NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)(
- IN PVOID Context OPTIONAL,
- IN PIO_RESOURCE_DESCRIPTOR Source,
- IN PDEVICE_OBJECT PhysicalDeviceObject,
- OUT PULONG TargetCount,
- OUT PIO_RESOURCE_DESCRIPTOR *Target);
-
-typedef struct _TRANSLATOR_INTERFACE {
- USHORT Size;
- USHORT Version;
- PVOID Context;
- PINTERFACE_REFERENCE InterfaceReference;
- PINTERFACE_DEREFERENCE InterfaceDereference;
- PTRANSLATE_RESOURCE_HANDLER TranslateResources;
- PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements;
-} TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE;
+(__cdecl *PFNFTH) (
+ IN OUT PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo);
+
+typedef struct _SYSTEM_FIRMWARE_TABLE_HANDLER {
+ ULONG ProviderSignature;
+ BOOLEAN Register;
+ PFNFTH FirmwareTableHandler;
+ PVOID DriverObject;
+} SYSTEM_FIRMWARE_TABLE_HANDLER, *PSYSTEM_FIRMWARE_TABLE_HANDLER;
typedef VOID
-(FASTCALL *pHalExamineMBR)(
- IN PDEVICE_OBJECT DeviceObject,
- IN ULONG SectorSize,
- IN ULONG MBRTypeIdentifier,
- OUT PVOID *Buffer);
-
-typedef NTSTATUS
-(FASTCALL *pHalIoReadPartitionTable)(
- IN PDEVICE_OBJECT DeviceObject,
- IN ULONG SectorSize,
- IN BOOLEAN ReturnRecognizedPartitions,
- OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
-
-typedef NTSTATUS
-(FASTCALL *pHalIoSetPartitionInformation)(
- IN PDEVICE_OBJECT DeviceObject,
- IN ULONG SectorSize,
- IN ULONG PartitionNumber,
- IN ULONG PartitionType);
-
-typedef NTSTATUS
-(FASTCALL *pHalIoWritePartitionTable)(
- IN PDEVICE_OBJECT DeviceObject,
- IN ULONG SectorSize,
- IN ULONG SectorsPerTrack,
- IN ULONG NumberOfHeads,
- IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
-
-typedef PBUS_HANDLER
-(FASTCALL *pHalHandlerForBus)(
- IN INTERFACE_TYPE InterfaceType,
- IN ULONG BusNumber);
-
-typedef VOID
-(FASTCALL *pHalReferenceBusHandler)(
- IN PBUS_HANDLER BusHandler);
-
-typedef NTSTATUS
-(NTAPI *pHalQuerySystemInformation)(
- IN HAL_QUERY_INFORMATION_CLASS InformationClass,
- IN ULONG BufferSize,
- IN OUT PVOID Buffer,
- OUT PULONG ReturnedLength);
-
-typedef NTSTATUS
-(NTAPI *pHalSetSystemInformation)(
- IN HAL_SET_INFORMATION_CLASS InformationClass,
- IN ULONG BufferSize,
- IN PVOID Buffer);
-
-typedef NTSTATUS
-(NTAPI *pHalQueryBusSlots)(
- IN PBUS_HANDLER BusHandler,
- IN ULONG BufferSize,
- OUT PULONG SlotNumbers,
- OUT PULONG ReturnedLength);
-
-typedef NTSTATUS
-(NTAPI *pHalInitPnpDriver)(
- VOID);
-
-typedef NTSTATUS
-(NTAPI *pHalInitPowerManagement)(
- IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
- OUT PPM_DISPATCH_TABLE *PmHalDispatchTable);
-
-typedef struct _DMA_ADAPTER*
-(NTAPI *pHalGetDmaAdapter)(
- IN PVOID Context,
- IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
- OUT PULONG NumberOfMapRegisters);
-
-typedef NTSTATUS
-(NTAPI *pHalGetInterruptTranslator)(
- IN INTERFACE_TYPE ParentInterfaceType,
- IN ULONG ParentBusNumber,
- IN INTERFACE_TYPE BridgeInterfaceType,
- IN USHORT Size,
- IN USHORT Version,
- OUT PTRANSLATOR_INTERFACE Translator,
- OUT PULONG BridgeBusNumber);
-
-typedef NTSTATUS
-(NTAPI *pHalStartMirroring)(
- VOID);
-
-typedef NTSTATUS
-(NTAPI *pHalEndMirroring)(
- IN ULONG PassNumber);
-
-typedef NTSTATUS
-(NTAPI *pHalMirrorPhysicalMemory)(
- IN PHYSICAL_ADDRESS PhysicalAddress,
- IN LARGE_INTEGER NumberOfBytes);
-
-typedef NTSTATUS
-(NTAPI *pHalMirrorVerify)(
- IN PHYSICAL_ADDRESS PhysicalAddress,
- IN LARGE_INTEGER NumberOfBytes);
-
-typedef VOID
-(NTAPI *pHalEndOfBoot)(
- VOID);
-
-typedef
-BOOLEAN
-(NTAPI *pHalTranslateBusAddress)(
- IN INTERFACE_TYPE InterfaceType,
- IN ULONG BusNumber,
- IN PHYSICAL_ADDRESS BusAddress,
- IN OUT PULONG AddressSpace,
- OUT PPHYSICAL_ADDRESS TranslatedAddress);
-
-typedef
-NTSTATUS
-(NTAPI *pHalAssignSlotResources)(
- IN PUNICODE_STRING RegistryPath,
- IN PUNICODE_STRING DriverClassName OPTIONAL,
- IN PDRIVER_OBJECT DriverObject,
- IN PDEVICE_OBJECT DeviceObject,
- IN INTERFACE_TYPE BusType,
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN OUT PCM_RESOURCE_LIST *AllocatedResources);
-
-typedef
-VOID
-(NTAPI *pHalHaltSystem)(
- VOID);
-
-typedef
-BOOLEAN
-(NTAPI *pHalResetDisplay)(
- VOID);
-
-typedef
-UCHAR
-(NTAPI *pHalVectorToIDTEntry)(
- ULONG Vector);
-
-typedef
-BOOLEAN
-(NTAPI *pHalFindBusAddressTranslation)(
- IN PHYSICAL_ADDRESS BusAddress,
- IN OUT PULONG AddressSpace,
- OUT PPHYSICAL_ADDRESS TranslatedAddress,
- IN OUT PULONG_PTR Context,
- IN BOOLEAN NextBus);
-
-typedef
-NTSTATUS
-(NTAPI *pKdSetupPciDeviceForDebugging)(
- IN PVOID LoaderBlock OPTIONAL,
- IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
-
-typedef
-NTSTATUS
-(NTAPI *pKdReleasePciDeviceForDebugging)(
- IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
-
-typedef
-PVOID
-(NTAPI *pKdGetAcpiTablePhase0)(
- IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
- IN ULONG Signature);
-
-typedef
-PVOID
-(NTAPI *pHalGetAcpiTable)(
- IN ULONG Signature,
- IN PCSTR OemId OPTIONAL,
- IN PCSTR OemTableId OPTIONAL);
-
-typedef
-VOID
-(NTAPI *pKdCheckPowerButton)(
- VOID);
-
-#if (NTDDI_VERSION >= NTDDI_VISTA)
-typedef
-PVOID
-(NTAPI *pKdMapPhysicalMemory64)(
- IN PHYSICAL_ADDRESS PhysicalAddress,
- IN ULONG NumberPages,
- IN BOOLEAN FlushCurrentTLB);
-
-typedef
-VOID
-(NTAPI *pKdUnmapVirtualAddress)(
- IN PVOID VirtualAddress,
- IN ULONG NumberPages,
- IN BOOLEAN FlushCurrentTLB);
-#else
-typedef
-PVOID
-(NTAPI *pKdMapPhysicalMemory64)(
- IN PHYSICAL_ADDRESS PhysicalAddress,
- IN ULONG NumberPages);
-
-typedef
-VOID
-(NTAPI *pKdUnmapVirtualAddress)(
- IN PVOID VirtualAddress,
- IN ULONG NumberPages);
-#endif
-
-
-typedef
-ULONG
-(NTAPI *pKdGetPciDataByOffset)(
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- OUT PVOID Buffer,
- IN ULONG Offset,
- IN ULONG Length);
-
-typedef
-ULONG
-(NTAPI *pKdSetPciDataByOffset)(
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN PVOID Buffer,
- IN ULONG Offset,
- IN ULONG Length);
-
-typedef BOOLEAN
-(NTAPI *PHAL_RESET_DISPLAY_PARAMETERS)(
- IN ULONG Columns,
- IN ULONG Rows);
-
-typedef
-VOID
-(NTAPI *PCI_ERROR_HANDLER_CALLBACK)(
- VOID);
-
-typedef
-VOID
-(NTAPI *pHalSetPciErrorHandlerCallback)(
- IN PCI_ERROR_HANDLER_CALLBACK Callback);
-
-#if 1 /* Not present in WDK 7600 */
-typedef VOID
-(FASTCALL *pHalIoAssignDriveLetters)(
- IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
- IN PSTRING NtDeviceName,
- OUT PUCHAR NtSystemPath,
- OUT PSTRING NtSystemPathString);
-#endif
-
-typedef struct {
- ULONG Version;
- pHalQuerySystemInformation HalQuerySystemInformation;
- pHalSetSystemInformation HalSetSystemInformation;
- pHalQueryBusSlots HalQueryBusSlots;
- ULONG Spare1;
- pHalExamineMBR HalExamineMBR;
-#if 1 /* Not present in WDK 7600 */
- pHalIoAssignDriveLetters HalIoAssignDriveLetters;
-#endif
- pHalIoReadPartitionTable HalIoReadPartitionTable;
- pHalIoSetPartitionInformation HalIoSetPartitionInformation;
- pHalIoWritePartitionTable HalIoWritePartitionTable;
- pHalHandlerForBus HalReferenceHandlerForBus;
- pHalReferenceBusHandler HalReferenceBusHandler;
- pHalReferenceBusHandler HalDereferenceBusHandler;
- pHalInitPnpDriver HalInitPnpDriver;
- pHalInitPowerManagement HalInitPowerManagement;
- pHalGetDmaAdapter HalGetDmaAdapter;
- pHalGetInterruptTranslator HalGetInterruptTranslator;
- pHalStartMirroring HalStartMirroring;
- pHalEndMirroring HalEndMirroring;
- pHalMirrorPhysicalMemory HalMirrorPhysicalMemory;
- pHalEndOfBoot HalEndOfBoot;
- pHalMirrorVerify HalMirrorVerify;
- pHalGetAcpiTable HalGetCachedAcpiTable;
- pHalSetPciErrorHandlerCallback HalSetPciErrorHandlerCallback;
-#if defined(_IA64_)
- pHalGetErrorCapList HalGetErrorCapList;
- pHalInjectError HalInjectError;
-#endif
-} HAL_DISPATCH, *PHAL_DISPATCH;
-
-/* GCC/MSVC and WDK compatible declaration */
-extern NTKERNELAPI HAL_DISPATCH HalDispatchTable;
-
-#if defined(_NTOSKRNL_) || defined(_BLDR_)
-#define HALDISPATCH (&HalDispatchTable)
-#else
-/* This is a WDK compatibility definition */
-#define HalDispatchTable (&HalDispatchTable)
-#define HALDISPATCH HalDispatchTable
-#endif
-
-#define HAL_DISPATCH_VERSION 3 /* FIXME: when to use 4? */
-#define HalDispatchTableVersion HALDISPATCH->Version
-#define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
-#define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
-#define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
-#define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
-#define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
-#define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
-#define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver
-#define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement
-#define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter
-#define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator
-#define HalStartMirroring HALDISPATCH->HalStartMirroring
-#define HalEndMirroring HALDISPATCH->HalEndMirroring
-#define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory
-#define HalEndOfBoot HALDISPATCH->HalEndOfBoot
-#define HalMirrorVerify HALDISPATCH->HalMirrorVerify
-
-typedef struct _IMAGE_INFO {
- _ANONYMOUS_UNION union {
- ULONG Properties;
- _ANONYMOUS_STRUCT struct {
- ULONG ImageAddressingMode:8;
- ULONG SystemModeImage:1;
- ULONG ImageMappedToAllPids:1;
- ULONG ExtendedInfoPresent:1;
- ULONG Reserved:22;
- } DUMMYSTRUCTNAME;
- } DUMMYUNIONNAME;
- PVOID ImageBase;
- ULONG ImageSelector;
- SIZE_T ImageSize;
- ULONG ImageSectionNumber;
-} IMAGE_INFO, *PIMAGE_INFO;
-
-#define IMAGE_ADDRESSING_MODE_32BIT 3
-
-typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
- IoQueryDeviceIdentifier = 0,
- IoQueryDeviceConfigurationData,
- IoQueryDeviceComponentInformation,
- IoQueryDeviceMaxData
-} IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
-
-typedef struct _DISK_SIGNATURE {
- ULONG PartitionStyle;
- _ANONYMOUS_UNION union {
- struct {
- ULONG Signature;
- ULONG CheckSum;
- } Mbr;
- struct {
- GUID DiskId;
- } Gpt;
- } DUMMYUNIONNAME;
-} DISK_SIGNATURE, *PDISK_SIGNATURE;
+(NTAPI *PTIMER_APC_ROUTINE)(
+ IN PVOID TimerContext,
+ IN ULONG TimerLowValue,
+ IN LONG TimerHighValue);
+
+typedef enum _TIMER_SET_INFORMATION_CLASS {
+ TimerSetCoalescableTimer,
+ MaxTimerInfoClass
+} TIMER_SET_INFORMATION_CLASS;
+
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
+ IN LARGE_INTEGER DueTime;
+ IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
+ IN PVOID TimerContext OPTIONAL;
+ IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
+ IN ULONG Period OPTIONAL;
+ IN ULONG TolerableDelay;
+ OUT PBOOLEAN PreviousState OPTIONAL;
+} TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
+#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
typedef ULONG_PTR
(NTAPI *PDRIVER_VERIFIER_THUNK_ROUTINE)(
@@ -2568,447 +1955,206 @@
#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
#define DRIVER_VERIFIER_IO_CHECKING 0x0010
-typedef VOID
-(NTAPI *PTIMER_APC_ROUTINE)(
- IN PVOID TimerContext,
- IN ULONG TimerLowValue,
- IN LONG TimerHighValue);
-
-typedef struct _KUSER_SHARED_DATA
-{
- ULONG TickCountLowDeprecated;
- ULONG TickCountMultiplier;
- volatile KSYSTEM_TIME InterruptTime;
- volatile KSYSTEM_TIME SystemTime;
- volatile KSYSTEM_TIME TimeZoneBias;
- USHORT ImageNumberLow;
- USHORT ImageNumberHigh;
- WCHAR NtSystemRoot[260];
- ULONG MaxStackTraceDepth;
- ULONG CryptoExponent;
- ULONG TimeZoneId;
- ULONG LargePageMinimum;
- ULONG Reserved2[7];
- NT_PRODUCT_TYPE NtProductType;
- BOOLEAN ProductTypeIsValid;
- ULONG NtMajorVersion;
- ULONG NtMinorVersion;
- BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
- ULONG Reserved1;
- ULONG Reserved3;
- volatile ULONG TimeSlip;
- ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
- ULONG AltArchitecturePad[1];
- LARGE_INTEGER SystemExpirationDate;
- ULONG SuiteMask;
- BOOLEAN KdDebuggerEnabled;
+#define XSTATE_LEGACY_FLOATING_POINT 0
+#define XSTATE_LEGACY_SSE 1
+#define XSTATE_GSSE 2
+
+#define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 <<
(XSTATE_LEGACY_FLOATING_POINT))
+#define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
+#define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT |
XSTATE_MASK_LEGACY_SSE)
+#define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
+
+#define MAXIMUM_XSTATE_FEATURES 64
+
+typedef struct _XSTATE_FEATURE {
+ ULONG Offset;
+ ULONG Size;
+} XSTATE_FEATURE, *PXSTATE_FEATURE;
+
+typedef struct _XSTATE_CONFIGURATION {
+ ULONG64 EnabledFeatures;
+ ULONG Size;
+ ULONG OptimizedSave:1;
+ XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
+} XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
+
+#define MAX_WOW64_SHARED_ENTRIES 16
+
+#define NX_SUPPORT_POLICY_ALWAYSOFF 0
+#define NX_SUPPORT_POLICY_ALWAYSON 1
+#define NX_SUPPORT_POLICY_OPTIN 2
+#define NX_SUPPORT_POLICY_OPTOUT 3
+
+#define SHARED_GLOBAL_FLAGS_ERROR_PORT_V 0x0
+#define SHARED_GLOBAL_FLAGS_ERROR_PORT (1UL <<
SHARED_GLOBAL_FLAGS_ERROR_PORT_V)
+
+#define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V 0x1
+#define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED (1UL <<
SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V)
+
+#define SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V 0x2
+#define SHARED_GLOBAL_FLAGS_VIRT_ENABLED (1UL <<
SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V)
+
+#define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V 0x3
+#define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED \
+ (1UL << SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V)
+
+#define SHARED_GLOBAL_FLAGS_SPARE_V 0x4
+#define SHARED_GLOBAL_FLAGS_SPARE \
+ (1UL << SHARED_GLOBAL_FLAGS_SPARE_V)
+
+#define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V 0x5
+#define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED \
+ (1UL << SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V)
+
+#define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V 0x6
+#define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED \
+ (1UL << SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V)
+
+#define EX_INIT_BITS(Flags, Bit) \
+ *((Flags)) |= (Bit) // Safe to use before concurrently accessible
+
+#define EX_TEST_SET_BIT(Flags, Bit) \
+ InterlockedBitTestAndSet ((PLONG)(Flags), (Bit))
+
+#define EX_TEST_CLEAR_BIT(Flags, Bit) \
+ InterlockedBitTestAndReset ((PLONG)(Flags), (Bit))
+
+typedef struct _KUSER_SHARED_DATA {
+ ULONG TickCountLowDeprecated;
+ ULONG TickCountMultiplier;
+ volatile KSYSTEM_TIME InterruptTime;
+ volatile KSYSTEM_TIME SystemTime;
+ volatile KSYSTEM_TIME TimeZoneBias;
+ USHORT ImageNumberLow;
+ USHORT ImageNumberHigh;
+ WCHAR NtSystemRoot[260];
+ ULONG MaxStackTraceDepth;
+ ULONG CryptoExponent;
+ ULONG TimeZoneId;
+ ULONG LargePageMinimum;
+ ULONG Reserved2[7];
+ NT_PRODUCT_TYPE NtProductType;
+ BOOLEAN ProductTypeIsValid;
+ ULONG NtMajorVersion;
+ ULONG NtMinorVersion;
+ BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
+ ULONG Reserved1;
+ ULONG Reserved3;
+ volatile ULONG TimeSlip;
+ ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
+ ULONG AltArchitecturePad[1];
+ LARGE_INTEGER SystemExpirationDate;
+ ULONG SuiteMask;
+ BOOLEAN KdDebuggerEnabled;
#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
- UCHAR NXSupportPolicy;
+ UCHAR NXSupportPolicy;
#endif
- volatile ULONG ActiveConsoleId;
- volatile ULONG DismountCount;
- ULONG ComPlusPackage;
- ULONG LastSystemRITEventTickCount;
- ULONG NumberOfPhysicalPages;
- BOOLEAN SafeBootMode;
+ volatile ULONG ActiveConsoleId;
+ volatile ULONG DismountCount;
+ ULONG ComPlusPackage;
+ ULONG LastSystemRITEventTickCount;
+ ULONG NumberOfPhysicalPages;
+ BOOLEAN SafeBootMode;
#if (NTDDI_VERSION >= NTDDI_WIN7)
- union {
- UCHAR TscQpcData;
- struct {
- UCHAR TscQpcEnabled:1;
- UCHAR TscQpcSpareFlag:1;
- UCHAR TscQpcShift:6;
- } DUMMYSTRUCTNAME;
- } DUMMYUNIONNAME;
- UCHAR TscQpcPad[2];
+ union {
+ UCHAR TscQpcData;
+ struct {
+ UCHAR TscQpcEnabled:1;
+ UCHAR TscQpcSpareFlag:1;
+ UCHAR TscQpcShift:6;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+ UCHAR TscQpcPad[2];
#endif
#if (NTDDI_VERSION >= NTDDI_VISTA)
- union {
- ULONG SharedDataFlags;
- struct {
- ULONG DbgErrorPortPresent:1;
- ULONG DbgElevationEnabled:1;
- ULONG DbgVirtEnabled:1;
- ULONG DbgInstallerDetectEnabled:1;
- ULONG DbgSystemDllRelocated:1;
- ULONG DbgDynProcessorEnabled:1;
- ULONG DbgSEHValidationEnabled:1;
- ULONG SpareBits:25;
- } DUMMYSTRUCTNAME2;
- } DUMMYUNIONNAME2;
+ union {
+ ULONG SharedDataFlags;
+ struct {
+ ULONG DbgErrorPortPresent:1;
+ ULONG DbgElevationEnabled:1;
+ ULONG DbgVirtEnabled:1;
+ ULONG DbgInstallerDetectEnabled:1;
+ ULONG DbgSystemDllRelocated:1;
+ ULONG DbgDynProcessorEnabled:1;
+ ULONG DbgSEHValidationEnabled:1;
+ ULONG SpareBits:25;
+ } DUMMYSTRUCTNAME2;
+ } DUMMYUNIONNAME2;
#else
- ULONG TraceLogging;
+ ULONG TraceLogging;
#endif
- ULONG DataFlagsPad[1];
- ULONGLONG TestRetInstruction;
- ULONG SystemCall;
- ULONG SystemCallReturn;
- ULONGLONG SystemCallPad[3];
- _ANONYMOUS_UNION union {
- volatile KSYSTEM_TIME TickCount;
- volatile ULONG64 TickCountQuad;
- _ANONYMOUS_STRUCT struct {
- ULONG ReservedTickCountOverlay[3];
- ULONG TickCountPad[1];
- } DUMMYSTRUCTNAME;
- } DUMMYUNIONNAME3;
- ULONG Cookie;
- ULONG CookiePad[1];
+ ULONG DataFlagsPad[1];
+ ULONGLONG TestRetInstruction;
+ ULONG SystemCall;
+ ULONG SystemCallReturn;
+ ULONGLONG SystemCallPad[3];
+ _ANONYMOUS_UNION union {
+ volatile KSYSTEM_TIME TickCount;
+ volatile ULONG64 TickCountQuad;
+ _ANONYMOUS_STRUCT struct {
+ ULONG ReservedTickCountOverlay[3];
+ ULONG TickCountPad[1];
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME3;
+ ULONG Cookie;
+ ULONG CookiePad[1];
#if (NTDDI_VERSION >= NTDDI_WS03)
- LONGLONG ConsoleSessionForegroundProcessId;
- ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
+ LONGLONG ConsoleSessionForegroundProcessId;
+ ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
#endif
#if (NTDDI_VERSION >= NTDDI_VISTA)
#if (NTDDI_VERSION >= NTDDI_WIN7)
- USHORT UserModeGlobalLogger[16];
+ USHORT UserModeGlobalLogger[16];
#else
- USHORT UserModeGlobalLogger[8];
- ULONG HeapTracingPid[2];
- ULONG CritSecTracingPid[2];
+ USHORT UserModeGlobalLogger[8];
+ ULONG HeapTracingPid[2];
+ ULONG CritSecTracingPid[2];
#endif
- ULONG ImageFileExecutionOptions;
+ ULONG ImageFileExecutionOptions;
#if (NTDDI_VERSION >= NTDDI_VISTASP1)
- ULONG LangGenerationCount;
+ ULONG LangGenerationCount;
#else
- /* 4 bytes padding */
+ /* 4 bytes padding */
#endif
- ULONGLONG Reserved5;
- volatile ULONG64 InterruptTimeBias;
+ ULONGLONG Reserved5;
+ volatile ULONG64 InterruptTimeBias;
#endif
#if (NTDDI_VERSION >= NTDDI_WIN7)
- volatile ULONG64 TscQpcBias;
- volatile ULONG ActiveProcessorCount;
- volatile USHORT ActiveGroupCount;
- USHORT Reserved4;
- volatile ULONG AitSamplingValue;
- volatile ULONG AppCompatFlag;
- ULONGLONG SystemDllNativeRelocation;
- ULONG SystemDllWowRelocation;
- ULONG XStatePad[1];
- XSTATE_CONFIGURATION XState;
+ volatile ULONG64 TscQpcBias;
+ volatile ULONG ActiveProcessorCount;
+ volatile USHORT ActiveGroupCount;
+ USHORT Reserved4;
+ volatile ULONG AitSamplingValue;
+ volatile ULONG AppCompatFlag;
+ ULONGLONG SystemDllNativeRelocation;
+ ULONG SystemDllWowRelocation;
+ ULONG XStatePad[1];
+ XSTATE_CONFIGURATION XState;
#endif
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
-extern NTKERNELAPI PVOID MmHighestUserAddress;
-extern NTKERNELAPI PVOID MmSystemRangeStart;
-extern NTKERNELAPI ULONG MmUserProbeAddress;
-
-
-#ifdef _X86_
-
-#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
-#define MM_SYSTEM_RANGE_START MmSystemRangeStart
-#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
-#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
-extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
-#else
-#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
-#endif
-#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
-#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
-#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
-#if !defined (_X86PAE_)
-#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
-#else
-#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
-#endif
-
-#define KeGetPcr() PCR
-
-#define PCR_MINOR_VERSION 1
-#define PCR_MAJOR_VERSION 1
-
-typedef struct _KPCR {
- union {
- NT_TIB NtTib;
- struct {
- struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
- PVOID Used_StackBase;
- PVOID Spare2;
- PVOID TssCopy;
- ULONG ContextSwitches;
- KAFFINITY SetMemberCopy;
- PVOID Used_Self;
- };
- };
- struct _KPCR *SelfPcr;
- struct _KPRCB *Prcb;
- KIRQL Irql;
- ULONG IRR;
- ULONG IrrActive;
- ULONG IDR;
- PVOID KdVersionBlock;
- struct _KIDTENTRY *IDT;
- struct _KGDTENTRY *GDT;
- struct _KTSS *TSS;
- USHORT MajorVersion;
- USHORT MinorVersion;
- KAFFINITY SetMember;
- ULONG StallScaleFactor;
- UCHAR SpareUnused;
- UCHAR Number;
- UCHAR Spare0;
- UCHAR SecondLevelCacheAssociativity;
- ULONG VdmAlert;
- ULONG KernelReserved[14];
- ULONG SecondLevelCacheSize;
- ULONG HalReserved[16];
-} KPCR, *PKPCR;
-
-FORCEINLINE
-ULONG
-KeGetCurrentProcessorNumber(VOID)
-{
- return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
-}
-
-#endif /* _X86_ */
-
-#ifdef _AMD64_
-
-#define PTI_SHIFT 12L
-#define PDI_SHIFT 21L
-#define PPI_SHIFT 30L
-#define PXI_SHIFT 39L
-#define PTE_PER_PAGE 512
-#define PDE_PER_PAGE 512
-#define PPE_PER_PAGE 512
-#define PXE_PER_PAGE 512
-#define PTI_MASK_AMD64 (PTE_PER_PAGE - 1)
-#define PDI_MASK_AMD64 (PDE_PER_PAGE - 1)
-#define PPI_MASK (PPE_PER_PAGE - 1)
-#define PXI_MASK (PXE_PER_PAGE - 1)
-
-#define PXE_BASE 0xFFFFF6FB7DBED000ULL
-#define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL
-#define PPE_BASE 0xFFFFF6FB7DA00000ULL
-#define PDE_BASE 0xFFFFF6FB40000000ULL
-#define PTE_BASE 0xFFFFF68000000000ULL
-#define PXE_TOP 0xFFFFF6FB7DBEDFFFULL
-#define PPE_TOP 0xFFFFF6FB7DBFFFFFULL
-#define PDE_TOP 0xFFFFF6FB7FFFFFFFULL
-#define PTE_TOP 0xFFFFF6FFFFFFFFFFULL
-
-#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
-#define MM_SYSTEM_RANGE_START MmSystemRangeStart
-#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
-#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
-#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
-#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
-
-typedef struct _KPCR
-{
- _ANONYMOUS_UNION union
- {
- NT_TIB NtTib;
- _ANONYMOUS_STRUCT struct
- {
- union _KGDTENTRY64 *GdtBase;
- struct _KTSS64 *TssBase;
- ULONG64 UserRsp;
- struct _KPCR *Self;
- struct _KPRCB *CurrentPrcb;
- PKSPIN_LOCK_QUEUE LockArray;
- PVOID Used_Self;
- };
- };
- union _KIDTENTRY64 *IdtBase;
- ULONG64 Unused[2];
- KIRQL Irql;
- UCHAR SecondLevelCacheAssociativity;
- UCHAR ObsoleteNumber;
- UCHAR Fill0;
- ULONG Unused0[3];
- USHORT MajorVersion;
- USHORT MinorVersion;
- ULONG StallScaleFactor;
- PVOID Unused1[3];
- ULONG KernelReserved[15];
- ULONG SecondLevelCacheSize;
- ULONG HalReserved[16];
- ULONG Unused2;
- PVOID KdVersionBlock;
- PVOID Unused3;
- ULONG PcrAlign1[24];
-} KPCR, *PKPCR;
-
-FORCEINLINE
-PKPCR
-KeGetPcr(VOID)
-{
- return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
-}
-
-FORCEINLINE
-ULONG
-KeGetCurrentProcessorNumber(VOID)
-{
- return (ULONG)__readgsword(0x184);
-}
-
-#endif /* _AMD64_ */
-
-typedef enum _INTERLOCKED_RESULT {
- ResultNegative = RESULT_NEGATIVE,
- ResultZero = RESULT_ZERO,
- ResultPositive = RESULT_POSITIVE
-} INTERLOCKED_RESULT;
-
-/* Executive Types */
-
-#define PROTECTED_POOL 0x80000000
-
-typedef struct _ZONE_SEGMENT_HEADER {
- SINGLE_LIST_ENTRY SegmentList;
- PVOID Reserved;
-} ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
-
-typedef struct _ZONE_HEADER {
- SINGLE_LIST_ENTRY FreeList;
- SINGLE_LIST_ENTRY SegmentList;
- ULONG BlockSize;
- ULONG TotalSegmentSize;
-} ZONE_HEADER, *PZONE_HEADER;
-
-/* Executive Functions */
-
-static __inline PVOID
-ExAllocateFromZone(
- IN PZONE_HEADER Zone)
-{
- if (Zone->FreeList.Next)
- Zone->FreeList.Next = Zone->FreeList.Next->Next;
- return (PVOID) Zone->FreeList.Next;
-}
-
-static __inline PVOID
-ExFreeToZone(
- IN PZONE_HEADER Zone,
- IN PVOID Block)
-{
- ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
- Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
- return ((PSINGLE_LIST_ENTRY) Block)->Next;
-}
-
-/*
- * PVOID
- * ExInterlockedAllocateFromZone(
- * IN PZONE_HEADER Zone,
- * IN PKSPIN_LOCK Lock)
- */
-#define ExInterlockedAllocateFromZone(Zone, Lock) \
- ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
-
-/* PVOID
- * ExInterlockedFreeToZone(
- * IN PZONE_HEADER Zone,
- * IN PVOID Block,
- * IN PKSPIN_LOCK Lock);
- */
-#define ExInterlockedFreeToZone(Zone, Block, Lock) \
- ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block),
Lock)
-
-/*
- * BOOLEAN
- * ExIsFullZone(
- * IN PZONE_HEADER Zone)
- */
-#define ExIsFullZone(Zone) \
- ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
-
-/* BOOLEAN
- * ExIsObjectInFirstZoneSegment(
- * IN PZONE_HEADER Zone,
- * IN PVOID Object);
- */
-#define ExIsObjectInFirstZoneSegment(Zone,Object) \
- ((BOOLEAN)( ((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) &&
\
- ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \
- (Zone)->TotalSegmentSize)) )
-
-#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
-#define ExAcquireResourceShared ExAcquireResourceSharedLite
-#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
-#define ExDeleteResource ExDeleteResourceLite
-#define ExInitializeResource ExInitializeResourceLite
-#define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
-#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
-#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
-#define ExReleaseResourceForThread ExReleaseResourceForThreadLite
-
-#if (NTDDI_VERSION >= NTDDI_WIN2K)
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExExtendZone(
- IN OUT PZONE_HEADER Zone,
- IN OUT PVOID Segment,
- IN ULONG SegmentSize);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExInitializeZone(
- OUT PZONE_HEADER Zone,
- IN ULONG BlockSize,
- IN OUT PVOID InitialSegment,
- IN ULONG InitialSegmentSize);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExInterlockedExtendZone(
- IN OUT PZONE_HEADER Zone,
- IN OUT PVOID Segment,
- IN ULONG SegmentSize,
- IN OUT PKSPIN_LOCK Lock);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExUuidCreate(
- OUT UUID *Uuid);
-
-NTKERNELAPI
-DECLSPEC_NORETURN
-VOID
-NTAPI
-ExRaiseAccessViolation(
- VOID);
-
-NTKERNELAPI
-DECLSPEC_NORETURN
-VOID
-NTAPI
-ExRaiseDatatypeMisalignment(
- VOID);
-
-#endif
-
-#ifdef _X86_
-
-NTKERNELAPI
-INTERLOCKED_RESULT
-FASTCALL
-Exfi386InterlockedIncrementLong(
- IN OUT LONG volatile *Addend);
-
-NTKERNELAPI
-INTERLOCKED_RESULT
-FASTCALL
-Exfi386InterlockedDecrementLong(
- IN PLONG Addend);
-
-NTKERNELAPI
-ULONG
-FASTCALL
-Exfi386InterlockedExchangeUlong(
- IN PULONG Target,
- IN ULONG Value);
-
-#endif /* _X86_ */
+#define CmResourceTypeMaximum 8
+
+typedef struct _CM_PCCARD_DEVICE_DATA {
+ UCHAR Flags;
+ UCHAR ErrorCode;
+ USHORT Reserved;
+ ULONG BusData;
+ ULONG DeviceId;
+ ULONG LegacyBaseAddress;
+ UCHAR IRQMap[16];
+} CM_PCCARD_DEVICE_DATA, *PCM_PCCARD_DEVICE_DATA;
+
+#define PCCARD_MAP_ERROR 0x01
+#define PCCARD_DEVICE_PCI 0x10
+
+#define PCCARD_SCAN_DISABLED 0x01
+#define PCCARD_MAP_ZERO 0x02
+#define PCCARD_NO_TIMER 0x03
+#define PCCARD_NO_PIC 0x04
+#define PCCARD_NO_LEGACY_BASE 0x05
+#define PCCARD_DUP_LEGACY_BASE 0x06
+#define PCCARD_NO_CONTROLLERS 0x07
#ifndef _ARC_DDK_
#define _ARC_DDK_
@@ -3058,6 +2204,1209 @@
} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
#endif /* !_ARC_DDK_ */
+#if (NTDDI_VERSION < NTDDI_WIN7) || defined(_X86_) || !defined(NT_PROCESSOR_GROUPS)
+#define SINGLE_GROUP_LEGACY_API 1
+#endif
+
+#if defined(_X86_) || defined(_AMD64_)
+#define PAUSE_PROCESSOR YieldProcessor();
+#elif defined(_IA64_)
+#define PAUSE_PROCESSOR __yield();
+#endif
+
+#define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2))
+
+typedef VOID
+(NTAPI *PEXPAND_STACK_CALLOUT) (
+ IN PVOID Parameter OPTIONAL);
+
+
+
+
+
+
+
+
+
+/* Kernel Functions */
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API)
+
+NTKERNELAPI
+VOID
+NTAPI
+KeSetTargetProcessorDpc(
+ IN OUT PRKDPC Dpc,
+ IN CCHAR Number);
+
+NTKERNELAPI
+KAFFINITY
+NTAPI
+KeQueryActiveProcessors(VOID);
+
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+
+NTKERNELAPI
+VOID
+NTAPI
+KeSetImportanceDpc(
+ IN OUT PRKDPC Dpc,
+ IN KDPC_IMPORTANCE Importance);
+
+NTKERNELAPI
+LONG
+NTAPI
+KePulseEvent(
+ IN OUT PRKEVENT Event,
+ IN KPRIORITY Increment,
+ IN BOOLEAN Wait);
+
+NTKERNELAPI
+LONG
+NTAPI
+KeSetBasePriorityThread(
+ IN OUT PRKTHREAD Thread,
+ IN LONG Increment);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeEnterCriticalRegion(VOID);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeLeaveCriticalRegion(VOID);
+
+NTKERNELAPI
+DECLSPEC_NORETURN
+VOID
+NTAPI
+KeBugCheck(
+ IN ULONG BugCheckCode);
+
+#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
+
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+NTKERNELAPI
+BOOLEAN
+NTAPI
+KeAreApcsDisabled(VOID);
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_WS03)
+NTKERNELAPI
+BOOLEAN
+NTAPI
+KeInvalidateAllCaches(VOID);
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_WS03SP1)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeExpandKernelStackAndCallout(
+ IN PEXPAND_STACK_CALLOUT Callout,
+ IN PVOID Parameter OPTIONAL,
+ IN SIZE_T Size);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeEnterGuardedRegion(VOID);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeLeaveGuardedRegion(VOID);
+
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_VISTA) && defined(SINGLE_GROUP_LEGACY_API)
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeQueryActiveProcessorCount(
+ OUT PKAFFINITY ActiveProcessors OPTIONAL);
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeQueryMaximumProcessorCount(VOID);
+
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeQueryActiveProcessorCountEx(
+ IN USHORT GroupNumber);
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeQueryMaximumProcessorCountEx(
+ IN USHORT GroupNumber);
+
+NTKERNELAPI
+USHORT
+NTAPI
+KeQueryActiveGroupCount(VOID);
+
+NTKERNELAPI
+USHORT
+NTAPI
+KeQueryMaximumGroupCount(VOID);
+
+NTKERNELAPI
+KAFFINITY
+NTAPI
+KeQueryGroupAffinity(
+ IN USHORT GroupNumber);
+
+NTKERNELAPI
+ULONG
+NTAPI
+KeGetCurrentProcessorNumberEx(
+ OUT PPROCESSOR_NUMBER ProcNumber OPTIONAL);
+
+NTKERNELAPI
+VOID
+NTAPI
+KeQueryNodeActiveAffinity(
+ IN USHORT NodeNumber,
+ OUT PGROUP_AFFINITY Affinity OPTIONAL,
+ OUT PUSHORT Count OPTIONAL);
+
+NTKERNELAPI
+USHORT
+NTAPI
+KeQueryNodeMaximumProcessorCount(
+ IN USHORT NodeNumber);
+
+NTKERNELAPI
+USHORT
+NTAPI
+KeQueryHighestNodeNumber(VOID);
+
+NTKERNELAPI
+USHORT
+NTAPI
+KeGetCurrentNodeNumber(VOID);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeQueryLogicalProcessorRelationship(
+ IN PPROCESSOR_NUMBER ProcessorNumber OPTIONAL,
+ IN LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType,
+ OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Information OPTIONAL,
+ IN OUT PULONG Length);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeSetHardwareCounterConfiguration(
+ IN PHARDWARE_COUNTER CounterArray,
+ IN ULONG Count);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+KeQueryHardwareCounterConfiguration(
+ OUT PHARDWARE_COUNTER CounterArray,
+ IN ULONG MaximumCount,
+ OUT PULONG Count);
+
+#endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
+
+NTKERNELAPI
+VOID
+FASTCALL
+KeInvalidateRangeAllCaches(
+ IN PVOID BaseAddress,
+ IN ULONG Length);
+
+struct _LOADER_PARAMETER_BLOCK;
+struct _CREATE_DISK;
+struct _DRIVE_LAYOUT_INFORMATION_EX;
+struct _SET_PARTITION_INFORMATION_EX;
+
+//
+// GUID and UUID
+//
+#ifndef GUID_DEFINED
+#include <guiddef.h>
+#endif
+typedef GUID UUID;
+
+/*
+** IRP function codes
+*/
+
+#define IRP_MN_QUERY_DIRECTORY 0x01
+#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
+
+#define IRP_MN_USER_FS_REQUEST 0x00
+#define IRP_MN_MOUNT_VOLUME 0x01
+#define IRP_MN_VERIFY_VOLUME 0x02
+#define IRP_MN_LOAD_FILE_SYSTEM 0x03
+#define IRP_MN_TRACK_LINK 0x04
+#define IRP_MN_KERNEL_CALL 0x04
+
+#define IRP_MN_LOCK 0x01
+#define IRP_MN_UNLOCK_SINGLE 0x02
+#define IRP_MN_UNLOCK_ALL 0x03
+#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
+
+#define IRP_MN_FLUSH_AND_PURGE 0x01
+
+#define IRP_MN_NORMAL 0x00
+#define IRP_MN_DPC 0x01
+#define IRP_MN_MDL 0x02
+#define IRP_MN_COMPLETE 0x04
+#define IRP_MN_COMPRESSED 0x08
+
+#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
+#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
+#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
+
+#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
+
+/* DEVICE_OBJECT.Flags */
+
+#define DO_DEVICE_HAS_NAME 0x00000040
+#define DO_SYSTEM_BOOT_PARTITION 0x00000100
+#define DO_LONG_TERM_REQUESTS 0x00000200
+#define DO_NEVER_LAST_DEVICE 0x00000400
+#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
+#define DO_SUPPORTS_TRANSACTIONS 0x00040000
+#define DO_FORCE_NEITHER_IO 0x00080000
+#define DO_VOLUME_DEVICE_OBJECT 0x00100000
+#define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
+#define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
+#define DO_DISALLOW_EXECUTE 0x00800000
+
+#define DRVO_REINIT_REGISTERED 0x00000008
+#define DRVO_INITIALIZED 0x00000010
+#define DRVO_BOOTREINIT_REGISTERED 0x00000020
+#define DRVO_LEGACY_RESOURCES 0x00000040
+
+typedef enum _ARBITER_REQUEST_SOURCE {
+ ArbiterRequestUndefined = -1,
+ ArbiterRequestLegacyReported,
+ ArbiterRequestHalReported,
+ ArbiterRequestLegacyAssigned,
+ ArbiterRequestPnpDetected,
+ ArbiterRequestPnpEnumerated
+} ARBITER_REQUEST_SOURCE;
+
+typedef enum _ARBITER_RESULT {
+ ArbiterResultUndefined = -1,
+ ArbiterResultSuccess,
+ ArbiterResultExternalConflict,
+ ArbiterResultNullRequest
+} ARBITER_RESULT;
+
+typedef enum _ARBITER_ACTION {
+ ArbiterActionTestAllocation,
+ ArbiterActionRetestAllocation,
+ ArbiterActionCommitAllocation,
+ ArbiterActionRollbackAllocation,
+ ArbiterActionQueryAllocatedResources,
+ ArbiterActionWriteReservedResources,
+ ArbiterActionQueryConflict,
+ ArbiterActionQueryArbitrate,
+ ArbiterActionAddReserved,
+ ArbiterActionBootAllocation
+} ARBITER_ACTION, *PARBITER_ACTION;
+
+typedef struct _ARBITER_CONFLICT_INFO {
+ PDEVICE_OBJECT OwningObject;
+ ULONGLONG Start;
+ ULONGLONG End;
+} ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO;
+
+typedef struct _ARBITER_PARAMETERS {
+ union {
+ struct {
+ IN OUT PLIST_ENTRY ArbitrationList;
+ IN ULONG AllocateFromCount;
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
+ } TestAllocation;
+ struct {
+ IN OUT PLIST_ENTRY ArbitrationList;
+ IN ULONG AllocateFromCount;
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
+ } RetestAllocation;
+ struct {
+ IN OUT PLIST_ENTRY ArbitrationList;
+ } BootAllocation;
+ struct {
+ OUT PCM_PARTIAL_RESOURCE_LIST *AllocatedResources;
+ } QueryAllocatedResources;
+ struct {
+ IN PDEVICE_OBJECT PhysicalDeviceObject;
+ IN PIO_RESOURCE_DESCRIPTOR ConflictingResource;
+ OUT PULONG ConflictCount;
+ OUT PARBITER_CONFLICT_INFO *Conflicts;
+ } QueryConflict;
+ struct {
+ IN PLIST_ENTRY ArbitrationList;
+ } QueryArbitrate;
+ struct {
+ IN PDEVICE_OBJECT ReserveDevice;
+ } AddReserved;
+ } Parameters;
+} ARBITER_PARAMETERS, *PARBITER_PARAMETERS;
+
+#define ARBITER_FLAG_BOOT_CONFIG 0x00000001
+
+typedef struct _ARBITER_LIST_ENTRY {
+ LIST_ENTRY ListEntry;
+ ULONG AlternativeCount;
+ PIO_RESOURCE_DESCRIPTOR Alternatives;
+ PDEVICE_OBJECT PhysicalDeviceObject;
+ ARBITER_REQUEST_SOURCE RequestSource;
+ ULONG Flags;
+ LONG_PTR WorkSpace;
+ INTERFACE_TYPE InterfaceType;
+ ULONG SlotNumber;
+ ULONG BusNumber;
+ PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment;
+ PIO_RESOURCE_DESCRIPTOR SelectedAlternative;
+ ARBITER_RESULT Result;
+} ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY;
+
+typedef NTSTATUS
+(NTAPI *PARBITER_HANDLER)(
+ IN OUT PVOID Context,
+ IN ARBITER_ACTION Action,
+ IN OUT PARBITER_PARAMETERS Parameters);
+
+#define ARBITER_PARTIAL 0x00000001
+
+typedef struct _ARBITER_INTERFACE {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PARBITER_HANDLER ArbiterHandler;
+ ULONG Flags;
+} ARBITER_INTERFACE, *PARBITER_INTERFACE;
+
+typedef enum _HAL_QUERY_INFORMATION_CLASS {
+ HalInstalledBusInformation,
+ HalProfileSourceInformation,
+ HalInformationClassUnused1,
+ HalPowerInformation,
+ HalProcessorSpeedInformation,
+ HalCallbackInformation,
+ HalMapRegisterInformation,
+ HalMcaLogInformation,
+ HalFrameBufferCachingInformation,
+ HalDisplayBiosInformation,
+ HalProcessorFeatureInformation,
+ HalNumaTopologyInterface,
+ HalErrorInformation,
+ HalCmcLogInformation,
+ HalCpeLogInformation,
+ HalQueryMcaInterface,
+ HalQueryAMLIIllegalIOPortAddresses,
+ HalQueryMaxHotPlugMemoryAddress,
+ HalPartitionIpiInterface,
+ HalPlatformInformation,
+ HalQueryProfileSourceList,
+ HalInitLogInformation,
+ HalFrequencyInformation,
+ HalProcessorBrandString,
+ HalHypervisorInformation,
+ HalPlatformTimerInformation,
+ HalAcpiAuditInformation
+} HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS;
+
+typedef enum _HAL_SET_INFORMATION_CLASS {
+ HalProfileSourceInterval,
+ HalProfileSourceInterruptHandler,
+ HalMcaRegisterDriver,
+ HalKernelErrorHandler,
+ HalCmcRegisterDriver,
+ HalCpeRegisterDriver,
+ HalMcaLog,
+ HalCmcLog,
+ HalCpeLog,
+ HalGenerateCmcInterrupt,
+ HalProfileSourceTimerHandler,
+ HalEnlightenment,
+ HalProfileDpgoSourceInterruptHandler
+} HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS;
+
+typedef struct _HAL_PROFILE_SOURCE_INTERVAL {
+ KPROFILE_SOURCE Source;
+ ULONG_PTR Interval;
+} HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL;
+
+typedef struct _HAL_PROFILE_SOURCE_INFORMATION {
+ KPROFILE_SOURCE Source;
+ BOOLEAN Supported;
+ ULONG Interval;
+} HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION;
+
+typedef struct _MAP_REGISTER_ENTRY {
+ PVOID MapRegister;
+ BOOLEAN WriteToDevice;
+} MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
+
+typedef struct _DEBUG_DEVICE_ADDRESS {
+ UCHAR Type;
+ BOOLEAN Valid;
+ UCHAR Reserved[2];
+ PUCHAR TranslatedAddress;
+ ULONG Length;
+} DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS;
+
+typedef struct _DEBUG_MEMORY_REQUIREMENTS {
+ PHYSICAL_ADDRESS Start;
+ PHYSICAL_ADDRESS MaxEnd;
+ PVOID VirtualAddress;
+ ULONG Length;
+ BOOLEAN Cached;
+ BOOLEAN Aligned;
+} DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS;
+
+typedef struct _DEBUG_DEVICE_DESCRIPTOR {
+ ULONG Bus;
+ ULONG Slot;
+ USHORT Segment;
+ USHORT VendorID;
+ USHORT DeviceID;
+ UCHAR BaseClass;
+ UCHAR SubClass;
+ UCHAR ProgIf;
+ BOOLEAN Initialized;
+ BOOLEAN Configured;
+ DEBUG_DEVICE_ADDRESS BaseAddress[6];
+ DEBUG_MEMORY_REQUIREMENTS Memory;
+} DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR;
+
+typedef struct _PM_DISPATCH_TABLE {
+ ULONG Signature;
+ ULONG Version;
+ PVOID Function[1];
+} PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE;
+
+typedef enum _RESOURCE_TRANSLATION_DIRECTION {
+ TranslateChildToParent,
+ TranslateParentToChild
+} RESOURCE_TRANSLATION_DIRECTION;
+
+typedef NTSTATUS
+(NTAPI *PTRANSLATE_RESOURCE_HANDLER)(
+ IN OUT PVOID Context,
+ IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Source,
+ IN RESOURCE_TRANSLATION_DIRECTION Direction,
+ IN ULONG AlternativesCount OPTIONAL,
+ IN IO_RESOURCE_DESCRIPTOR Alternatives[],
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target);
+
+typedef NTSTATUS
+(NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)(
+ IN PVOID Context OPTIONAL,
+ IN PIO_RESOURCE_DESCRIPTOR Source,
+ IN PDEVICE_OBJECT PhysicalDeviceObject,
+ OUT PULONG TargetCount,
+ OUT PIO_RESOURCE_DESCRIPTOR *Target);
+
+typedef struct _TRANSLATOR_INTERFACE {
+ USHORT Size;
+ USHORT Version;
+ PVOID Context;
+ PINTERFACE_REFERENCE InterfaceReference;
+ PINTERFACE_DEREFERENCE InterfaceDereference;
+ PTRANSLATE_RESOURCE_HANDLER TranslateResources;
+ PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements;
+} TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE;
+
+typedef VOID
+(FASTCALL *pHalExamineMBR)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG MBRTypeIdentifier,
+ OUT PVOID *Buffer);
+
+typedef NTSTATUS
+(FASTCALL *pHalIoReadPartitionTable)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN BOOLEAN ReturnRecognizedPartitions,
+ OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
+
+typedef NTSTATUS
+(FASTCALL *pHalIoSetPartitionInformation)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG PartitionNumber,
+ IN ULONG PartitionType);
+
+typedef NTSTATUS
+(FASTCALL *pHalIoWritePartitionTable)(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG SectorSize,
+ IN ULONG SectorsPerTrack,
+ IN ULONG NumberOfHeads,
+ IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
+
+typedef PBUS_HANDLER
+(FASTCALL *pHalHandlerForBus)(
+ IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber);
+
+typedef VOID
+(FASTCALL *pHalReferenceBusHandler)(
+ IN PBUS_HANDLER BusHandler);
+
+typedef NTSTATUS
+(NTAPI *pHalQuerySystemInformation)(
+ IN HAL_QUERY_INFORMATION_CLASS InformationClass,
+ IN ULONG BufferSize,
+ IN OUT PVOID Buffer,
+ OUT PULONG ReturnedLength);
+
+typedef NTSTATUS
+(NTAPI *pHalSetSystemInformation)(
+ IN HAL_SET_INFORMATION_CLASS InformationClass,
+ IN ULONG BufferSize,
+ IN PVOID Buffer);
+
+typedef NTSTATUS
+(NTAPI *pHalQueryBusSlots)(
+ IN PBUS_HANDLER BusHandler,
+ IN ULONG BufferSize,
+ OUT PULONG SlotNumbers,
+ OUT PULONG ReturnedLength);
+
+typedef NTSTATUS
+(NTAPI *pHalInitPnpDriver)(
+ VOID);
+
+typedef NTSTATUS
+(NTAPI *pHalInitPowerManagement)(
+ IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
+ OUT PPM_DISPATCH_TABLE *PmHalDispatchTable);
+
+typedef struct _DMA_ADAPTER*
+(NTAPI *pHalGetDmaAdapter)(
+ IN PVOID Context,
+ IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
+ OUT PULONG NumberOfMapRegisters);
+
+typedef NTSTATUS
+(NTAPI *pHalGetInterruptTranslator)(
+ IN INTERFACE_TYPE ParentInterfaceType,
+ IN ULONG ParentBusNumber,
+ IN INTERFACE_TYPE BridgeInterfaceType,
+ IN USHORT Size,
+ IN USHORT Version,
+ OUT PTRANSLATOR_INTERFACE Translator,
+ OUT PULONG BridgeBusNumber);
+
+typedef NTSTATUS
+(NTAPI *pHalStartMirroring)(
+ VOID);
+
+typedef NTSTATUS
+(NTAPI *pHalEndMirroring)(
+ IN ULONG PassNumber);
+
+typedef NTSTATUS
+(NTAPI *pHalMirrorPhysicalMemory)(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN LARGE_INTEGER NumberOfBytes);
+
+typedef NTSTATUS
+(NTAPI *pHalMirrorVerify)(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN LARGE_INTEGER NumberOfBytes);
+
+typedef VOID
+(NTAPI *pHalEndOfBoot)(
+ VOID);
+
+typedef
+BOOLEAN
+(NTAPI *pHalTranslateBusAddress)(
+ IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress);
+
+typedef
+NTSTATUS
+(NTAPI *pHalAssignSlotResources)(
+ IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName OPTIONAL,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources);
+
+typedef
+VOID
+(NTAPI *pHalHaltSystem)(
+ VOID);
+
+typedef
+BOOLEAN
+(NTAPI *pHalResetDisplay)(
+ VOID);
+
+typedef
+UCHAR
+(NTAPI *pHalVectorToIDTEntry)(
+ ULONG Vector);
+
+typedef
+BOOLEAN
+(NTAPI *pHalFindBusAddressTranslation)(
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress,
+ IN OUT PULONG_PTR Context,
+ IN BOOLEAN NextBus);
+
+typedef
+NTSTATUS
+(NTAPI *pKdSetupPciDeviceForDebugging)(
+ IN PVOID LoaderBlock OPTIONAL,
+ IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
+
+typedef
+NTSTATUS
+(NTAPI *pKdReleasePciDeviceForDebugging)(
+ IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
+
+typedef
+PVOID
+(NTAPI *pKdGetAcpiTablePhase0)(
+ IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
+ IN ULONG Signature);
+
+typedef
+PVOID
+(NTAPI *pHalGetAcpiTable)(
+ IN ULONG Signature,
+ IN PCSTR OemId OPTIONAL,
+ IN PCSTR OemTableId OPTIONAL);
+
+typedef
+VOID
+(NTAPI *pKdCheckPowerButton)(
+ VOID);
+
+#if (NTDDI_VERSION >= NTDDI_VISTA)
+typedef
+PVOID
+(NTAPI *pKdMapPhysicalMemory64)(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN ULONG NumberPages,
+ IN BOOLEAN FlushCurrentTLB);
+
+typedef
+VOID
+(NTAPI *pKdUnmapVirtualAddress)(
+ IN PVOID VirtualAddress,
+ IN ULONG NumberPages,
+ IN BOOLEAN FlushCurrentTLB);
+#else
+typedef
+PVOID
+(NTAPI *pKdMapPhysicalMemory64)(
+ IN PHYSICAL_ADDRESS PhysicalAddress,
+ IN ULONG NumberPages);
+
+typedef
+VOID
+(NTAPI *pKdUnmapVirtualAddress)(
+ IN PVOID VirtualAddress,
+ IN ULONG NumberPages);
+#endif
+
+
+typedef
+ULONG
+(NTAPI *pKdGetPciDataByOffset)(
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ OUT PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+typedef
+ULONG
+(NTAPI *pKdSetPciDataByOffset)(
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length);
+
+typedef BOOLEAN
+(NTAPI *PHAL_RESET_DISPLAY_PARAMETERS)(
+ IN ULONG Columns,
+ IN ULONG Rows);
+
+typedef
+VOID
+(NTAPI *PCI_ERROR_HANDLER_CALLBACK)(
+ VOID);
+
+typedef
+VOID
+(NTAPI *pHalSetPciErrorHandlerCallback)(
+ IN PCI_ERROR_HANDLER_CALLBACK Callback);
+
+#if 1 /* Not present in WDK 7600 */
+typedef VOID
+(FASTCALL *pHalIoAssignDriveLetters)(
+ IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
+ IN PSTRING NtDeviceName,
+ OUT PUCHAR NtSystemPath,
+ OUT PSTRING NtSystemPathString);
+#endif
+
+typedef struct {
+ ULONG Version;
+ pHalQuerySystemInformation HalQuerySystemInformation;
+ pHalSetSystemInformation HalSetSystemInformation;
+ pHalQueryBusSlots HalQueryBusSlots;
+ ULONG Spare1;
+ pHalExamineMBR HalExamineMBR;
+#if 1 /* Not present in WDK 7600 */
+ pHalIoAssignDriveLetters HalIoAssignDriveLetters;
+#endif
+ pHalIoReadPartitionTable HalIoReadPartitionTable;
+ pHalIoSetPartitionInformation HalIoSetPartitionInformation;
+ pHalIoWritePartitionTable HalIoWritePartitionTable;
+ pHalHandlerForBus HalReferenceHandlerForBus;
+ pHalReferenceBusHandler HalReferenceBusHandler;
+ pHalReferenceBusHandler HalDereferenceBusHandler;
+ pHalInitPnpDriver HalInitPnpDriver;
+ pHalInitPowerManagement HalInitPowerManagement;
+ pHalGetDmaAdapter HalGetDmaAdapter;
+ pHalGetInterruptTranslator HalGetInterruptTranslator;
+ pHalStartMirroring HalStartMirroring;
+ pHalEndMirroring HalEndMirroring;
+ pHalMirrorPhysicalMemory HalMirrorPhysicalMemory;
+ pHalEndOfBoot HalEndOfBoot;
+ pHalMirrorVerify HalMirrorVerify;
+ pHalGetAcpiTable HalGetCachedAcpiTable;
+ pHalSetPciErrorHandlerCallback HalSetPciErrorHandlerCallback;
+#if defined(_IA64_)
+ pHalGetErrorCapList HalGetErrorCapList;
+ pHalInjectError HalInjectError;
+#endif
+} HAL_DISPATCH, *PHAL_DISPATCH;
+
+/* GCC/MSVC and WDK compatible declaration */
+extern NTKERNELAPI HAL_DISPATCH HalDispatchTable;
+
+#if defined(_NTOSKRNL_) || defined(_BLDR_)
+#define HALDISPATCH (&HalDispatchTable)
+#else
+/* This is a WDK compatibility definition */
+#define HalDispatchTable (&HalDispatchTable)
+#define HALDISPATCH HalDispatchTable
+#endif
+
+#define HAL_DISPATCH_VERSION 3 /* FIXME: when to use 4? */
+#define HalDispatchTableVersion HALDISPATCH->Version
+#define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
+#define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
+#define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
+#define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
+#define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
+#define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
+#define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver
+#define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement
+#define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter
+#define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator
+#define HalStartMirroring HALDISPATCH->HalStartMirroring
+#define HalEndMirroring HALDISPATCH->HalEndMirroring
+#define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory
+#define HalEndOfBoot HALDISPATCH->HalEndOfBoot
+#define HalMirrorVerify HALDISPATCH->HalMirrorVerify
+
+typedef struct _IMAGE_INFO {
+ _ANONYMOUS_UNION union {
+ ULONG Properties;
+ _ANONYMOUS_STRUCT struct {
+ ULONG ImageAddressingMode:8;
+ ULONG SystemModeImage:1;
+ ULONG ImageMappedToAllPids:1;
+ ULONG ExtendedInfoPresent:1;
+ ULONG Reserved:22;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
+ PVOID ImageBase;
+ ULONG ImageSelector;
+ SIZE_T ImageSize;
+ ULONG ImageSectionNumber;
+} IMAGE_INFO, *PIMAGE_INFO;
+
+#define IMAGE_ADDRESSING_MODE_32BIT 3
+
+typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
+ IoQueryDeviceIdentifier = 0,
+ IoQueryDeviceConfigurationData,
+ IoQueryDeviceComponentInformation,
+ IoQueryDeviceMaxData
+} IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
+
+typedef struct _DISK_SIGNATURE {
+ ULONG PartitionStyle;
+ _ANONYMOUS_UNION union {
+ struct {
+ ULONG Signature;
+ ULONG CheckSum;
+ } Mbr;
+ struct {
+ GUID DiskId;
+ } Gpt;
+ } DUMMYUNIONNAME;
+} DISK_SIGNATURE, *PDISK_SIGNATURE;
+
+extern NTKERNELAPI PVOID MmHighestUserAddress;
+extern NTKERNELAPI PVOID MmSystemRangeStart;
+extern NTKERNELAPI ULONG MmUserProbeAddress;
+
+
+#ifdef _X86_
+
+#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START MmSystemRangeStart
+#if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
+#define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
+extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
+#else
+#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
+#endif
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
+#define MM_SYSTEM_SPACE_END 0xFFFFFFFF
+#if !defined (_X86PAE_)
+#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
+#else
+#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
+#endif
+
+#define KeGetPcr() PCR
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR {
+ union {
+ NT_TIB NtTib;
+ struct {
+ struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
+ PVOID Used_StackBase;
+ PVOID Spare2;
+ PVOID TssCopy;
+ ULONG ContextSwitches;
+ KAFFINITY SetMemberCopy;
+ PVOID Used_Self;
+ };
+ };
+ struct _KPCR *SelfPcr;
+ struct _KPRCB *Prcb;
+ KIRQL Irql;
+ ULONG IRR;
+ ULONG IrrActive;
+ ULONG IDR;
+ PVOID KdVersionBlock;
+ struct _KIDTENTRY *IDT;
+ struct _KGDTENTRY *GDT;
+ struct _KTSS *TSS;
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ KAFFINITY SetMember;
+ ULONG StallScaleFactor;
+ UCHAR SpareUnused;
+ UCHAR Number;
+ UCHAR Spare0;
+ UCHAR SecondLevelCacheAssociativity;
+ ULONG VdmAlert;
+ ULONG KernelReserved[14];
+ ULONG SecondLevelCacheSize;
+ ULONG HalReserved[16];
+} KPCR, *PKPCR;
+
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorNumber(VOID)
+{
+ return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
+}
+
+#endif /* _X86_ */
+
+#ifdef _AMD64_
+
+#define PTI_SHIFT 12L
+#define PDI_SHIFT 21L
+#define PPI_SHIFT 30L
+#define PXI_SHIFT 39L
+#define PTE_PER_PAGE 512
+#define PDE_PER_PAGE 512
+#define PPE_PER_PAGE 512
+#define PXE_PER_PAGE 512
+#define PTI_MASK_AMD64 (PTE_PER_PAGE - 1)
+#define PDI_MASK_AMD64 (PDE_PER_PAGE - 1)
+#define PPI_MASK (PPE_PER_PAGE - 1)
+#define PXI_MASK (PXE_PER_PAGE - 1)
+
+#define PXE_BASE 0xFFFFF6FB7DBED000ULL
+#define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL
+#define PPE_BASE 0xFFFFF6FB7DA00000ULL
+#define PDE_BASE 0xFFFFF6FB40000000ULL
+#define PTE_BASE 0xFFFFF68000000000ULL
+#define PXE_TOP 0xFFFFF6FB7DBEDFFFULL
+#define PPE_TOP 0xFFFFF6FB7DBFFFFFULL
+#define PDE_TOP 0xFFFFF6FB7FFFFFFFULL
+#define PTE_TOP 0xFFFFF6FFFFFFFFFFULL
+
+#define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START MmSystemRangeStart
+#define MM_USER_PROBE_ADDRESS MmUserProbeAddress
+#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
+#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
+#define KI_USER_SHARED_DATA 0xFFFFF78000000000ULL
+
+typedef struct _KPCR
+{
+ _ANONYMOUS_UNION union
+ {
+ NT_TIB NtTib;
+ _ANONYMOUS_STRUCT struct
+ {
+ union _KGDTENTRY64 *GdtBase;
+ struct _KTSS64 *TssBase;
+ ULONG64 UserRsp;
+ struct _KPCR *Self;
+ struct _KPRCB *CurrentPrcb;
+ PKSPIN_LOCK_QUEUE LockArray;
+ PVOID Used_Self;
+ };
+ };
+ union _KIDTENTRY64 *IdtBase;
+ ULONG64 Unused[2];
+ KIRQL Irql;
+ UCHAR SecondLevelCacheAssociativity;
+ UCHAR ObsoleteNumber;
+ UCHAR Fill0;
+ ULONG Unused0[3];
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ ULONG StallScaleFactor;
+ PVOID Unused1[3];
+ ULONG KernelReserved[15];
+ ULONG SecondLevelCacheSize;
+ ULONG HalReserved[16];
+ ULONG Unused2;
+ PVOID KdVersionBlock;
+ PVOID Unused3;
+ ULONG PcrAlign1[24];
+} KPCR, *PKPCR;
+
+FORCEINLINE
+PKPCR
+KeGetPcr(VOID)
+{
+ return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
+}
+
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorNumber(VOID)
+{
+ return (ULONG)__readgsword(0x184);
+}
+
+#endif /* _AMD64_ */
+
+typedef enum _INTERLOCKED_RESULT {
+ ResultNegative = RESULT_NEGATIVE,
+ ResultZero = RESULT_ZERO,
+ ResultPositive = RESULT_POSITIVE
+} INTERLOCKED_RESULT;
+
+/* Executive Types */
+
+#define PROTECTED_POOL 0x80000000
+
+typedef struct _ZONE_SEGMENT_HEADER {
+ SINGLE_LIST_ENTRY SegmentList;
+ PVOID Reserved;
+} ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
+
+typedef struct _ZONE_HEADER {
+ SINGLE_LIST_ENTRY FreeList;
+ SINGLE_LIST_ENTRY SegmentList;
+ ULONG BlockSize;
+ ULONG TotalSegmentSize;
+} ZONE_HEADER, *PZONE_HEADER;
+
+/* Executive Functions */
+
+static __inline PVOID
+ExAllocateFromZone(
+ IN PZONE_HEADER Zone)
+{
+ if (Zone->FreeList.Next)
+ Zone->FreeList.Next = Zone->FreeList.Next->Next;
+ return (PVOID) Zone->FreeList.Next;
+}
+
+static __inline PVOID
+ExFreeToZone(
+ IN PZONE_HEADER Zone,
+ IN PVOID Block)
+{
+ ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
+ Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
+ return ((PSINGLE_LIST_ENTRY) Block)->Next;
+}
+
+/*
+ * PVOID
+ * ExInterlockedAllocateFromZone(
+ * IN PZONE_HEADER Zone,
+ * IN PKSPIN_LOCK Lock)
+ */
+#define ExInterlockedAllocateFromZone(Zone, Lock) \
+ ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
+
+/* PVOID
+ * ExInterlockedFreeToZone(
+ * IN PZONE_HEADER Zone,
+ * IN PVOID Block,
+ * IN PKSPIN_LOCK Lock);
+ */
+#define ExInterlockedFreeToZone(Zone, Block, Lock) \
+ ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block),
Lock)
+
+/*
+ * BOOLEAN
+ * ExIsFullZone(
+ * IN PZONE_HEADER Zone)
+ */
+#define ExIsFullZone(Zone) \
+ ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
+
+/* BOOLEAN
+ * ExIsObjectInFirstZoneSegment(
+ * IN PZONE_HEADER Zone,
+ * IN PVOID Object);
+ */
+#define ExIsObjectInFirstZoneSegment(Zone,Object) \
+ ((BOOLEAN)( ((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) &&
\
+ ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \
+ (Zone)->TotalSegmentSize)) )
+
+#define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
+#define ExAcquireResourceShared ExAcquireResourceSharedLite
+#define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
+#define ExDeleteResource ExDeleteResourceLite
+#define ExInitializeResource ExInitializeResourceLite
+#define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
+#define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
+#define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
+#define ExReleaseResourceForThread ExReleaseResourceForThreadLite
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ExExtendZone(
+ IN OUT PZONE_HEADER Zone,
+ IN OUT PVOID Segment,
+ IN ULONG SegmentSize);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ExInitializeZone(
+ OUT PZONE_HEADER Zone,
+ IN ULONG BlockSize,
+ IN OUT PVOID InitialSegment,
+ IN ULONG InitialSegmentSize);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ExInterlockedExtendZone(
+ IN OUT PZONE_HEADER Zone,
+ IN OUT PVOID Segment,
+ IN ULONG SegmentSize,
+ IN OUT PKSPIN_LOCK Lock);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+ExUuidCreate(
+ OUT UUID *Uuid);
+
+NTKERNELAPI
+DECLSPEC_NORETURN
+VOID
+NTAPI
+ExRaiseAccessViolation(
+ VOID);
+
+NTKERNELAPI
+DECLSPEC_NORETURN
+VOID
+NTAPI
+ExRaiseDatatypeMisalignment(
+ VOID);
+
+#endif
+
+#ifdef _X86_
+
+NTKERNELAPI
+INTERLOCKED_RESULT
+FASTCALL
+Exfi386InterlockedIncrementLong(
+ IN OUT LONG volatile *Addend);
+
+NTKERNELAPI
+INTERLOCKED_RESULT
+FASTCALL
+Exfi386InterlockedDecrementLong(
+ IN PLONG Addend);
+
+NTKERNELAPI
+ULONG
+FASTCALL
+Exfi386InterlockedExchangeUlong(
+ IN PULONG Target,
+ IN ULONG Value);
+
+#endif /* _X86_ */
+
typedef struct _CONTROLLER_OBJECT {
CSHORT Type;
CSHORT Size;
@@ -3661,34 +4010,6 @@
#endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
-/* Kernel Functions */
-
-#if (NTDDI_VERSION >= NTDDI_WIN2K)
-
-NTKERNELAPI
-DECLSPEC_NORETURN
-VOID
-NTAPI
-KeBugCheck(
- IN ULONG BugCheckCode);
-
-NTKERNELAPI
-LONG
-NTAPI
-KePulseEvent(
- IN OUT PRKEVENT Event,
- IN KPRIORITY Increment,
- IN BOOLEAN Wait);
-
-NTKERNELAPI
-LONG
-NTAPI
-KeSetBasePriorityThread(
- IN OUT PRKTHREAD Thread,
- IN LONG Increment);
-
-#endif
-
/* Memory Manager Types */
typedef struct _PHYSICAL_MEMORY_RANGE {