- Move all the functions from drvlck.c and verifier.c to ARM3's drvmgmt.c:
authorReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Sun, 28 Jun 2009 07:32:52 +0000 (07:32 +0000)
committerReactOS Portable Systems Group <ros-arm-bringup@svn.reactos.org>
Sun, 28 Jun 2009 07:32:52 +0000 (07:32 +0000)
  - "Managing driver managing" (by David Welch) is no more... the routines have been properly renamed and cleaned up.
  - Also moved Driver Verifier helper routines in here, and fixed a couple of bugs:
    - Do not allow hooking of the kernel or HAL image (tested on Windows Server 2003)
    - Cleanup some useless variable redefinitions and code complexity.
  - Documented what some of the Mm Lock/Unlock Pageable Section/Driver functions should do, for later if needed.
  - Made aliasses so the typo "Pagable" functions redirect to the correct "Pageable" functions.
  - No functional change -- the Verifier functions were unused, and the drvlock.c functions were unimplemented (and still are).
  - Also move one more *Pageable* function from wset.c to ARM3's drvmgmt.c -- it seemed to have been a lost orphan (Also unimplemented).

svn path=/trunk/; revision=41658

reactos/ntoskrnl/mm/ARM3/drvmgmt.c [new file with mode: 0644]
reactos/ntoskrnl/mm/ARM3/miarm.h
reactos/ntoskrnl/mm/drvlck.c [deleted file]
reactos/ntoskrnl/mm/verifier.c [deleted file]
reactos/ntoskrnl/mm/wset.c
reactos/ntoskrnl/ntoskrnl-generic.rbuild
reactos/ntoskrnl/ntoskrnl.pspec

diff --git a/reactos/ntoskrnl/mm/ARM3/drvmgmt.c b/reactos/ntoskrnl/mm/ARM3/drvmgmt.c
new file mode 100644 (file)
index 0000000..93f7fd0
--- /dev/null
@@ -0,0 +1,324 @@
+/*
+ * PROJECT:         ReactOS Kernel
+ * LICENSE:         BSD - See COPYING.ARM in the top level directory
+ * FILE:            ntoskrnl/mm/ARM3/drvmgmt.c
+ * PURPOSE:         ARM Memory Manager Driver Management
+ * PROGRAMMERS:     ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+#line 15 "ARMĀ³::DRVMGMT"
+#define MODULE_INVOLVED_IN_ARM3
+#include "../ARM3/miarm.h"
+
+/* GLOBALS *******************************************************************/
+
+MM_DRIVER_VERIFIER_DATA MmVerifierData;
+LIST_ENTRY MiVerifierDriverAddedThunkListHead;
+KMUTANT MmSystemLoadLock;
+ULONG MiActiveVerifierThunks;
+extern LIST_ENTRY PsLoadedModuleList;
+
+/* PRIVATE FUNCTIONS *********************************************************/
+
+PLDR_DATA_TABLE_ENTRY
+NTAPI
+MiLookupDataTableEntry(IN PVOID Address)
+{
+    PLDR_DATA_TABLE_ENTRY LdrEntry, FoundEntry = NULL;
+    PLIST_ENTRY NextEntry;
+    PAGED_CODE();
+    
+    //
+    // Loop entries
+    //
+    NextEntry = PsLoadedModuleList.Flink;
+    do
+    {
+        //
+        // Get the loader entry
+        //
+        LdrEntry =  CONTAINING_RECORD(NextEntry,
+                                      LDR_DATA_TABLE_ENTRY,
+                                      InLoadOrderLinks);
+        
+        //
+        // Check if the address matches
+        //
+        if ((Address >= LdrEntry->DllBase) &&
+            (Address < (PVOID)((ULONG_PTR)LdrEntry->DllBase +
+                               LdrEntry->SizeOfImage)))
+        {
+            //
+            // Found a match
+            //
+            FoundEntry = LdrEntry;
+            break;
+        }
+        
+        //
+        // Move on
+        //
+        NextEntry = NextEntry->Flink;
+    } while(NextEntry != &PsLoadedModuleList);
+    
+    //
+    // Return the entry
+    //
+    return FoundEntry;
+}
+
+/* PUBLIC FUNCTIONS ***********************************************************/
+
+/*
+ * @unimplemented
+ */
+VOID
+NTAPI
+MmUnlockPageableImageSection(IN PVOID ImageSectionHandle)
+{
+    UNIMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+NTAPI
+MmLockPageableSectionByHandle(IN PVOID ImageSectionHandle)
+{
+    UNIMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+PVOID
+NTAPI
+MmLockPageableDataSection(IN PVOID AddressWithinSection)
+{
+    //
+    // We should just find the section and call MmLockPageableSectionByHandle
+    //
+    UNIMPLEMENTED;
+    return AddressWithinSection;
+}
+
+/*
+ * @unimplemented
+ */
+PVOID
+NTAPI
+MmPageEntireDriver(IN PVOID AddressWithinSection)
+{
+    //
+    // We should find the driver loader entry and return its base address
+    //
+    UNIMPLEMENTED;
+    return NULL;
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+NTAPI
+MmResetDriverPaging(IN PVOID AddressWithinSection)
+{
+    UNIMPLEMENTED;
+}
+
+/*
+ * @unimplemented
+ */
+ULONG
+NTAPI
+MmTrimAllSystemPageableMemory(IN ULONG PurgeTransitionList)
+{
+       UNIMPLEMENTED;
+       return 0;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+MmAddVerifierThunks(IN PVOID ThunkBuffer,
+                    IN ULONG ThunkBufferSize)
+{
+    PDRIVER_VERIFIER_THUNK_PAIRS ThunkTable;
+    ULONG ThunkCount;
+    PDRIVER_SPECIFIED_VERIFIER_THUNKS DriverThunks;
+    PLDR_DATA_TABLE_ENTRY LdrEntry;
+    PVOID ModuleBase, ModuleEnd;
+    ULONG i;
+    NTSTATUS Status = STATUS_SUCCESS;
+    PAGED_CODE();
+    
+    //
+    // Make sure the driver verifier is initialized
+    //
+    if (!MiVerifierDriverAddedThunkListHead.Flink) return STATUS_NOT_SUPPORTED;
+    
+    //
+    // Get the thunk pairs and count them
+    //
+    ThunkCount = ThunkBufferSize / sizeof(DRIVER_VERIFIER_THUNK_PAIRS);
+    if (!ThunkCount) return STATUS_INVALID_PARAMETER_1;
+    
+    //
+    // Now allocate our own thunk table
+    //
+    DriverThunks = ExAllocatePoolWithTag(PagedPool,
+                                         sizeof(*DriverThunks) +
+                                         ThunkCount *
+                                         sizeof(DRIVER_VERIFIER_THUNK_PAIRS),
+                                         'tVmM');
+    if (!DriverThunks) return STATUS_INSUFFICIENT_RESOURCES;
+    
+    //
+    // Now copy the driver-fed part
+    //
+    ThunkTable = (PDRIVER_VERIFIER_THUNK_PAIRS)(DriverThunks + 1);
+    RtlCopyMemory(ThunkTable,
+                  ThunkBuffer,
+                  ThunkCount * sizeof(DRIVER_VERIFIER_THUNK_PAIRS));
+    
+    //
+    // Acquire the system load lock
+    //
+    KeEnterCriticalRegion();
+    KeWaitForSingleObject(&MmSystemLoadLock,
+                          WrVirtualMemory,
+                          KernelMode,
+                          FALSE,
+                          NULL);
+    
+    //
+    // Get the loader entry
+    //
+    LdrEntry = MiLookupDataTableEntry(ThunkTable->PristineRoutine);
+    if (!LdrEntry)
+    {
+        //
+        // Fail
+        //
+        Status = STATUS_INVALID_PARAMETER_2;
+        goto Cleanup;
+    }
+    
+    //
+    // Get driver base and end
+    //
+    ModuleBase = LdrEntry->DllBase;
+    ModuleEnd = (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage);
+    
+    //
+    // Don't allow hooking the kernel or HAL
+    //
+    if (ModuleBase < (PVOID)(KSEG0_BASE + MmBootImageSize))
+    {
+        //
+        // Fail
+        //
+        Status = STATUS_INVALID_PARAMETER_2;
+        goto Cleanup;
+    }
+    
+    //
+    // Loop all the thunks
+    //
+    for (i = 0; i < ThunkCount; i++)
+    {
+        //
+        // Make sure it's in the driver
+        //
+        if (((ULONG_PTR)ThunkTable->PristineRoutine < (ULONG_PTR)ModuleBase) ||
+            ((ULONG_PTR)ThunkTable->PristineRoutine >= (ULONG_PTR)ModuleEnd))
+        {
+            //
+            // Nope, fail
+            //
+            Status = STATUS_INVALID_PARAMETER_2;
+            goto Cleanup;
+        }
+    }
+    
+    //
+    // Otherwise, add this entry
+    //
+    DriverThunks->DataTableEntry = LdrEntry;
+    DriverThunks->NumberOfThunks = ThunkCount;
+    MiActiveVerifierThunks++;
+    InsertTailList(&MiVerifierDriverAddedThunkListHead,
+                   &DriverThunks->ListEntry);
+    DriverThunks = NULL;
+    
+Cleanup:
+    //
+    // Release the lock
+    //
+    KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
+    KeLeaveCriticalRegion();
+    
+    //
+    // Free the table if we failed and return status
+    //
+    if (DriverThunks) ExFreePool(DriverThunks);
+    return Status;
+}
+
+/*
+ * @implemented
+ */
+LOGICAL
+NTAPI
+MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject)
+{
+    PLDR_DATA_TABLE_ENTRY LdrEntry;
+    
+    //
+    // Get the loader entry
+    //
+    LdrEntry = (PLDR_DATA_TABLE_ENTRY)DriverObject->DriverSection;
+    if (!LdrEntry) return FALSE;
+    
+    //
+    // Check if we're verifying or not
+    //
+    return (LdrEntry->Flags & LDRP_IMAGE_VERIFYING) ? TRUE: FALSE;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+MmIsVerifierEnabled(OUT PULONG VerifierFlags)
+{
+    //
+    // Check if we've actually added anything to the list
+    //
+    if (MiVerifierDriverAddedThunkListHead.Flink)
+    {
+        //
+        // We have, read the verifier level
+        //
+        *VerifierFlags = MmVerifierData.Level;
+        return STATUS_SUCCESS;
+    }
+    
+    //
+    // Otherwise, we're disabled
+    //
+    *VerifierFlags = 0;
+    return STATUS_NOT_SUPPORTED;
+}
+
+/* EOF */
index 9708f2e..e7f5512 100644 (file)
@@ -52,6 +52,7 @@ extern PMMPTE MmFirstReservedMappingPte, MmLastReservedMappingPte;
 extern PMMPTE MiFirstReservedZeroingPte;
 extern MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType];
 extern PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock;
+extern ULONG MmBootImageSize;
 
 VOID
 NTAPI
diff --git a/reactos/ntoskrnl/mm/drvlck.c b/reactos/ntoskrnl/mm/drvlck.c
deleted file mode 100644 (file)
index c8b6468..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/mm/drvlck.c
- * PURPOSE:         Managing driver managing
- *
- * PROGRAMMERS:     David Welch (welch@mcmail.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#include <debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-#undef MmLockPagableDataSection
-
-#if 0
-VOID
-MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
-/*
- * FUNCTION: Releases a section of driver code or driver data, previously
- * locked into system space with MmLockPagableCodeSection,
- * MmLockPagableDataSection or MmLockPagableSectionByHandle
- * ARGUMENTS:
- *        ImageSectionHandle = Handle returned by MmLockPagableCodeSection or
- *                             MmLockPagableDataSection
- */
-{
-   //  MmUnlockMemoryArea((MEMORY_AREA *)ImageSectionHandle);
-   UNIMPLEMENTED;
-}
-#endif
-
-
-/*
- * @unimplemented
- */
-VOID NTAPI
-MmLockPagableSectionByHandle(IN PVOID ImageSectionHandle)
-{
-    UNIMPLEMENTED;
-}
-
-
-#if 0
-PVOID
-MmLockPagableCodeSection(IN PVOID AddressWithinSection)
-{
-   PVOID Handle;
-   Handle = MmLocateMemoryAreaByAddress(NULL,AddressWithinSection);
-   MmLockPagableSectionByHandle(Handle);
-   return(Handle);
-}
-#endif
-
-
-/*
- * @implemented
- */
-PVOID NTAPI
-MmLockPagableDataSection(IN PVOID AddressWithinSection)
-{
-   PVOID Handle;
-   Handle = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(),
-                                        AddressWithinSection);
-   MmLockPagableSectionByHandle(Handle);
-   return(Handle);
-}
-
-
-/*
- * @unimplemented
- */
-VOID NTAPI
-MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
-{
-    UNIMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-PVOID NTAPI
-MmPageEntireDriver(IN PVOID AddressWithinSection)
-{
-    UNIMPLEMENTED;
-    return NULL;
-}
-
-
-/*
- * @unimplemented
- */
-VOID NTAPI
-MmResetDriverPaging(IN PVOID AddressWithinSection)
-{
-    UNIMPLEMENTED;
-}
-
-/* EOF */
diff --git a/reactos/ntoskrnl/mm/verifier.c b/reactos/ntoskrnl/mm/verifier.c
deleted file mode 100644 (file)
index 11d3ac2..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-* PROJECT:         ReactOS Kernel
-* LICENSE:         GPL - See COPYING in the top level directory
-* FILE:            ntoskrnl/mm/verifier.c
-* PURPOSE:         Mm Driver Verifier Routines
-* PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
-*/
-
-/* INCLUDES ******************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <debug.h>
-
-/* GLOBALS *******************************************************************/
-
-MM_DRIVER_VERIFIER_DATA MmVerifierData;
-LIST_ENTRY MiVerifierDriverAddedThunkListHead;
-KMUTANT MmSystemLoadLock;
-ULONG MiActiveVerifierThunks;
-
-extern LIST_ENTRY PsLoadedModuleList;
-
-/* PRIVATE FUNCTIONS *********************************************************/
-
-PLDR_DATA_TABLE_ENTRY
-NTAPI
-MiLookupDataTableEntry(IN PVOID Address)
-{
-    PLDR_DATA_TABLE_ENTRY LdrEntry, FoundEntry = NULL;
-    PLIST_ENTRY NextEntry;
-    PAGED_CODE();
-
-    /* Loop entries */
-    NextEntry = PsLoadedModuleList.Flink;
-    do
-    {
-        /* Get the loader entry */
-        LdrEntry =  CONTAINING_RECORD(NextEntry,
-                                      LDR_DATA_TABLE_ENTRY,
-                                      InLoadOrderLinks);
-
-        /* Check if the address matches */
-        if ((Address >= LdrEntry->DllBase) &&
-            (Address < (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage)))
-        {
-            /* Found a match */
-            FoundEntry = LdrEntry;
-            break;
-        }
-
-        /* Move on */
-        NextEntry = NextEntry->Flink;
-    } while(NextEntry != &PsLoadedModuleList);
-
-    /* Return the entry */
-    return FoundEntry;
-}
-
-/* PUBLIC FUNCTIONS **********************************************************/
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-MmAddVerifierThunks(IN PVOID ThunkBuffer,
-                    IN ULONG ThunkBufferSize)
-{
-    PDRIVER_VERIFIER_THUNK_PAIRS ThunkPairs, DriverThunkTable;
-    ULONG ThunkCount;
-    PDRIVER_SPECIFIED_VERIFIER_THUNKS ThunkTable;
-    PLDR_DATA_TABLE_ENTRY LdrEntry;
-    PVOID ModuleBase, ModuleEnd;
-    ULONG i;
-    NTSTATUS Status = STATUS_SUCCESS;
-    PAGED_CODE();
-
-    /* Make sure the driver verifier is initialized */
-    if (!MiVerifierDriverAddedThunkListHead.Flink) return STATUS_NOT_SUPPORTED;
-
-    /* Get the thunk pairs and count them */
-    ThunkPairs = (PDRIVER_VERIFIER_THUNK_PAIRS)ThunkBuffer;
-    ThunkCount = ThunkBufferSize / sizeof(DRIVER_VERIFIER_THUNK_PAIRS);
-    if (!ThunkCount) return STATUS_INVALID_PARAMETER_1;
-
-    /* Now allocate our own thunk table */
-    ThunkTable = ExAllocatePoolWithTag(PagedPool,
-                                       sizeof(DRIVER_SPECIFIED_VERIFIER_THUNKS) +
-                                       ThunkCount *
-                                       sizeof(DRIVER_VERIFIER_THUNK_PAIRS),
-                                       TAG('M', 'm', 'V', 't'));
-    if (!ThunkTable) return STATUS_INSUFFICIENT_RESOURCES;
-
-    /* Now copy the driver-fed part */
-    DriverThunkTable = (PDRIVER_VERIFIER_THUNK_PAIRS)(ThunkTable + 1);
-    RtlCopyMemory(DriverThunkTable,
-                  ThunkPairs,
-                  ThunkCount * sizeof(DRIVER_VERIFIER_THUNK_PAIRS));
-
-    /* Acquire the system load lock */
-    KeEnterCriticalRegion();
-    KeWaitForSingleObject(&MmSystemLoadLock,
-                          WrVirtualMemory,
-                          KernelMode,
-                          FALSE,
-                          NULL);
-
-    /* Get the loader entry */
-    LdrEntry = MiLookupDataTableEntry(DriverThunkTable->PristineRoutine);
-    if (!LdrEntry)
-    {
-        /* Fail */
-        Status = STATUS_INVALID_PARAMETER_2;
-        goto Cleanup;
-    }
-
-    /* Get driver base and end */
-    ModuleBase = LdrEntry->DllBase;
-    ModuleEnd = (PVOID)((ULONG_PTR)LdrEntry->DllBase + LdrEntry->SizeOfImage);
-
-    /* Loop all the thunks */
-    for (i = 0; i < ThunkCount; i++)
-    {
-        /* Make sure it's in the driver */
-        if (((ULONG_PTR)DriverThunkTable->PristineRoutine < (ULONG_PTR)ModuleBase) ||
-            ((ULONG_PTR)DriverThunkTable->PristineRoutine >= (ULONG_PTR)ModuleEnd))
-        {
-            /* Nope, fail */
-            Status = STATUS_INVALID_PARAMETER_2;
-            goto Cleanup;
-        }
-    }
-
-    /* Otherwise, add this entry */
-    ThunkTable->DataTableEntry = LdrEntry;
-    ThunkTable->NumberOfThunks = ThunkCount;
-    MiActiveVerifierThunks++;
-    InsertTailList(&MiVerifierDriverAddedThunkListHead,
-                   &ThunkTable->ListEntry);
-    ThunkTable = NULL;
-
-Cleanup:
-    /* Release the lock */
-    KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
-    KeLeaveCriticalRegion();
-
-    /* Free the table if we failed and return status */
-    if (ThunkTable) ExFreePool(ThunkTable);
-    return Status;
-}
-
-/*
- * @implemented
- */
-LOGICAL
-NTAPI
-MmIsDriverVerifying(IN PDRIVER_OBJECT DriverObject)
-{
-    PLDR_DATA_TABLE_ENTRY LdrEntry;
-
-    /* Get the loader entry */
-    LdrEntry = (PLDR_DATA_TABLE_ENTRY)DriverObject->DriverSection;
-    if (!LdrEntry) return FALSE;
-
-    /* Check if we're verifying or not */
-    return (LdrEntry->Flags & LDRP_IMAGE_VERIFYING) ? TRUE: FALSE;
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-NTAPI
-MmIsVerifierEnabled(OUT PULONG VerifierFlags)
-{
-    /* Check if we've actually added anything to the list */
-    if (MiVerifierDriverAddedThunkListHead.Flink)
-    {
-        /* We have, read the verifier level */
-        *VerifierFlags = MmVerifierData.Level;
-        return STATUS_SUCCESS;
-    }
-
-    /* Otherwise, we're disabled */
-    *VerifierFlags = 0;
-    return STATUS_NOT_SUPPORTED;
-}
-
-/* EOF */
index 16c0987..51335db 100644 (file)
@@ -46,16 +46,3 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
    }
    return(STATUS_SUCCESS);
 }
-
-/*
- * @unimplemented
- */
-ULONG
-NTAPI
-MmTrimAllSystemPagableMemory (
-       IN ULONG PurgeTransitionList
-       )
-{
-       UNIMPLEMENTED;
-       return 0;
-}
index 07dcc17..e19b5f2 100644 (file)
                </if>
                <directory name="ARM3">
                        <file>contmem.c</file>
+                       <file>drvmgmt.c</file>
                        <file>dynamic.c</file>
                        <file>hypermap.c</file>
                        <file>init.c</file>
                <file>anonmem.c</file>
                <file>balance.c</file>
                <file>dbgpool.c</file>
-               <file>drvlck.c</file>
                <file>freelist.c</file>
                <file>kmap.c</file>
                <file>marea.c</file>
                <file>rmap.c</file>
                <file>section.c</file>
                <file>sysldr.c</file>
-               <file>verifier.c</file>
                <file>virtual.c</file>
                <file>wset.c</file>
                <if property="_ELF_" value="1">
index 5a90d91..b68be24 100644 (file)
 @ stdcall MmIsRecursiveIoFault()
 @ stdcall MmIsThisAnNtAsSystem()
 @ stdcall MmIsVerifierEnabled(ptr)
-@ stdcall MmLockPagableDataSection(ptr)
-@ stdcall MmLockPagableImageSection(ptr) MmLockPagableDataSection
-@ stdcall MmLockPagableSectionByHandle(ptr)
+@ stdcall MmLockPagableDataSection(ptr) MmLockPageableDataSection
+@ stdcall MmLockPagableImageSection(ptr) MmLockPageableDataSection
+@ stdcall MmLockPagableSectionByHandle(ptr) MmLockPageableSectionByHandle
 @ stdcall MmMapIoSpace(long long long long)
 @ stdcall MmMapLockedPages(ptr long)
 @ stdcall MmMapLockedPagesSpecifyCache(ptr long long ptr long long)
 @ stdcall MmSetBankedSection(long long long long long long)
 @ stdcall MmSizeOfMdl(ptr long)
 @ extern MmSystemRangeStart
-@ stdcall MmTrimAllSystemPagableMemory(long)
-@ stdcall MmUnlockPagableImageSection(ptr)
+@ stdcall MmTrimAllSystemPagableMemory(long) MmTrimAllSystemPageableMemory
+@ stdcall MmUnlockPagableImageSection(ptr) MmUnlockPageableImageSection
 @ stdcall MmUnlockPages(ptr)
 @ stdcall MmUnmapIoSpace(ptr long)
 @ stdcall MmUnmapLockedPages(ptr ptr)