[NTDDK]
authorAmine Khaldi <amine.khaldi@reactos.org>
Wed, 17 Mar 2010 00:01:55 +0000 (00:01 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Wed, 17 Mar 2010 00:01:55 +0000 (00:01 +0000)
- Group related definitions
- Add several missing Mm* and Se*

svn path=/branches/header-work/; revision=46235

include/ddk/ntddk.h

index da2d215..43e104a 100644 (file)
@@ -2220,14 +2220,6 @@ typedef VOID
 (NTAPI *PEXPAND_STACK_CALLOUT) (
   IN PVOID Parameter OPTIONAL);
 
-
-
-
-
-
-
-
-
 /* Kernel Functions */
 
 #if (NTDDI_VERSION >= NTDDI_WIN2K) && defined(SINGLE_GROUP_LEGACY_API)
@@ -2433,6 +2425,377 @@ KeInvalidateRangeAllCaches(
   IN PVOID BaseAddress,
   IN ULONG Length);
 
+typedef GUID UUID;
+
+/* 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;
+
+#if defined(POOL_TAGGING)
+#define ExFreePool(a) ExFreePoolWithTag(a,0)
+#endif
+
+#define PROTECTED_POOL                    0x80000000
+
+/* 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 /* (NTDDI_VERSION >= NTDDI_WIN2K) */
+
+/* Memory Manager Types */
+
+typedef struct _PHYSICAL_MEMORY_RANGE {
+  PHYSICAL_ADDRESS BaseAddress;
+  LARGE_INTEGER NumberOfBytes;
+} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
+
+typedef NTSTATUS
+(*PMM_ROTATE_COPY_CALLBACK_FUNCTION) (
+  IN PMDL DestinationMdl,
+  IN PMDL SourceMdl,
+  IN PVOID Context);
+
+typedef enum _MM_ROTATE_DIRECTION {
+  MmToFrameBuffer,
+  MmToFrameBufferNoCopy,
+  MmToRegularMemory,
+  MmToRegularMemoryNoCopy,
+  MmMaximumRotateDirection
+} MM_ROTATE_DIRECTION, *PMM_ROTATE_DIRECTION;
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+typedef ULONG NODE_REQUIREMENT;
+#define MM_ANY_NODE_OK          0x80000000
+#endif
+
+/* Memory Manager Functions */
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+
+NTKERNELAPI
+PPHYSICAL_MEMORY_RANGE
+NTAPI
+MmGetPhysicalMemoryRanges(VOID);
+
+NTKERNELAPI
+PHYSICAL_ADDRESS
+NTAPI
+MmGetPhysicalAddress(
+  IN PVOID BaseAddress);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmIsNonPagedSystemAddressValid(
+  IN PVOID VirtualAddress);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmAllocateNonCachedMemory(
+  IN SIZE_T NumberOfBytes);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmFreeNonCachedMemory(
+  IN PVOID BaseAddress,
+  IN SIZE_T NumberOfBytes);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmGetVirtualForPhysical(
+  IN PHYSICAL_ADDRESS PhysicalAddress);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmMapUserAddressesToPage(
+  IN PVOID BaseAddress,
+  IN SIZE_T NumberOfBytes,
+  IN PVOID PageAddress);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmMapVideoDisplay(
+  IN PHYSICAL_ADDRESS PhysicalAddress,
+  IN SIZE_T NumberOfBytes,
+  IN MEMORY_CACHING_TYPE CacheType);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmMapViewInSessionSpace(
+  IN PVOID Section,
+  OUT PVOID *MappedBase,
+  IN OUT PSIZE_T ViewSize);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmMapViewInSystemSpace(
+  IN PVOID Section,
+  OUT PVOID *MappedBase,
+  IN OUT PSIZE_T ViewSize);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmIsAddressValid(
+  IN PVOID VirtualAddress);
+
+NTKERNELAPI
+BOOLEAN
+NTAPI
+MmIsThisAnNtAsSystem(VOID);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmLockPagableSectionByHandle(
+  IN PVOID ImageSectionHandle);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmUnmapViewInSessionSpace(
+  IN PVOID MappedBase);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmUnmapViewInSystemSpace(
+  IN PVOID MappedBase);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmUnsecureVirtualMemory(
+  IN HANDLE SecureHandle);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmRemovePhysicalMemory(
+  IN PPHYSICAL_ADDRESS StartAddress,
+  IN OUT PLARGE_INTEGER NumberOfBytes);
+
+NTKERNELAPI
+HANDLE
+NTAPI
+MmSecureVirtualMemory(
+  IN PVOID Address,
+  IN SIZE_T Size,
+  IN ULONG ProbeMode);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmUnmapVideoDisplay(
+  IN PVOID BaseAddress,
+  IN SIZE_T NumberOfBytes);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmAddPhysicalMemory(
+  IN PPHYSICAL_ADDRESS StartAddress,
+  IN OUT PLARGE_INTEGER NumberOfBytes);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmAllocateContiguousMemory(
+  IN SIZE_T NumberOfBytes,
+  IN PHYSICAL_ADDRESS HighestAcceptableAddress);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmAllocateContiguousMemorySpecifyCache(
+  IN SIZE_T NumberOfBytes,
+  IN PHYSICAL_ADDRESS LowestAcceptableAddress,
+  IN PHYSICAL_ADDRESS HighestAcceptableAddress,
+  IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
+  IN MEMORY_CACHING_TYPE CacheType);
+
+NTKERNELAPI
+PVOID
+NTAPI
+MmAllocateContiguousMemorySpecifyCacheNode(
+  IN SIZE_T NumberOfBytes,
+  IN PHYSICAL_ADDRESS LowestAcceptableAddress,
+  IN PHYSICAL_ADDRESS HighestAcceptableAddress,
+  IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
+  IN MEMORY_CACHING_TYPE CacheType,
+  IN NODE_REQUIREMENT PreferredNode);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmFreeContiguousMemory(
+  IN PVOID BaseAddress);
+
+NTKERNELAPI
+VOID
+NTAPI
+MmFreeContiguousMemorySpecifyCache(
+  IN PVOID BaseAddress,
+  IN SIZE_T NumberOfBytes,
+  IN MEMORY_CACHING_TYPE CacheType);
+
+#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
+
+#if (NTDDI_VERSION >= NTDDI_WS03)
+NTKERNELAPI
+NTSTATUS
+NTAPI
+MmCreateMirror(VOID);
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_VISTA)
+NTSTATUS
+NTAPI
+MmRotatePhysicalView(
+  IN PVOID VirtualAddress,
+  IN OUT PSIZE_T NumberOfBytes,
+  IN PMDLX NewMdl OPTIONAL,
+  IN MM_ROTATE_DIRECTION Direction,
+  IN PMM_ROTATE_COPY_CALLBACK_FUNCTION CopyFunction,
+  IN PVOID Context OPTIONAL);
+#endif
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+NTKERNELAPI
+BOOLEAN
+NTAPI
+SeSinglePrivilegeCheck(
+  IN LUID PrivilegeValue,
+  IN KPROCESSOR_MODE PreviousMode);
+#endif
+
 struct _LOADER_PARAMETER_BLOCK;
 struct _CREATE_DISK;
 struct _DRIVE_LAYOUT_INFORMATION_EX;
@@ -2444,7 +2807,6 @@ struct _SET_PARTITION_INFORMATION_EX;
 #ifndef GUID_DEFINED
 #include <guiddef.h>
 #endif
-typedef GUID UUID;
 
 /*
 ** IRP function codes
@@ -3174,215 +3536,82 @@ KeGetCurrentProcessorNumber(VOID)
 #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)
+#define PXI_MASK (PXE_PER_PAGE - 1)
 
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExExtendZone(
-  IN OUT PZONE_HEADER Zone,
-  IN OUT PVOID Segment,
-  IN ULONG SegmentSize);
+#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
 
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExInitializeZone(
-  OUT PZONE_HEADER Zone,
-  IN ULONG BlockSize,
-  IN OUT PVOID InitialSegment,
-  IN ULONG InitialSegmentSize);
+#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
 
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExInterlockedExtendZone(
-  IN OUT PZONE_HEADER Zone,
-  IN OUT PVOID Segment,
-  IN ULONG SegmentSize,
-  IN OUT PKSPIN_LOCK Lock);
+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;
 
-NTKERNELAPI
-NTSTATUS
-NTAPI
-ExUuidCreate(
-  OUT UUID *Uuid);
+FORCEINLINE
+PKPCR
+KeGetPcr(VOID)
+{
+    return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
+}
 
-NTKERNELAPI
-DECLSPEC_NORETURN
-VOID
-NTAPI
-ExRaiseAccessViolation(
-  VOID);
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorNumber(VOID)
+{
+    return (ULONG)__readgsword(0x184);
+}
 
-NTKERNELAPI
-DECLSPEC_NORETURN
-VOID
-NTAPI
-ExRaiseDatatypeMisalignment(
-  VOID);
+#endif /* _AMD64_ */
 
-#endif
+typedef enum _INTERLOCKED_RESULT {
+  ResultNegative = RESULT_NEGATIVE,
+  ResultZero = RESULT_ZERO,
+  ResultPositive = RESULT_POSITIVE
+} INTERLOCKED_RESULT;
 
 #ifdef _X86_
 
@@ -4010,146 +4239,6 @@ IoWritePartitionTableEx(
 
 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
 
-/* Memory Manager Types */
-
-typedef struct _PHYSICAL_MEMORY_RANGE {
-  PHYSICAL_ADDRESS BaseAddress;
-  LARGE_INTEGER NumberOfBytes;
-} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
-
-/* Memory Manager Functions */
-
-#if (NTDDI_VERSION >= NTDDI_WIN2K)
-
-NTKERNELAPI
-PPHYSICAL_MEMORY_RANGE
-NTAPI
-MmGetPhysicalMemoryRanges(
-  VOID);
-
-NTKERNELAPI
-PHYSICAL_ADDRESS
-NTAPI
-MmGetPhysicalAddress(
-  IN PVOID BaseAddress);
-
-NTKERNELAPI
-BOOLEAN
-NTAPI
-MmIsNonPagedSystemAddressValid(
-  IN PVOID VirtualAddress);
-
-NTKERNELAPI
-PVOID
-NTAPI
-MmAllocateNonCachedMemory(
-  IN SIZE_T NumberOfBytes);
-
-NTKERNELAPI
-VOID
-NTAPI
-MmFreeNonCachedMemory(
-  IN PVOID BaseAddress,
-  IN SIZE_T NumberOfBytes);
-
-NTKERNELAPI
-PVOID
-NTAPI
-MmGetVirtualForPhysical(
-  IN PHYSICAL_ADDRESS PhysicalAddress);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmMapUserAddressesToPage(
-  IN PVOID BaseAddress,
-  IN SIZE_T NumberOfBytes,
-  IN PVOID PageAddress);
-
-NTKERNELAPI
-PVOID
-NTAPI
-MmMapVideoDisplay(
-  IN PHYSICAL_ADDRESS PhysicalAddress,
-  IN SIZE_T NumberOfBytes,
-  IN MEMORY_CACHING_TYPE CacheType);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmMapViewInSessionSpace(
-  IN PVOID Section,
-  OUT PVOID *MappedBase,
-  IN OUT PSIZE_T ViewSize);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmMapViewInSystemSpace(
-  IN PVOID Section,
-  OUT PVOID *MappedBase,
-  IN OUT PSIZE_T ViewSize);
-
-NTKERNELAPI
-BOOLEAN
-NTAPI
-MmIsAddressValid(
-  IN PVOID VirtualAddress);
-
-NTKERNELAPI
-BOOLEAN
-NTAPI
-MmIsThisAnNtAsSystem(
-  VOID);
-
-NTKERNELAPI
-VOID
-NTAPI
-MmLockPagableSectionByHandle(
-  IN PVOID ImageSectionHandle);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmUnmapViewInSessionSpace(
-  IN PVOID MappedBase);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmUnmapViewInSystemSpace(
-  IN PVOID MappedBase);
-
-NTKERNELAPI
-VOID
-NTAPI
-MmUnsecureVirtualMemory(
-  IN HANDLE SecureHandle);
-
-NTKERNELAPI
-NTSTATUS
-NTAPI
-MmRemovePhysicalMemory(
-  IN PPHYSICAL_ADDRESS StartAddress,
-  IN OUT PLARGE_INTEGER NumberOfBytes);
-
-NTKERNELAPI
-HANDLE
-NTAPI
-MmSecureVirtualMemory(
-  IN PVOID Address,
-  IN SIZE_T Size,
-  IN ULONG ProbeMode);
-
-NTKERNELAPI
-VOID
-NTAPI
-MmUnmapVideoDisplay(
-  IN PVOID BaseAddress,
-  IN SIZE_T NumberOfBytes);
-
-#endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
-
 /** Process manager types **/
 
 typedef VOID
@@ -4240,17 +4329,6 @@ PsRemoveLoadImageNotifyRoutine(
 
 extern NTKERNELAPI PEPROCESS PsInitialSystemProcess;
 
-/* Security reference monitor routines */
-
-#if (NTDDI_VERSION >= NTDDI_WIN2K)
-NTKERNELAPI
-BOOLEAN
-NTAPI
-SeSinglePrivilegeCheck(
-  IN LUID PrivilegeValue,
-  IN KPROCESSOR_MODE PreviousMode);
-#endif
-
 /* ZwXxx Functions */
 
 #if (NTDDI_VERSION >= NTDDI_WIN2K)