ntoskrnl header cleanups
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Deleted: trunk/reactos/ntoskrnl/include/internal/nls.h
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
Added: trunk/reactos/ntoskrnl/include/internal/rtl.h
Modified: trunk/reactos/ntoskrnl/mm/anonmem.c
Modified: trunk/reactos/ntoskrnl/mm/aspace.c
Modified: trunk/reactos/ntoskrnl/mm/balance.c
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/mm/kmap.c
Modified: trunk/reactos/ntoskrnl/mm/marea.c
Modified: trunk/reactos/ntoskrnl/mm/mdl.c
Modified: trunk/reactos/ntoskrnl/mm/mm.c
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
Modified: trunk/reactos/ntoskrnl/mm/mpw.c
Modified: trunk/reactos/ntoskrnl/mm/npool.c
Modified: trunk/reactos/ntoskrnl/mm/pagefile.c
Modified: trunk/reactos/ntoskrnl/mm/pageop.c
Modified: trunk/reactos/ntoskrnl/mm/ppool.c
Modified: trunk/reactos/ntoskrnl/mm/region.c
Modified: trunk/reactos/ntoskrnl/mm/rmap.c
Modified: trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/rtl/nls.c

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
--- trunk/reactos/ntoskrnl/include/internal/mm.h	2005-09-13 23:48:54 UTC (rev 17845)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h	2005-09-14 01:05:50 UTC (rev 17846)
@@ -10,211 +10,260 @@
 extern ULONG MmPagedPoolSize;
 extern ULONG MmTotalPagedPoolQuota;
 extern ULONG MmTotalNonPagedPoolQuota;
+extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
 
+extern PVOID MmPagedPoolBase;
+extern ULONG MmPagedPoolSize;
+
+struct _KTRAP_FRAME;
 struct _EPROCESS;
 struct _MM_RMAP_ENTRY;
-struct _MM_PAGEOP
-;
+struct _MM_PAGEOP;
 typedef ULONG SWAPENTRY;
 typedef ULONG PFN_TYPE, *PPFN_TYPE;
 
-#define MEMORY_AREA_INVALID              (0)
-#define MEMORY_AREA_SECTION_VIEW         (1)
-#define MEMORY_AREA_CONTINUOUS_MEMORY    (2)
-#define MEMORY_AREA_NO_CACHE             (3)
-#define MEMORY_AREA_IO_MAPPING           (4)
-#define MEMORY_AREA_SYSTEM               (5)
-#define MEMORY_AREA_MDL_MAPPING          (7)
-#define MEMORY_AREA_VIRTUAL_MEMORY       (8)
-#define MEMORY_AREA_CACHE_SEGMENT        (9)
-#define MEMORY_AREA_SHARED_DATA          (10)
-#define MEMORY_AREA_KERNEL_STACK         (11)
-#define MEMORY_AREA_PAGED_POOL           (12)
-#define MEMORY_AREA_NO_ACCESS            (13)
-#define MEMORY_AREA_PEB_OR_TEB           (14)
+#define MEMORY_AREA_INVALID                 (0)
+#define MEMORY_AREA_SECTION_VIEW            (1)
+#define MEMORY_AREA_CONTINUOUS_MEMORY       (2)
+#define MEMORY_AREA_NO_CACHE                (3)
+#define MEMORY_AREA_IO_MAPPING              (4)
+#define MEMORY_AREA_SYSTEM                  (5)
+#define MEMORY_AREA_MDL_MAPPING             (7)
+#define MEMORY_AREA_VIRTUAL_MEMORY          (8)
+#define MEMORY_AREA_CACHE_SEGMENT           (9)
+#define MEMORY_AREA_SHARED_DATA             (10)
+#define MEMORY_AREA_KERNEL_STACK            (11)
+#define MEMORY_AREA_PAGED_POOL              (12)
+#define MEMORY_AREA_NO_ACCESS               (13)
+#define MEMORY_AREA_PEB_OR_TEB              (14)
 
+#define MM_PHYSICAL_PAGE_MPW_PENDING        (0x8)
+
+#define MM_CORE_DUMP_TYPE_NONE              (0x0)
+#define MM_CORE_DUMP_TYPE_MINIMAL           (0x1)
+#define MM_CORE_DUMP_TYPE_FULL              (0x2)
+
+#define MM_PAGEOP_PAGEIN                    (1)
+#define MM_PAGEOP_PAGEOUT                   (2)
+#define MM_PAGEOP_PAGESYNCH                 (3)
+#define MM_PAGEOP_ACCESSFAULT               (4)
+
 #define PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(x) \
-                          ((x) / (4*1024*1024))
+    ((x) / (4*1024*1024))
+
 #define PAGE_TO_SECTION_PAGE_TABLE_OFFSET(x) \
-                      ((((x)) % (4*1024*1024)) / (4*1024))
+    ((((x)) % (4*1024*1024)) / (4*1024))
 
-#define NR_SECTION_PAGE_TABLES           (1024)
-#define NR_SECTION_PAGE_ENTRIES          (1024)
+#define NR_SECTION_PAGE_TABLES              1024
+#define NR_SECTION_PAGE_ENTRIES             1024
 
-#define TEB_BASE        (0x7FFDE000)
-#define KPCR_BASE                 0xFF000000
+#define TEB_BASE                            0x7FFDE000
+#define KPCR_BASE                           0xFF000000
 
 /* Although Microsoft says this isn't hardcoded anymore,
    they won't be able to change it. Stuff depends on it */
-#define MM_VIRTMEM_GRANULARITY (64 * 1024) 
+#define MM_VIRTMEM_GRANULARITY              (64 * 1024) 
 
-#define STATUS_MM_RESTART_OPERATION       ((NTSTATUS)0xD0000001)
+#define STATUS_MM_RESTART_OPERATION         ((NTSTATUS)0xD0000001)
 
 /*
  * Additional flags for protection attributes
  */
-#define PAGE_WRITETHROUGH                       (1024)
-#define PAGE_SYSTEM                             (2048)
-#define PAGE_FLAGS_VALID_FROM_USER_MODE               (PAGE_READONLY | \
-						 PAGE_READWRITE | \
-						 PAGE_WRITECOPY | \
-						 PAGE_EXECUTE | \
-						 PAGE_EXECUTE_READ | \
-						 PAGE_EXECUTE_READWRITE | \
-						 PAGE_EXECUTE_WRITECOPY | \
-						 PAGE_GUARD | \
-						 PAGE_NOACCESS | \
-						 PAGE_NOCACHE)
+#define PAGE_WRITETHROUGH                   (1024)
+#define PAGE_SYSTEM                         (2048)
 
-#define PAGE_IS_READABLE (PAGE_READONLY | \
-                          PAGE_READWRITE | \
-                          PAGE_WRITECOPY | \
-                          PAGE_EXECUTE_READ | \
-                          PAGE_EXECUTE_READWRITE | \
-                          PAGE_EXECUTE_WRITECOPY)
+#define SEC_PHYSICALMEMORY                  (0x80000000)
 
-#define PAGE_IS_WRITABLE (PAGE_READWRITE | \
-                          PAGE_WRITECOPY | \
-                          PAGE_EXECUTE_READWRITE | \
-                          PAGE_EXECUTE_WRITECOPY)
+#define MM_PAGEFILE_SEGMENT                 (0x1)
+#define MM_DATAFILE_SEGMENT                 (0x2)
 
-#define PAGE_IS_EXECUTABLE (PAGE_EXECUTE | \
-                            PAGE_EXECUTE_READ | \
-                            PAGE_EXECUTE_READWRITE | \
-                            PAGE_EXECUTE_WRITECOPY)
+#define MC_CACHE                            (0)
+#define MC_USER                             (1)
+#define MC_PPOOL                            (2)
+#define MC_NPPOOL                           (3)
+#define MC_MAXIMUM                          (4)
 
-#define PAGE_IS_WRITECOPY (PAGE_WRITECOPY | \
-                           PAGE_EXECUTE_WRITECOPY)
+#define PAGED_POOL_MASK                     1
+#define MUST_SUCCEED_POOL_MASK              2
+#define CACHE_ALIGNED_POOL_MASK             4
+#define QUOTA_POOL_MASK                     8
+#define SESSION_POOL_MASK                   32
+#define VERIFIER_POOL_MASK                  64
 
+#define MM_PAGED_POOL_SIZE                  (100*1024*1024)
+#define MM_NONPAGED_POOL_SIZE               (100*1024*1024)
+
+/*
+ * Paged and non-paged pools are 8-byte aligned
+ */
+#define MM_POOL_ALIGNMENT                   8
+
+/*
+ * Maximum size of the kmalloc area (this is totally arbitary)
+ */
+#define MM_KERNEL_MAP_SIZE                  (16*1024*1024)
+#define MM_KERNEL_MAP_BASE                  (0xf0c00000)
+
+/*
+ * FIXME - different architectures have different cache line sizes...
+ */
+#define MM_CACHE_LINE_SIZE                  32
+
+#define MM_ROUND_UP(x,s)                    \
+    ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
+
+#define MM_ROUND_DOWN(x,s)                  \
+    ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
+
+#define PAGE_FLAGS_VALID_FROM_USER_MODE     \
+    (PAGE_READONLY | \
+    PAGE_READWRITE | \
+    PAGE_WRITECOPY | \
+    PAGE_EXECUTE | \
+    PAGE_EXECUTE_READ | \
+    PAGE_EXECUTE_READWRITE | \
+    PAGE_EXECUTE_WRITECOPY | \
+    PAGE_GUARD | \
+    PAGE_NOACCESS | \
+    PAGE_NOCACHE)
+
+#define PAGE_IS_READABLE                    \
+    (PAGE_READONLY | \
+    PAGE_READWRITE | \
+    PAGE_WRITECOPY | \
+    PAGE_EXECUTE_READ | \
+    PAGE_EXECUTE_READWRITE | \
+    PAGE_EXECUTE_WRITECOPY)
+
+#define PAGE_IS_WRITABLE                    \
+    (PAGE_READWRITE | \
+    PAGE_WRITECOPY | \
+    PAGE_EXECUTE_READWRITE | \
+    PAGE_EXECUTE_WRITECOPY)
+
+#define PAGE_IS_EXECUTABLE                  \
+    (PAGE_EXECUTE | \
+    PAGE_EXECUTE_READ | \
+    PAGE_EXECUTE_READWRITE | \
+    PAGE_EXECUTE_WRITECOPY)
+
+#define PAGE_IS_WRITECOPY                   \
+    (PAGE_WRITECOPY | \
+    PAGE_EXECUTE_WRITECOPY)
+
 typedef struct
 {
-  ULONG Entry[NR_SECTION_PAGE_ENTRIES];
+    ULONG Entry[NR_SECTION_PAGE_ENTRIES];
 } SECTION_PAGE_TABLE, *PSECTION_PAGE_TABLE;
 
 typedef struct
 {
-   PSECTION_PAGE_TABLE PageTables[NR_SECTION_PAGE_TABLES];
+    PSECTION_PAGE_TABLE PageTables[NR_SECTION_PAGE_TABLES];
 } SECTION_PAGE_DIRECTORY, *PSECTION_PAGE_DIRECTORY;
 
-#define SEC_PHYSICALMEMORY     (0x80000000)
-
-#define MM_PAGEFILE_SEGMENT    (0x1)
-#define MM_DATAFILE_SEGMENT    (0x2)
-
 typedef struct _MM_SECTION_SEGMENT
 {
-  LONGLONG FileOffset;
-  ULONG_PTR VirtualAddress;
-  ULONG RawLength;
-  ULONG Length;
-  ULONG Protection;
-  FAST_MUTEX Lock;
-  ULONG ReferenceCount;
-  SECTION_PAGE_DIRECTORY PageDirectory;
-  ULONG Flags;
-  ULONG Characteristics;
-  BOOLEAN WriteCopy;
+    LONGLONG FileOffset;
+    ULONG_PTR VirtualAddress;
+    ULONG RawLength;
+    ULONG Length;
+    ULONG Protection;
+    FAST_MUTEX Lock;
+    ULONG ReferenceCount;
+    SECTION_PAGE_DIRECTORY PageDirectory;
+    ULONG Flags;
+    ULONG Characteristics;
+    BOOLEAN WriteCopy;
 } MM_SECTION_SEGMENT, *PMM_SECTION_SEGMENT;
 
 typedef struct _MM_IMAGE_SECTION_OBJECT
 {
-  ULONG_PTR ImageBase;
-  ULONG_PTR StackReserve;
-  ULONG_PTR StackCommit;
-  ULONG_PTR EntryPoint;
-  ULONG Subsystem;
-  ULONG ImageCharacteristics;
-  USHORT MinorSubsystemVersion;
-  USHORT MajorSubsystemVersion;
-  USHORT Machine;
-  BOOLEAN Executable;
-  ULONG NrSegments;
-  PMM_SECTION_SEGMENT Segments;
+    ULONG_PTR ImageBase;
+    ULONG_PTR StackReserve;
+    ULONG_PTR StackCommit;
+    ULONG_PTR EntryPoint;
+    ULONG Subsystem;
+    ULONG ImageCharacteristics;
+    USHORT MinorSubsystemVersion;
+    USHORT MajorSubsystemVersion;
+    USHORT Machine;
+    BOOLEAN Executable;
+    ULONG NrSegments;
+    PMM_SECTION_SEGMENT Segments;
 } MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
 
 typedef struct _SECTION_OBJECT
 {
-  CSHORT Type;
-  CSHORT Size;
-  LARGE_INTEGER MaximumSize;
-  ULONG SectionPageProtection;
-  ULONG AllocationAttributes;
-  PFILE_OBJECT FileObject;
-  union
-  {
-    PMM_IMAGE_SECTION_OBJECT ImageSection;
-    PMM_SECTION_SEGMENT Segment;
-  };
+    CSHORT Type;
+    CSHORT Size;
+    LARGE_INTEGER MaximumSize;
+    ULONG SectionPageProtection;
+    ULONG AllocationAttributes;
+    PFILE_OBJECT FileObject;
+    union
+    {
+        PMM_IMAGE_SECTION_OBJECT ImageSection;
+        PMM_SECTION_SEGMENT Segment;
+    };
 } SECTION_OBJECT;
 
 typedef struct _MEMORY_AREA
 {
-  PVOID StartingAddress;
-  PVOID EndingAddress;
-  struct _MEMORY_AREA *Parent;
-  struct _MEMORY_AREA *LeftChild;
-  struct _MEMORY_AREA *RightChild;
-  ULONG Type;
-  ULONG Attributes;
-  ULONG LockCount;
-  BOOLEAN DeleteInProgress;
-  ULONG PageOpCount;
-  union
-  {
-    struct
+    PVOID StartingAddress;
+    PVOID EndingAddress;
+    struct _MEMORY_AREA *Parent;
+    struct _MEMORY_AREA *LeftChild;
+    struct _MEMORY_AREA *RightChild;
+    ULONG Type;
+    ULONG Attributes;
+    ULONG LockCount;
+    BOOLEAN DeleteInProgress;
+    ULONG PageOpCount;
+    union
     {
-      SECTION_OBJECT* Section;
-      ULONG ViewOffset;
-      PMM_SECTION_SEGMENT Segment;
-      BOOLEAN WriteCopyView;
-      LIST_ENTRY RegionListHead;
-    } SectionData;
-    struct
-    {
-      LIST_ENTRY RegionListHead;
-    } VirtualMemoryData;
-  } Data;
+        struct
+        {
+            SECTION_OBJECT* Section;
+            ULONG ViewOffset;
+            PMM_SECTION_SEGMENT Segment;
+            BOOLEAN WriteCopyView;
+            LIST_ENTRY RegionListHead;
+        } SectionData;
+        struct
+        {
+            LIST_ENTRY RegionListHead;
+        } VirtualMemoryData;
+    } Data;
 } MEMORY_AREA, *PMEMORY_AREA;
 
 #ifndef _MMTYPES_H
 typedef struct _MADDRESS_SPACE
 {
-  PMEMORY_AREA MemoryAreaRoot;
-  FAST_MUTEX Lock;
-  PVOID LowestAddress;
-  struct _EPROCESS* Process;
-  PUSHORT PageTableRefCountTable;
-  ULONG PageTableRefCountTableSize;
+    PMEMORY_AREA MemoryAreaRoot;
+    FAST_MUTEX Lock;
+    PVOID LowestAddress;
+    struct _EPROCESS* Process;
+    PUSHORT PageTableRefCountTable;
+    ULONG PageTableRefCountTableSize;
 } MADDRESS_SPACE, *PMADDRESS_SPACE;
 #endif
 
 typedef struct
 {
-   ULONG NrTotalPages;
-   ULONG NrSystemPages;
-   ULONG NrReservedPages;
-   ULONG NrUserPages;
-   ULONG NrFreePages;
-   ULONG NrDirtyPages;
-   ULONG NrLockedPages;
-   ULONG PagingRequestsInLastMinute;
-   ULONG PagingRequestsInLastFiveMinutes;
-   ULONG PagingRequestsInLastFifteenMinutes;
+    ULONG NrTotalPages;
+    ULONG NrSystemPages;
+    ULONG NrReservedPages;
+    ULONG NrUserPages;
+    ULONG NrFreePages;
+    ULONG NrDirtyPages;
+    ULONG NrLockedPages;
+    ULONG PagingRequestsInLastMinute;
+    ULONG PagingRequestsInLastFiveMinutes;
+    ULONG PagingRequestsInLastFifteenMinutes;
 } MM_STATS;
 
 extern MM_STATS MmStats;
 
-#define MM_PHYSICAL_PAGE_MPW_PENDING     (0x8)
-
-#define MM_CORE_DUMP_TYPE_NONE            (0x0)
-#define MM_CORE_DUMP_TYPE_MINIMAL         (0x1)
-#define MM_CORE_DUMP_TYPE_FULL            (0x2)
-
-#define MM_PAGEOP_PAGEIN        (1)
-#define MM_PAGEOP_PAGEOUT       (2)
-#define MM_PAGEOP_PAGESYNCH     (3)
-#define MM_PAGEOP_ACCESSFAULT   (4)
-
 typedef struct _MM_PAGEOP
 {
   /* Type of operation. */
@@ -246,256 +295,335 @@
   ULONG Offset;
 } MM_PAGEOP, *PMM_PAGEOP;
 
-#define MC_CACHE          (0)
-#define MC_USER           (1)
-#define MC_PPOOL          (2)
-#define MC_NPPOOL         (3)
-#define MC_MAXIMUM        (4)
-
 typedef struct _MM_MEMORY_CONSUMER
 {
-   ULONG PagesUsed;
-   ULONG PagesTarget;
-   NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed);
-}
-MM_MEMORY_CONSUMER, *PMM_MEMORY_CONSUMER;
+    ULONG PagesUsed;
+    ULONG PagesTarget;
+    NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed);
+} MM_MEMORY_CONSUMER, *PMM_MEMORY_CONSUMER;
 
-extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM];
-
-extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
-struct _KTRAP_FRAME;
-
-typedef VOID (*PMM_ALTER_REGION_FUNC)(PMADDRESS_SPACE AddressSpace,
-				      PVOID BaseAddress, ULONG Length,
-				      ULONG OldType, ULONG OldProtect,
-				      ULONG NewType, ULONG NewProtect);
-
 typedef struct _MM_REGION
 {
-   ULONG Type;
-   ULONG Protect;
-   ULONG Length;
-   LIST_ENTRY RegionListEntry;
+    ULONG Type;
+    ULONG Protect;
+    ULONG Length;
+    LIST_ENTRY RegionListEntry;
 } MM_REGION, *PMM_REGION;
 
-typedef VOID (*PMM_FREE_PAGE_FUNC)(PVOID Context, PMEMORY_AREA MemoryArea,
-                                   PVOID Address, PFN_TYPE Page,
-                                   SWAPENTRY SwapEntry, BOOLEAN Dirty);
+extern MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM];
 
-PVOID STDCALL ExAllocateNonPagedPoolWithTag (POOL_TYPE	type,
-					     ULONG		size,
-					     ULONG		Tag,
-					     PVOID		Caller);
+typedef VOID
+(*PMM_ALTER_REGION_FUNC)(
+    PMADDRESS_SPACE AddressSpace,
+    PVOID BaseAddress,
+    ULONG Length,
+    ULONG OldType,
+    ULONG OldProtect,
+    ULONG NewType,
+    ULONG NewProtect
+);
 
-PVOID STDCALL ExAllocatePagedPoolWithTag (POOL_TYPE	Type,
-					  ULONG		size,
-					  ULONG		Tag);
-VOID STDCALL ExFreeNonPagedPool (PVOID block);
+typedef VOID
+(*PMM_FREE_PAGE_FUNC)(
+    PVOID Context,
+    PMEMORY_AREA MemoryArea,
+    PVOID Address,
+    PFN_TYPE Page,
+    SWAPENTRY SwapEntry,
+    BOOLEAN Dirty
+);
 
-VOID STDCALL
-ExFreePagedPool(IN PVOID Block);
-VOID MmInitializePagedPool(VOID);
 
-PVOID
-STDCALL
-MiAllocateSpecialPool  (IN POOL_TYPE PoolType,
-                        IN SIZE_T NumberOfBytes,
-                        IN ULONG Tag,
-                        IN ULONG Underrun
-                        );
-
-extern PVOID MmPagedPoolBase;
-extern ULONG MmPagedPoolSize;
-
-#define PAGED_POOL_MASK         1
-#define MUST_SUCCEED_POOL_MASK  2
-#define CACHE_ALIGNED_POOL_MASK 4
-#define QUOTA_POOL_MASK         8
-#define SESSION_POOL_MASK       32
-#define VERIFIER_POOL_MASK      64
-
-#define MM_PAGED_POOL_SIZE	(100*1024*1024)
-#define MM_NONPAGED_POOL_SIZE	(100*1024*1024)
-
-/*
- * Paged and non-paged pools are 8-byte aligned
- */
-#define MM_POOL_ALIGNMENT	8
-
-/*
- * Maximum size of the kmalloc area (this is totally arbitary)
- */
-#define MM_KERNEL_MAP_SIZE	(16*1024*1024)
-#define MM_KERNEL_MAP_BASE	(0xf0c00000)
-
-/*
- * FIXME - different architectures have different cache line sizes...
- */
-#define MM_CACHE_LINE_SIZE  32
-
-#define MM_ROUND_UP(x,s)    ((PVOID)(((ULONG_PTR)(x)+(s)-1) & ~((ULONG_PTR)(s)-1)))
-#define MM_ROUND_DOWN(x,s)  ((PVOID)(((ULONG_PTR)(x)) & ~((ULONG_PTR)(s)-1)))
-
 /* FUNCTIONS */
 
 /* aspace.c ******************************************************************/
 
-VOID MmLockAddressSpace(PMADDRESS_SPACE AddressSpace);
+VOID 
+NTAPI
+MmLockAddressSpace(PMADDRESS_SPACE AddressSpace);
 
-VOID MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace);
+VOID
+NTAPI
+MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace);
 
-VOID MmInitializeKernelAddressSpace(VOID);
+VOID
+NTAPI
+MmInitializeKernelAddressSpace(VOID);
 
-PMADDRESS_SPACE MmGetCurrentAddressSpace(VOID);
+PMADDRESS_SPACE
+NTAPI
+MmGetCurrentAddressSpace(VOID);
 
-PMADDRESS_SPACE MmGetKernelAddressSpace(VOID);
+PMADDRESS_SPACE
+NTAPI
+MmGetKernelAddressSpace(VOID);
 
-NTSTATUS MmInitializeAddressSpace(struct _EPROCESS* Process,
-				  PMADDRESS_SPACE AddressSpace);
+NTSTATUS
+NTAPI
+MmInitializeAddressSpace(
+    struct _EPROCESS* Process,
+    PMADDRESS_SPACE AddressSpace);
 
-NTSTATUS MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace);
+NTSTATUS
+NTAPI
+MmDestroyAddressSpace(PMADDRESS_SPACE AddressSpace);
 
 /* marea.c *******************************************************************/
 
 NTSTATUS
+NTAPI
 MmInitMemoryAreas(VOID);
 
-NTSTATUS STDCALL
+NTSTATUS
+STDCALL
 MmCreateMemoryArea(
-   struct _EPROCESS* Process,
-   PMADDRESS_SPACE AddressSpace,
-   ULONG Type,
-   PVOID *BaseAddress,
-   ULONG_PTR Length,
-   ULONG Attributes,
-   PMEMORY_AREA *Result,
-   BOOLEAN FixedAddress,
-   BOOLEAN TopDown,
-   PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL);
+    struct _EPROCESS* Process,
+    PMADDRESS_SPACE AddressSpace,
+    ULONG Type,
+    PVOID *BaseAddress,
+    ULONG_PTR Length,
+    ULONG Attributes,
+    PMEMORY_AREA *Result,
+    BOOLEAN FixedAddress,
+    BOOLEAN TopDown,
+    PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL
+);
 
-PMEMORY_AREA STDCALL
+PMEMORY_AREA
+STDCALL
 MmLocateMemoryAreaByAddress(
-   PMADDRESS_SPACE AddressSpace,
-   PVOID Address);
+    PMADDRESS_SPACE AddressSpace,
+    PVOID Address
+);
 
-ULONG_PTR STDCALL
+ULONG_PTR
+STDCALL
 MmFindGapAtAddress(
-   PMADDRESS_SPACE AddressSpace,
-   PVOID Address);
+    PMADDRESS_SPACE AddressSpace,
+    PVOID Address
+);
 
-NTSTATUS STDCALL
+NTSTATUS
+STDCALL
 MmFreeMemoryArea(
-   PMADDRESS_SPACE AddressSpace,
-   PMEMORY_AREA MemoryArea,
-   PMM_FREE_PAGE_FUNC FreePage,
-   PVOID FreePageContext);
+    PMADDRESS_SPACE AddressSpace,
+    PMEMORY_AREA MemoryArea,
+    PMM_FREE_PAGE_FUNC FreePage,
+    PVOID FreePageContext
+);
 
-NTSTATUS STDCALL
+NTSTATUS
+STDCALL
 MmFreeMemoryAreaByPtr(
-   PMADDRESS_SPACE AddressSpace,
-   PVOID BaseAddress,
-   PMM_FREE_PAGE_FUNC FreePage,
-   PVOID FreePageContext);
+    PMADDRESS_SPACE AddressSpace,
+    PVOID BaseAddress,
+    PMM_FREE_PAGE_FUNC FreePage,
+    PVOID FreePageContext
+);
 
-VOID STDCALL
+VOID
+STDCALL
 MmDumpMemoryAreas(PMADDRESS_SPACE AddressSpace);
 
-PMEMORY_AREA STDCALL
+PMEMORY_AREA
+STDCALL
 MmLocateMemoryAreaByRegion(
-   PMADDRESS_SPACE AddressSpace,
-   PVOID Address,
-   ULONG_PTR Length);
+    PMADDRESS_SPACE AddressSpace,
+    PVOID Address,
+    ULONG_PTR Length
+);
 
-PVOID STDCALL
+PVOID
+STDCALL
 MmFindGap(
-   PMADDRESS_SPACE AddressSpace,
-   ULONG_PTR Length,
-   ULONG_PTR Granularity,
-   BOOLEAN TopDown);
+    PMADDRESS_SPACE AddressSpace,
+    ULONG_PTR Length,
+    ULONG_PTR Granularity,
+    BOOLEAN TopDown
+);
 
-VOID STDCALL
+VOID
+STDCALL
 MmReleaseMemoryAreaIfDecommitted(
-   PEPROCESS Process,
-   PMADDRESS_SPACE AddressSpace,
-   PVOID BaseAddress);
+    PEPROCESS Process,
+    PMADDRESS_SPACE AddressSpace,
+    PVOID BaseAddress
+);
 
 /* npool.c *******************************************************************/
 
-VOID MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
+VOID
+NTAPI
+MiDebugDumpNonPagedPool(BOOLEAN NewOnly);
 
-VOID MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
+VOID
+NTAPI
+MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly);
 
-VOID MiInitializeNonPagedPool(VOID);
+VOID
+NTAPI
+MiInitializeNonPagedPool(VOID);
 
-PVOID MmGetMdlPageAddress(PMDL Mdl, PVOID Offset);
+PVOID
+NTAPI
+MmGetMdlPageAddress(
+    PMDL Mdl,
+    PVOID Offset
+);
 
 /* pool.c *******************************************************************/
 
+PVOID
+STDCALL
+ExAllocateNonPagedPoolWithTag(
+    POOL_TYPE type,
+    ULONG size,
+    ULONG Tag,
+    PVOID Caller
+);
+
+PVOID
+STDCALL
+ExAllocatePagedPoolWithTag(
+    POOL_TYPE Type,
+    ULONG size,
+    ULONG Tag
+);
+
+VOID
+STDCALL
+ExFreeNonPagedPool(PVOID block);
+
+VOID 
+STDCALL
+ExFreePagedPool(IN PVOID Block);
+
+VOID 
+NTAPI
+MmInitializePagedPool(VOID);
+
+PVOID
+STDCALL
+MiAllocateSpecialPool(
+    IN POOL_TYPE PoolType,
+    IN SIZE_T NumberOfBytes,
+    IN ULONG Tag,
+    IN ULONG Underrun
+);
+
 BOOLEAN
 STDCALL
 MiRaisePoolQuota(
     IN POOL_TYPE PoolType,
     IN ULONG CurrentMaxQuota,
     OUT PULONG NewMaxQuota
-    );
+);
 
 /* mdl.c *********************************************************************/
 
-VOID MmBuildMdlFromPages(PMDL Mdl, PULONG Pages);
+VOID
+NTAPI
+MmBuildMdlFromPages(
+    PMDL Mdl,
+    PULONG Pages
+);
 
 /* mminit.c ******************************************************************/
 
-VOID MiShutdownMemoryManager(VOID);
+VOID
+NTAPI
+MiShutdownMemoryManager(VOID);
 
-VOID MmInit1(ULONG_PTR FirstKernelPhysAddress,
-	     ULONG_PTR LastKernelPhysAddress,
-	     ULONG_PTR LastKernelAddress,
-	     PADDRESS_RANGE BIOSMemoryMap,
-	     ULONG AddressRangeCount,
-	     ULONG MaxMemInMeg);
+VOID
+NTAPI
+MmInit1(
+    ULONG_PTR FirstKernelPhysAddress,
+    ULONG_PTR LastKernelPhysAddress,
+    ULONG_PTR LastKernelAddress,
+    PADDRESS_RANGE BIOSMemoryMap,
+    ULONG AddressRangeCount,
+    ULONG MaxMemInMeg
+);
 
-VOID MmInit2(VOID);
+VOID
+NTAPI
+MmInit2(VOID);
 
-VOID MmInit3(VOID);
+VOID
+NTAPI
+MmInit3(VOID);
 
-VOID MiFreeInitMemory(VOID);
+VOID
+NTAPI
+MiFreeInitMemory(VOID);
 
-VOID MmInitializeMdlImplementation(VOID);
+VOID
+NTAPI
+MmInitializeMdlImplementation(VOID);
 
 /* pagefile.c ****************************************************************/
 
-SWAPENTRY MmAllocSwapPage(VOID);
+SWAPENTRY
+NTAPI
+MmAllocSwapPage(VOID);
 
-VOID MmDereserveSwapPages(ULONG Nr);
+VOID
+NTAPI
+MmDereserveSwapPages(ULONG Nr);
 
-VOID MmFreeSwapPage(SWAPENTRY Entry);
+VOID
+NTAPI
+MmFreeSwapPage(SWAPENTRY Entry);
 
-VOID MmInitPagingFile(VOID);
+VOID
+NTAPI
+MmInitPagingFile(VOID);
 
-NTSTATUS MmReadFromSwapPage(SWAPENTRY SwapEntry, PFN_TYPE Page);
+NTSTATUS
+NTAPI
+MmReadFromSwapPage(
+    SWAPENTRY SwapEntry,
+    PFN_TYPE Page
+);
 
-BOOLEAN MmReserveSwapPages(ULONG Nr);
+BOOLEAN
+NTAPI
+MmReserveSwapPages(ULONG Nr);
 
-NTSTATUS MmWriteToSwapPage(SWAPENTRY SwapEntry, PFN_TYPE Page);
+NTSTATUS
+NTAPI
+MmWriteToSwapPage(
+    SWAPENTRY SwapEntry,
+    PFN_TYPE Page
+);
 
-NTSTATUS STDCALL
-MmDumpToPagingFile(ULONG BugCode,
-		   ULONG BugCodeParameter1,
-		   ULONG BugCodeParameter2,
-		   ULONG BugCodeParameter3,
-		   ULONG BugCodeParameter4,
-		   struct _KTRAP_FRAME* TrapFrame);
+NTSTATUS
+STDCALL
+MmDumpToPagingFile(
+    ULONG BugCode,
+    ULONG BugCodeParameter1,
+    ULONG BugCodeParameter2,
+    ULONG BugCodeParameter3,
+    ULONG BugCodeParameter4,
+    struct _KTRAP_FRAME* TrapFrame
+);
 
-BOOLEAN MmIsAvailableSwapPage(VOID);
+BOOLEAN
+NTAPI
+MmIsAvailableSwapPage(VOID);
 
-VOID MmShowOutOfSpaceMessagePagingFile(VOID);
+VOID
+NTAPI
+MmShowOutOfSpaceMessagePagingFile(VOID);
 
 /* process.c ****************************************************************/
 
 NTSTATUS
 STDCALL
-MmCreateProcessAddressSpace(IN struct _EPROCESS* Process,
-                            IN PSECTION_OBJECT Section OPTIONAL);
+MmCreateProcessAddressSpace(
+    IN struct _EPROCESS* Process,
+    IN PSECTION_OBJECT Section OPTIONAL
+);
 
 NTSTATUS
 STDCALL
@@ -503,92 +631,166 @@
 
 struct _TEB*
 STDCALL
-MmCreateTeb(PEPROCESS Process,
-            PCLIENT_ID ClientId,
-            PINITIAL_TEB InitialTeb);
+MmCreateTeb(
+    PEPROCESS Process,
+    PCLIENT_ID ClientId,
+    PINITIAL_TEB InitialTeb
+);
 
 VOID
 STDCALL
-MmDeleteTeb(PEPROCESS Process,
-            struct _TEB* Teb);
+MmDeleteTeb(
+    PEPROCESS Process,
+    struct _TEB* Teb
+);
 
 /* i386/pfault.c *************************************************************/
 
-NTSTATUS MmPageFault(ULONG Cs,
-		     PULONG Eip,
-		     PULONG Eax,
-		     ULONG Cr2,
-		     ULONG ErrorCode);
+NTSTATUS
+NTAPI
+MmPageFault(
+    ULONG Cs,
+    PULONG Eip,
+    PULONG Eax,
+    ULONG Cr2,
+    ULONG ErrorCode
+);
 
 /* mm.c **********************************************************************/
 
-NTSTATUS MmAccessFault(KPROCESSOR_MODE Mode,
-		       ULONG_PTR Address,
-		       BOOLEAN FromMdl);
+NTSTATUS
+NTAPI
+MmAccessFault(
+    KPROCESSOR_MODE Mode,
+    ULONG_PTR Address,
+    BOOLEAN FromMdl
+);
 
-NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
-			   ULONG_PTR Address,
-			   BOOLEAN FromMdl);
+NTSTATUS
+NTAPI
+MmNotPresentFault(
+    KPROCESSOR_MODE Mode,
+    ULONG_PTR Address,
+    BOOLEAN FromMdl
+);
 
 /* anonmem.c *****************************************************************/
 
-NTSTATUS MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
-					MEMORY_AREA* MemoryArea,
-					PVOID Address,
-					BOOLEAN Locked);
+NTSTATUS
+NTAPI
+MmNotPresentFaultVirtualMemory(
+    PMADDRESS_SPACE AddressSpace,
+    MEMORY_AREA* MemoryArea,
+    PVOID Address,
+    BOOLEAN Locked
+);
 
-NTSTATUS MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
-				PMEMORY_AREA MemoryArea,
-				PVOID Address,
-				struct _MM_PAGEOP* PageOp);
-NTSTATUS STDCALL
-MmQueryAnonMem(PMEMORY_AREA MemoryArea,
-	       PVOID Address,
-	       PMEMORY_BASIC_INFORMATION Info,
-	       PULONG ResultLength);
+NTSTATUS
+NTAPI
+MmPageOutVirtualMemory(
+    PMADDRESS_SPACE AddressSpace,
+    PMEMORY_AREA MemoryArea,
[truncated at 1000 lines; 2364 more skipped]