Move the declarations from winnt4.h, win2k.h and winxp.h into wdm.h or winddk and remove them. This wasn't in a good shape anyway, winxp.h was empty.

Implement a bunch of inline functions in wdm.h

svn path=/trunk/; revision=39539
This commit is contained in:
Timo Kreuzer 2009-02-10 21:57:25 +00:00
parent a72d06dd10
commit a3e9d29804
6 changed files with 995 additions and 920 deletions

View file

@ -50,17 +50,8 @@
typedef GUID UUID;
/* Windows Device Driver Kit */
#include "winddk.h"
/* Definitions only in Windows XP */
#include "winxp.h"
/* Definitions only in Windows 2000 */
#include "win2k.h"
/* Definitions only in Windows NT 4 */
#include "winnt4.h"
#endif /* _NTDDK_ */

View file

@ -822,6 +822,52 @@ typedef struct _QUOTA_LIMITS {
#define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
#define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
/******************************************************************************
* WINBASE Functions *
******************************************************************************/
#if !defined(_WINBASE_)
#if defined(_WIN64)
#define InterlockedPopEntrySList(Head) \
ExpInterlockedPopEntrySList(Head)
#define InterlockedPushEntrySList(Head, Entry) \
ExpInterlockedPushEntrySList(Head, Entry)
#define InterlockedFlushSList(Head) \
ExpInterlockedFlushSList(Head)
#define QueryDepthSList(Head) \
ExQueryDepthSList(Head)
#else // !defined(_WIN64)
NTKERNELAPI
PSLIST_ENTRY
FASTCALL
InterlockedPopEntrySList(
IN PSLIST_HEADER ListHead);
NTKERNELAPI
PSLIST_ENTRY
FASTCALL
InterlockedPushEntrySList(
IN PSLIST_HEADER ListHead,
IN PSLIST_ENTRY ListEntry);
#define InterlockedFlushSList(ListHead) \
ExInterlockedFlushSList(ListHead)
#define QueryDepthSList(Head) \
ExQueryDepthSList(Head)
#endif // !defined(_WIN64)
#endif // !defined(_WINBASE_)
/******************************************************************************
* Kernel Types *
******************************************************************************/
@ -1176,6 +1222,33 @@ RtlEqualUnicodeString(
IN CONST UNICODE_STRING *String2,
IN BOOLEAN CaseInSensitive);
#if !defined(_AMD64_) && !defined(_IA64_)
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedIntegerMultiply(
IN LARGE_INTEGER Multiplicand,
IN LONG Multiplier);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedLargeIntegerDivide(
IN LARGE_INTEGER Dividend,
IN ULONG Divisor,
IN OUT PULONG Remainder);
#endif
#if defined(_X86_) || defined(_IA64_)
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedMagicDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER MagicDivisor,
IN CCHAR ShiftCount);
#endif
NTSYSAPI
VOID
NTAPI
@ -1681,9 +1754,9 @@ LARGE_INTEGER
NTAPI_INLINE
RtlConvertLongToLargeInteger(LONG SignedInteger)
{
LARGE_INTEGER Result;
Result.QuadPart = SignedInteger;
return Result;
LARGE_INTEGER ret;
ret.QuadPart = SignedInteger;
return ret;
}
//DECLSPEC_DEPRECATED_DDK_WINXP
@ -1698,6 +1771,46 @@ RtlConvertUlongToLargeInteger(
return ret;
}
//DECLSPEC_DEPRECATED_DDK
static __inline
ULONG
NTAPI_INLINE
RtlEnlargedUnsignedDivide(
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN OUT PULONG Remainder)
{
if (Remainder)
*Remainder = Dividend.QuadPart % Divisor;
return Dividend.QuadPart / Divisor;
}
//DECLSPEC_DEPRECATED_DDK
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlEnlargedUnsignedMultiply(
IN ULONG Multiplicand,
IN ULONG Multiplier)
{
LARGE_INTEGER ret;
ret.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
return ret;
}
//DECLSPEC_DEPRECATED_DDK
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlEnlargedIntegerMultiply(
IN LONG Multiplicand,
IN LONG Multiplier)
{
LARGE_INTEGER ret;
ret.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
return ret;
}
FORCEINLINE
VOID
RtlInitEmptyAnsiString(OUT PANSI_STRING AnsiString,
@ -1721,7 +1834,7 @@ RtlInitEmptyUnicodeString(
UnicodeString->Buffer = Buffer;
}
#ifdef _M_AMD64
#if defined(_AMD64_) || defined(_IA64_)
static __inline
LARGE_INTEGER
NTAPI_INLINE
@ -1750,6 +1863,71 @@ RtlExtendedLargeIntegerDivide(
}
#endif
#if defined(_AMD64_)
//DECLSPEC_DEPRECATED_DDK
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlExtendedMagicDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER MagicDivisor,
IN CCHAR ShiftCount);
{
LARGE_INTEGER ret;
ULONG64 ret64;
BOOLEAN Pos;
Pos = (Dividend.QuadPart >= 0);
ret64 = UnsignedMultiplyHigh(Pos ? Dividend.QuadPart : -Dividend.QuadPart
MagicDivisor.QuadPart);
ret64 >>= ShiftCount;
ret.QuadPart = Pos ? ret64 : -ret64;
return ret;
}
#endif
//DECLSPEC_DEPRECATED_DDK
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlLargeIntegerAdd(
IN LARGE_INTEGER Addend1,
IN LARGE_INTEGER Addend2)
{
LARGE_INTEGER ret;
ret.QuadPart = Addend1.QuadPart + Addend2.QuadPart;
return ret;
}
/* VOID
* RtlLargeIntegerAnd(
* IN OUT LARGE_INTEGER Result,
* IN LARGE_INTEGER Source,
* IN LARGE_INTEGER Mask);
*/
#define RtlLargeIntegerAnd(Result, Source, Mask) \
Result.QuadPart = Source.QuadPart & Mask.QuadPart
//DECLSPEC_DEPRECATED_DDK
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlLargeIntegerArithmeticShift(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount)
{
LARGE_INTEGER ret;
ret.QuadPart = LargeInteger.QuadPart >> ShiftCount;
return ret;
}
/* BOOLEAN
* RtlLargeIntegerEqualTo(
* IN LARGE_INTEGER Operand1,
* IN LARGE_INTEGER Operand2);
*/
#define RtlLargeIntegerEqualTo(X,Y) \
(!(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)))
FORCEINLINE
PVOID
RtlSecureZeroMemory(
@ -1787,21 +1965,9 @@ RtlCheckBit(
//
// Byte Swap Functions
//
#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
((defined(_M_AMD64) || \
defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
unsigned short __cdecl _byteswap_ushort(unsigned short);
unsigned long __cdecl _byteswap_ulong (unsigned long);
unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64)
#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
#elif defined(__GNUC__) && (defined(_M_IX86) || defined(_M_AMD64))
#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037 || defined(__GNUC__))) || \
((defined(_M_AMD64) || defined(_M_IA64)) \
&& (_MSC_FULL_VER > 13009175 || defined(__GNUC__)))
#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
@ -1809,6 +1975,156 @@ unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
#endif
/******************************************************************************
* Memory manager Types *
******************************************************************************/
typedef struct _MDL {
struct _MDL *Next;
CSHORT Size;
CSHORT MdlFlags;
struct _EPROCESS *Process;
PVOID MappedSystemVa;
PVOID StartVa;
ULONG ByteCount;
ULONG ByteOffset;
} MDL, *PMDL;
/******************************************************************************
* Memory manager Functions *
******************************************************************************/
/* PVOID MmGetSystemAddressForMdl(
* IN PMDL Mdl);
*/
#define MmGetSystemAddressForMdl(Mdl) \
(((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
MDL_SOURCE_IS_NONPAGED_POOL)) ? \
((Mdl)->MappedSystemVa) : \
(MmMapLockedPages((Mdl), KernelMode)))
/* PVOID
* MmGetSystemAddressForMdlSafe(
* IN PMDL Mdl,
* IN MM_PAGE_PRIORITY Priority)
*/
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
(((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
| MDL_SOURCE_IS_NONPAGED_POOL)) ? \
(_Mdl)->MappedSystemVa : \
(PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
KernelMode, MmCached, NULL, FALSE, (_Priority)))
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTKERNELAPI
PMDL
NTAPI
MmCreateMdl(
IN PMDL MemoryDescriptorList OPTIONAL,
IN PVOID Base,
IN SIZE_T Length);
#endif
/******************************************************************************
* I/O Manager Functions *
******************************************************************************/
#if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && \
(defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
#define DMA_MACROS_DEFINED
FORCEINLINE
NTSTATUS
IoAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context)
{
PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
AllocateAdapterChannel =
*(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
ASSERT(AllocateAdapterChannel);
return AllocateAdapterChannel(DmaAdapter,
DeviceObject,
NumberOfMapRegisters,
ExecutionRoutine,
Context );
}
FORCEINLINE
BOOLEAN
IoFlushAdapterBuffers(
IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice)
{
PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
FlushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
ASSERT(FlushAdapterBuffers);
return FlushAdapterBuffers(DmaAdapter,
Mdl,
MapRegisterBase,
CurrentVa,
Length,
WriteToDevice );
}
FORCEINLINE
VOID
IoFreeAdapterChannel(
IN PADAPTER_OBJECT AdapterObject)
{
PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
FreeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
ASSERT(FreeAdapterChannel);
FreeAdapterChannel(DmaAdapter);
}
FORCEINLINE
VOID
IoFreeMapRegisters(
IN PADAPTER_OBJECT AdapterObject,
IN PVOID MapRegisterBase,
IN ULONG NumberOfMapRegisters)
{
PFREE_MAP_REGISTERS FreeMapRegisters;
FreeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
ASSERT(FreeMapRegisters);
FreeMapRegisters(DmaAdapter, MapRegisterBase, NumberOfMapRegisters);
}
FORCEINLINE
PHYSICAL_ADDRESS
IoMapTransfer(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice)
{
PMAP_TRANSFER MapTransfer;
MapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
ASSERT(MapTransfer);
return MapTransfer(DmaAdapter,
Mdl,
MapRegisterBase,
CurrentVa,
Length,
WriteToDevice);
}
#endif
/******************************************************************************
* Executive Types *
@ -1997,6 +2313,23 @@ typedef struct _EX_RUNDOWN_REF {
};
} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
typedef enum _WORK_QUEUE_TYPE {
CriticalWorkQueue,
DelayedWorkQueue,
HyperCriticalWorkQueue,
MaximumWorkQueue
} WORK_QUEUE_TYPE;
typedef VOID
(DDKAPI *PWORKER_THREAD_ROUTINE)(
IN PVOID Parameter);
typedef struct _WORK_QUEUE_ITEM {
LIST_ENTRY List;
PWORKER_THREAD_ROUTINE WorkerRoutine;
volatile PVOID Parameter;
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
/******************************************************************************
* Executive Functions *
@ -2097,6 +2430,19 @@ ExInterlockedPushEntrySList(
#define ExReleaseResource(R) (ExReleaseResourceLite(R))
/* VOID
* ExInitializeWorkItem(
* IN PWORK_QUEUE_ITEM Item,
* IN PWORKER_THREAD_ROUTINE Routine,
* IN PVOID Context)
*/
#define ExInitializeWorkItem(Item, Routine, Context) \
{ \
(Item)->WorkerRoutine = Routine; \
(Item)->Parameter = Context; \
(Item)->List.Flink = NULL; \
}
#if (NTDDI_VERSION >= NTDDI_WIN2K)
NTKERNELAPI
@ -2415,6 +2761,13 @@ ExNotifyCallback(
IN PVOID Argument1,
IN PVOID Argument2);
NTKERNELAPI
VOID
NTAPI
ExQueueWorkItem(
IN PWORK_QUEUE_ITEM WorkItem,
IN WORK_QUEUE_TYPE QueueType);
NTKERNELAPI
DECLSPEC_NORETURN
VOID
@ -2572,49 +2925,73 @@ ExInitializeLookasideListEx(
#endif
/******************************************************************************
* WINBASE Functions *
******************************************************************************/
#if !defined(_WINBASE_)
#if !defined(MIDL_PASS)
#if defined(_WIN64)
static __inline PVOID
ExAllocateFromNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside)
{
PVOID Entry;
#define InterlockedPopEntrySList(Head) \
ExpInterlockedPopEntrySList(Head)
Lookaside->L.TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
if (Entry == NULL) {
Lookaside->L.AllocateMisses++;
Entry = (Lookaside->L.Allocate)(Lookaside->L.Type,
Lookaside->L.Size,
Lookaside->L.Tag);
}
return Entry;
}
#define InterlockedPushEntrySList(Head, Entry) \
ExpInterlockedPushEntrySList(Head, Entry)
static __inline PVOID
ExAllocateFromPagedLookasideList(
IN PPAGED_LOOKASIDE_LIST Lookaside)
{
PVOID Entry;
#define InterlockedFlushSList(Head) \
ExpInterlockedFlushSList(Head)
Lookaside->L.TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
if (Entry == NULL) {
Lookaside->L.AllocateMisses++;
Entry = (Lookaside->L.Allocate)(Lookaside->L.Type,
Lookaside->L.Size,
Lookaside->L.Tag);
}
return Entry;
}
#define QueryDepthSList(Head) \
ExQueryDepthSList(Head)
static __inline VOID
ExFreeToNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside,
IN PVOID Entry)
{
Lookaside->L.TotalFrees++;
if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
Lookaside->L.FreeMisses++;
(Lookaside->L.Free)(Entry);
} else {
InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry);
}
}
#else // !defined(_WIN64)
static __inline VOID
ExFreeToPagedLookasideList(
IN PPAGED_LOOKASIDE_LIST Lookaside,
IN PVOID Entry)
{
Lookaside->L.TotalFrees++;
if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
Lookaside->L.FreeMisses++;
(Lookaside->L.Free)(Entry);
} else {
InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry);
}
}
NTKERNELAPI
PSLIST_ENTRY
FASTCALL
InterlockedPopEntrySList(
IN PSLIST_HEADER ListHead);
NTKERNELAPI
PSLIST_ENTRY
FASTCALL
InterlockedPushEntrySList(
IN PSLIST_HEADER ListHead,
IN PSLIST_ENTRY ListEntry);
#endif // !defined(MIDL_PASS)
#define InterlockedFlushSList(ListHead) \
ExInterlockedFlushSList(ListHead)
#define QueryDepthSList(Head) \
ExQueryDepthSList(Head)
#endif // !defined(_WIN64)
#endif // !defined(_WINBASE_)
#ifdef __cplusplus
}

View file

@ -1,100 +0,0 @@
/*
* win2k.h
*
* Definitions only used in Windows 2000 and earlier versions
*
* This file is part of the w32api package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __WIN2K_H
#define __WIN2K_H
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push,4)
typedef enum _BUS_DATA_TYPE {
ConfigurationSpaceUndefined = -1,
Cmos,
EisaConfiguration,
Pos,
CbusConfiguration,
PCIConfiguration,
VMEConfiguration,
NuBusConfiguration,
PCMCIAConfiguration,
MPIConfiguration,
MPSAConfiguration,
PNPISAConfiguration,
SgiInternalConfiguration,
MaximumBusDataType
} BUS_DATA_TYPE, *PBUS_DATA_TYPE;
#pragma pack(pop)
NTKERNELAPI
VOID
DDKAPI
ExReleaseResourceForThreadLite(
IN PERESOURCE Resource,
IN ERESOURCE_THREAD ResourceThreadId);
NTKERNELAPI
NTSTATUS
FASTCALL
IoReadPartitionTable(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions,
OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
NTKERNELAPI
NTSTATUS
FASTCALL
IoSetPartitionInformation(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType);
NTKERNELAPI
NTSTATUS
FASTCALL
IoWritePartitionTable(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads,
IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
/*
* PVOID MmGetSystemAddressForMdl(
* IN PMDL Mdl);
*/
#define MmGetSystemAddressForMdl(Mdl) \
(((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
MDL_SOURCE_IS_NONPAGED_POOL)) ? \
((Mdl)->MappedSystemVa) : \
(MmMapLockedPages((Mdl), KernelMode)))
#ifdef __cplusplus
}
#endif
#endif /* __WIN2K_H */

View file

@ -2299,17 +2299,6 @@ typedef struct _SCATTER_GATHER_LIST {
SCATTER_GATHER_ELEMENT Elements[1];
} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
typedef struct _MDL {
struct _MDL *Next;
CSHORT Size;
CSHORT MdlFlags;
struct _EPROCESS *Process;
PVOID MappedSystemVa;
PVOID StartVa;
ULONG ByteCount;
ULONG ByteOffset;
} MDL, *PMDL;
#define MDL_MAPPED_TO_SYSTEM_VA 0x0001
#define MDL_PAGES_LOCKED 0x0002
#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
@ -4579,23 +4568,6 @@ typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
IoQueryDeviceMaxData
} IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
typedef enum _WORK_QUEUE_TYPE {
CriticalWorkQueue,
DelayedWorkQueue,
HyperCriticalWorkQueue,
MaximumWorkQueue
} WORK_QUEUE_TYPE;
typedef VOID
(DDKAPI *PWORKER_THREAD_ROUTINE)(
IN PVOID Parameter);
typedef struct _WORK_QUEUE_ITEM {
LIST_ENTRY List;
PWORKER_THREAD_ROUTINE WorkerRoutine;
volatile PVOID Parameter;
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
typedef enum _KBUGCHECK_CALLBACK_REASON {
KbCallbackInvalid,
KbCallbackReserved1,
@ -4747,6 +4719,25 @@ typedef VOID
IN HANDLE ProcessId,
IN PIMAGE_INFO ImageInfo);
#pragma pack(push,4)
typedef enum _BUS_DATA_TYPE {
ConfigurationSpaceUndefined = -1,
Cmos,
EisaConfiguration,
Pos,
CbusConfiguration,
PCIConfiguration,
VMEConfiguration,
NuBusConfiguration,
PCMCIAConfiguration,
MPIConfiguration,
MPSAConfiguration,
PNPISAConfiguration,
SgiInternalConfiguration,
MaximumBusDataType
} BUS_DATA_TYPE, *PBUS_DATA_TYPE;
#pragma pack(pop)
typedef struct _NT_TIB {
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
PVOID StackBase;
@ -6281,68 +6272,6 @@ KeTryToAcquireGuardedMutex(
KeInitializeEvent(&(_FastMutex)->Gate, SynchronizationEvent, FALSE); \
}
/** Executive support routines **/
static __inline PVOID
ExAllocateFromNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside)
{
PVOID Entry;
Lookaside->L.TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
if (Entry == NULL) {
Lookaside->L.AllocateMisses++;
Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag);
}
return Entry;
}
static __inline PVOID
ExAllocateFromPagedLookasideList(
IN PPAGED_LOOKASIDE_LIST Lookaside)
{
PVOID Entry;
Lookaside->L.TotalAllocates++;
Entry = InterlockedPopEntrySList(&Lookaside->L.ListHead);
if (Entry == NULL) {
Lookaside->L.AllocateMisses++;
Entry = (Lookaside->L.Allocate)(Lookaside->L.Type, Lookaside->L.Size, Lookaside->L.Tag);
}
return Entry;
}
#define PROTECTED_POOL 0x80000000
static __inline VOID
ExFreeToNPagedLookasideList(
IN PNPAGED_LOOKASIDE_LIST Lookaside,
IN PVOID Entry)
{
Lookaside->L.TotalFrees++;
if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
Lookaside->L.FreeMisses++;
(Lookaside->L.Free)(Entry);
} else {
InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry);
}
}
static __inline VOID
ExFreeToPagedLookasideList(
IN PPAGED_LOOKASIDE_LIST Lookaside,
IN PVOID Entry)
{
Lookaside->L.TotalFrees++;
if (ExQueryDepthSList(&Lookaside->L.ListHead) >= Lookaside->L.Depth) {
Lookaside->L.FreeMisses++;
(Lookaside->L.Free)(Entry);
} else {
InterlockedPushEntrySList(&Lookaside->L.ListHead, (PSLIST_ENTRY)Entry);
}
}
NTKERNELAPI
VOID
NTAPI
@ -6351,6 +6280,91 @@ KeInitializeEvent(
IN EVENT_TYPE Type,
IN BOOLEAN State);
/******************************************************************************
* Executive Types *
******************************************************************************/
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;
#define PROTECTED_POOL 0x80000000
/******************************************************************************
* Executive Functions *
******************************************************************************/
NTKERNELAPI
NTSTATUS
NTAPI
ExExtendZone(
IN PZONE_HEADER Zone,
IN PVOID Segment,
IN ULONG SegmentSize);
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;
}
NTKERNELAPI
NTSTATUS
NTAPI
ExInitializeZone(
IN PZONE_HEADER Zone,
IN ULONG BlockSize,
IN PVOID InitialSegment,
IN ULONG InitialSegmentSize);
/*
* PVOID
* ExInterlockedAllocateFromZone(
* IN PZONE_HEADER Zone,
* IN PKSPIN_LOCK Lock)
*/
#define ExInterlockedAllocateFromZone(Zone, Lock) \
((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
NTKERNELAPI
NTSTATUS
NTAPI
ExInterlockedExtendZone(
IN PZONE_HEADER Zone,
IN PVOID Segment,
IN ULONG SegmentSize,
IN PKSPIN_LOCK 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)
/*
* VOID
* InitializeSListHead(
@ -6361,6 +6375,24 @@ KeInitializeEvent(
#define ExInitializeSListHead InitializeSListHead
/*
* 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)) )
NTKERNELAPI
DECLSPEC_NORETURN
VOID
@ -6381,6 +6413,17 @@ NTAPI
ExUuidCreate(
OUT UUID *Uuid);
#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
#ifdef DBG
#define PAGED_CODE() { \
@ -6465,16 +6508,6 @@ HalPutDmaAdapter(
PADAPTER_OBJECT AdapterObject
);
NTKERNELAPI
NTSTATUS
NTAPI
IoAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context
);
/** Io access routines **/
@ -6938,6 +6971,18 @@ IoAcquireRemoveLockEx(
} \
}
#ifndef DMA_MACROS_DEFINED
NTKERNELAPI
NTSTATUS
NTAPI
IoAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context);
#endif
NTKERNELAPI
VOID
NTAPI
@ -7655,6 +7700,15 @@ IoReadDiskSignature(
IN ULONG BytesPerSector,
OUT PDISK_SIGNATURE Signature);
NTKERNELAPI
NTSTATUS
FASTCALL
IoReadPartitionTable(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN BOOLEAN ReturnRecognizedPartitions,
OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
NTKERNELAPI
NTSTATUS
NTAPI
@ -7917,6 +7971,15 @@ IoSetHardErrorOrVerifyDevice(
(_Irp)->Tail.Overlay.CurrentStackLocation--; \
}
NTKERNELAPI
NTSTATUS
FASTCALL
IoSetPartitionInformation(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG PartitionNumber,
IN ULONG PartitionType);
NTKERNELAPI
NTSTATUS
NTAPI
@ -8184,6 +8247,16 @@ NTAPI
IoWriteErrorLogEntry(
IN PVOID ElEntry);
NTKERNELAPI
NTSTATUS
FASTCALL
IoWritePartitionTable(
IN PDEVICE_OBJECT DeviceObject,
IN ULONG SectorSize,
IN ULONG SectorsPerTrack,
IN ULONG NumberOfHeads,
IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
NTKERNELAPI
NTSTATUS
NTAPI
@ -9076,19 +9149,6 @@ MmMarkPhysicalMemoryAsGood(
IN PPHYSICAL_ADDRESS StartAddress,
IN OUT PLARGE_INTEGER NumberOfBytes);
/*
* PVOID
* MmGetSystemAddressForMdlSafe(
* IN PMDL Mdl,
* IN MM_PAGE_PRIORITY Priority)
*/
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
(((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
| MDL_SOURCE_IS_NONPAGED_POOL)) ? \
(_Mdl)->MappedSystemVa : \
(PVOID) MmMapLockedPagesSpecifyCache((_Mdl), \
KernelMode, MmCached, NULL, FALSE, (_Priority)))
NTKERNELAPI
PVOID
NTAPI
@ -10390,6 +10450,398 @@ extern BOOLEAN KdDebuggerEnabled;
#endif
/** Stuff from winnt4.h */
#ifndef DMA_MACROS_DEFINED
#if (NTDDI_VERSION >= NTDDI_WIN2K)
//DECLSPEC_DEPRECATED_DDK
NTKERNELAPI
BOOLEAN
NTAPI
IoFlushAdapterBuffers(
IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice);
//DECLSPEC_DEPRECATED_DDK
NTKERNELAPI
VOID
NTAPI
IoFreeAdapterChannel(
IN PADAPTER_OBJECT AdapterObject);
//DECLSPEC_DEPRECATED_DDK
NTKERNELAPI
VOID
NTAPI
IoFreeMapRegisters(
IN PADAPTER_OBJECT AdapterObject,
IN PVOID MapRegisterBase,
IN ULONG NumberOfMapRegisters);
//DECLSPEC_DEPRECATED_DDK
NTKERNELAPI
PHYSICAL_ADDRESS
NTAPI
IoMapTransfer(
IN PDMA_ADAPTER DmaAdapter,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice);
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
#endif // !defined(DMA_MACROS_DEFINED)
NTKERNELAPI
NTSTATUS
NTAPI
IoAssignResources(
IN PUNICODE_STRING RegistryPath,
IN PUNICODE_STRING DriverClassName OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
IN OUT PCM_RESOURCE_LIST *AllocatedResources);
NTKERNELAPI
NTSTATUS
NTAPI
IoAttachDeviceByPointer(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice);
NTKERNELAPI
BOOLEAN
NTAPI
MmIsNonPagedSystemAddressValid(
IN PVOID VirtualAddress);
#if defined(_AMD64_) || defined(_IA64_)
//DECLSPEC_DEPRECATED_DDK_WINXP
static __inline
LARGE_INTEGER
NTAPI_INLINE
RtlLargeIntegerDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER Divisor,
IN OUT PLARGE_INTEGER Remainder)
{
LARGE_INTEGER ret;
ret.QuadPart = Dividend.QuadPart / Divisor.QuadPart;
if (Remainder)
Remainder->QuadPart = Dividend.QuadPart % Divisor.QuadPart;
return ret;
}
#else
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER Divisor,
IN OUT PLARGE_INTEGER Remainder);
#endif
NTKERNELAPI
INTERLOCKED_RESULT
NTAPI
ExInterlockedDecrementLong(
IN PLONG Addend,
IN PKSPIN_LOCK Lock);
NTKERNELAPI
ULONG
NTAPI
ExInterlockedExchangeUlong(
IN PULONG Target,
IN ULONG Value,
IN PKSPIN_LOCK Lock);
NTKERNELAPI
INTERLOCKED_RESULT
NTAPI
ExInterlockedIncrementLong(
IN PLONG Addend,
IN PKSPIN_LOCK Lock);
NTHALAPI
VOID
NTAPI
HalAcquireDisplayOwnership(
IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
NTHALAPI
NTSTATUS
NTAPI
HalAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PWAIT_CONTEXT_BLOCK Wcb,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine);
NTHALAPI
PVOID
NTAPI
HalAllocateCommonBuffer(
IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled);
NTHALAPI
NTSTATUS
NTAPI
HalAssignSlotResources(
IN PUNICODE_STRING RegistryPath,
IN PUNICODE_STRING DriverClassName,
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT DeviceObject,
IN INTERFACE_TYPE BusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN OUT PCM_RESOURCE_LIST *AllocatedResources);
NTHALAPI
VOID
NTAPI
HalFreeCommonBuffer(
IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled);
NTHALAPI
PADAPTER_OBJECT
NTAPI
HalGetAdapter(
IN PDEVICE_DESCRIPTION DeviceDescription,
IN OUT PULONG NumberOfMapRegisters);
NTHALAPI
ULONG
NTAPI
HalGetBusData(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalGetBusDataByOffset(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalGetDmaAlignmentRequirement(
VOID);
NTHALAPI
ULONG
NTAPI
HalGetInterruptVector(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN ULONG BusInterruptLevel,
IN ULONG BusInterruptVector,
OUT PKIRQL Irql,
OUT PKAFFINITY Affinity);
NTHALAPI
ULONG
NTAPI
HalReadDmaCounter(
IN PADAPTER_OBJECT AdapterObject);
NTHALAPI
ULONG
NTAPI
HalSetBusData(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalSetBusDataByOffset(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length);
NTHALAPI
BOOLEAN
NTAPI
HalTranslateBusAddress(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterOrEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThan(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThanOrEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThanZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessOrEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThan(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThanOrEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThanZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerNegate(
IN LARGE_INTEGER Subtrahend);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerNotEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerNotEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerShiftLeft(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerShiftRight(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerSubtract(
IN LARGE_INTEGER Minuend,
IN LARGE_INTEGER Subtrahend);
/*
* ULONG
* COMPUTE_PAGES_SPANNED(
* IN PVOID Va,
* IN ULONG Size)
*/
#define COMPUTE_PAGES_SPANNED(Va, \
Size) \
(ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
/*
** Architecture specific structures
*/
#ifdef _X86_
NTKERNELAPI
INTERLOCKED_RESULT
FASTCALL
Exfi386InterlockedIncrementLong(
IN PLONG Addend);
NTKERNELAPI
INTERLOCKED_RESULT
FASTCALL
Exfi386InterlockedDecrementLong(
IN PLONG Addend);
NTKERNELAPI
ULONG
FASTCALL
Exfi386InterlockedExchangeUlong(
IN PULONG Target,
IN ULONG Value);
#define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
#define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
#define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
#endif /* _X86_ */
#ifdef __cplusplus
}
#endif

View file

@ -1,611 +0,0 @@
/*
* winnt4.h
*
* Definitions only used in Windows NT 4.0 and earlier versions
*
* This file is part of the w32api package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __WINNT4_H
#define __WINNT4_H
#ifdef __cplusplus
extern "C" {
#endif
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;
static __inline PVOID
ExAllocateFromZone(
IN PZONE_HEADER Zone)
{
if (Zone->FreeList.Next)
Zone->FreeList.Next = Zone->FreeList.Next->Next;
return (PVOID) Zone->FreeList.Next;
}
NTKERNELAPI
NTSTATUS
NTAPI
ExExtendZone(
IN PZONE_HEADER Zone,
IN PVOID Segment,
IN ULONG SegmentSize);
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;
}
NTKERNELAPI
NTSTATUS
NTAPI
ExInitializeZone(
IN PZONE_HEADER Zone,
IN ULONG BlockSize,
IN PVOID InitialSegment,
IN ULONG InitialSegmentSize);
/*
* PVOID
* ExInterlockedAllocateFromZone(
* IN PZONE_HEADER Zone,
* IN PKSPIN_LOCK Lock)
*/
#define ExInterlockedAllocateFromZone(Zone, \
Lock) \
((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
NTKERNELAPI
NTSTATUS
NTAPI
ExInterlockedExtendZone(
IN PZONE_HEADER Zone,
IN PVOID Segment,
IN ULONG SegmentSize,
IN PKSPIN_LOCK Lock);
NTKERNELAPI
PVOID
NTAPI
ExInterlockedFreeToZone(
IN PZONE_HEADER Zone,
IN PVOID Block,
IN PKSPIN_LOCK Lock);
/*
* VOID
* ExInitializeWorkItem(
* IN PWORK_QUEUE_ITEM Item,
* IN PWORKER_THREAD_ROUTINE Routine,
* IN PVOID Context)
*/
#define ExInitializeWorkItem(Item, \
Routine, \
Context) \
{ \
(Item)->WorkerRoutine = Routine; \
(Item)->Parameter = Context; \
(Item)->List.Flink = NULL; \
}
/*
* BOOLEAN
* ExIsFullZone(
* IN PZONE_HEADER Zone)
*/
#define ExIsFullZone(Zone) \
((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
NTKERNELAPI
VOID
NTAPI
ExQueueWorkItem(
IN PWORK_QUEUE_ITEM WorkItem,
IN WORK_QUEUE_TYPE QueueType);
NTKERNELAPI
BOOLEAN
NTAPI
ExIsObjectInFirstZoneSegment(
IN PZONE_HEADER Zone,
IN PVOID Object);
#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
NTKERNELAPI
INTERLOCKED_RESULT
NTAPI
ExInterlockedDecrementLong(
IN PLONG Addend,
IN PKSPIN_LOCK Lock);
NTKERNELAPI
ULONG
NTAPI
ExInterlockedExchangeUlong(
IN PULONG Target,
IN ULONG Value,
IN PKSPIN_LOCK Lock);
NTKERNELAPI
INTERLOCKED_RESULT
NTAPI
ExInterlockedIncrementLong(
IN PLONG Addend,
IN PKSPIN_LOCK Lock);
NTHALAPI
VOID
NTAPI
HalAcquireDisplayOwnership(
IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
NTHALAPI
NTSTATUS
NTAPI
HalAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PWAIT_CONTEXT_BLOCK Wcb,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine);
NTHALAPI
PVOID
NTAPI
HalAllocateCommonBuffer(
IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled);
NTHALAPI
NTSTATUS
NTAPI
HalAssignSlotResources(
IN PUNICODE_STRING RegistryPath,
IN PUNICODE_STRING DriverClassName,
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT DeviceObject,
IN INTERFACE_TYPE BusType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN OUT PCM_RESOURCE_LIST *AllocatedResources);
NTHALAPI
VOID
NTAPI
HalFreeCommonBuffer(
IN PADAPTER_OBJECT AdapterObject,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled);
NTHALAPI
PADAPTER_OBJECT
NTAPI
HalGetAdapter(
IN PDEVICE_DESCRIPTION DeviceDescription,
IN OUT PULONG NumberOfMapRegisters);
NTHALAPI
ULONG
NTAPI
HalGetBusData(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalGetBusDataByOffset(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalGetDmaAlignmentRequirement(
VOID);
NTHALAPI
ULONG
NTAPI
HalGetInterruptVector(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN ULONG BusInterruptLevel,
IN ULONG BusInterruptVector,
OUT PKIRQL Irql,
OUT PKAFFINITY Affinity);
NTHALAPI
ULONG
NTAPI
HalReadDmaCounter(
IN PADAPTER_OBJECT AdapterObject);
NTHALAPI
ULONG
NTAPI
HalSetBusData(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Length);
NTHALAPI
ULONG
NTAPI
HalSetBusDataByOffset(
IN BUS_DATA_TYPE BusDataType,
IN ULONG BusNumber,
IN ULONG SlotNumber,
IN PVOID Buffer,
IN ULONG Offset,
IN ULONG Length);
NTHALAPI
BOOLEAN
NTAPI
HalTranslateBusAddress(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress);
NTKERNELAPI
NTSTATUS
NTAPI
IoAllocateAdapterChannel(
IN PADAPTER_OBJECT AdapterObject,
IN PDEVICE_OBJECT DeviceObject,
IN ULONG NumberOfMapRegisters,
IN PDRIVER_CONTROL ExecutionRoutine,
IN PVOID Context);
NTKERNELAPI
NTSTATUS
NTAPI
IoAssignResources(
IN PUNICODE_STRING RegistryPath,
IN PUNICODE_STRING DriverClassName OPTIONAL,
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT DeviceObject OPTIONAL,
IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
IN OUT PCM_RESOURCE_LIST *AllocatedResources);
NTKERNELAPI
NTSTATUS
NTAPI
IoAttachDeviceByPointer(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice);
NTHALAPI
BOOLEAN
NTAPI
IoFlushAdapterBuffers(
IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN ULONG Length,
IN BOOLEAN WriteToDevice);
NTHALAPI
VOID
NTAPI
IoFreeAdapterChannel(
IN PADAPTER_OBJECT AdapterObject);
NTHALAPI
VOID
NTAPI
IoFreeMapRegisters(
IN PADAPTER_OBJECT AdapterObject,
IN PVOID MapRegisterBase,
IN ULONG NumberOfMapRegisters);
NTHALAPI
PHYSICAL_ADDRESS
NTAPI
IoMapTransfer(
IN PADAPTER_OBJECT AdapterObject,
IN PMDL Mdl,
IN PVOID MapRegisterBase,
IN PVOID CurrentVa,
IN OUT PULONG Length,
IN BOOLEAN WriteToDevice);
NTKERNELAPI
PMDL
NTAPI
MmCreateMdl(
IN PMDL MemoryDescriptorList OPTIONAL,
IN PVOID Base,
IN SIZE_T Length);
NTKERNELAPI
BOOLEAN
NTAPI
MmIsNonPagedSystemAddressValid(
IN PVOID VirtualAddress);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlEnlargedIntegerMultiply(
IN LONG Multiplicand,
IN LONG Multiplier);
NTSYSAPI
ULONG
NTAPI
RtlEnlargedUnsignedDivide(
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN OUT PULONG Remainder);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlEnlargedUnsignedMultiply(
IN ULONG Multiplicand,
IN ULONG Multiplier);
#ifndef _M_AMD64
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedIntegerMultiply(
IN LARGE_INTEGER Multiplicand,
IN LONG Multiplier);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedLargeIntegerDivide(
IN LARGE_INTEGER Dividend,
IN ULONG Divisor,
IN OUT PULONG Remainder);
#endif
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlExtendedMagicDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER MagicDivisor,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerAdd(
IN LARGE_INTEGER Addend1,
IN LARGE_INTEGER Addend2);
NTSYSAPI
VOID
NTAPI
RtlLargeIntegerAnd(
IN OUT LARGE_INTEGER Result,
IN LARGE_INTEGER Source,
IN LARGE_INTEGER Mask);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerArithmeticShift(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerDivide(
IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER Divisor,
IN OUT PLARGE_INTEGER Remainder);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterOrEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThan(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThanOrEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerGreaterThanZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessOrEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThan(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThanOrEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerLessThanZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerNegate(
IN LARGE_INTEGER Subtrahend);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerNotEqualTo(
IN LARGE_INTEGER Operand1,
IN LARGE_INTEGER Operand2);
NTSYSAPI
BOOLEAN
NTAPI
RtlLargeIntegerNotEqualToZero(
IN LARGE_INTEGER Operand);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerShiftLeft(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerShiftRight(
IN LARGE_INTEGER LargeInteger,
IN CCHAR ShiftCount);
NTSYSAPI
LARGE_INTEGER
NTAPI
RtlLargeIntegerSubtract(
IN LARGE_INTEGER Minuend,
IN LARGE_INTEGER Subtrahend);
/*
* ULONG
* COMPUTE_PAGES_SPANNED(
* IN PVOID Va,
* IN ULONG Size)
*/
#define COMPUTE_PAGES_SPANNED(Va, \
Size) \
(ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size))
/*
** Architecture specific structures
*/
#ifdef _X86_
NTKERNELAPI
INTERLOCKED_RESULT
FASTCALL
Exfi386InterlockedIncrementLong(
IN PLONG Addend);
NTKERNELAPI
INTERLOCKED_RESULT
FASTCALL
Exfi386InterlockedDecrementLong(
IN PLONG Addend);
NTKERNELAPI
ULONG
FASTCALL
Exfi386InterlockedExchangeUlong(
IN PULONG Target,
IN ULONG Value);
#define ExInterlockedIncrementLong(Addend,Lock) Exfi386InterlockedIncrementLong(Addend)
#define ExInterlockedDecrementLong(Addend,Lock) Exfi386InterlockedDecrementLong(Addend)
#define ExInterlockedExchangeUlong(Target, Value, Lock) Exfi386InterlockedExchangeUlong(Target, Value)
#endif /* _X86_ */
#ifdef __cplusplus
}
#endif
#endif /* __WINNT4_H */

View file

@ -1,34 +0,0 @@
/*
* winxp.h
*
* Definitions only used in Windows XP and earlier versions
*
* This file is part of the w32api package.
*
* Contributors:
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __WINXP_H
#define __WINXP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* __WINXP_H */