this commit
- removed Alex Ionescu's name from his code (verifier.c)
- reformatted his code simply to reformat it
- changed license from GPL to BSD

Recommend this user gets banned for breaking licence / IP policies /
coding rules. :-P

Regards,
Timo

[email protected] wrote:
> Author: ros-arm-bringup
> Date: Sun Jun 28 11:32:52 2009
> New Revision: 41658
>
> URL: http://svn.reactos.org/svn/reactos?rev=41658&view=rev
> Log:
> - Move all the functions from drvlck.c and verifier.c to ARM3's drvmgmt.c:
>   - "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).
>
>
> Added:
>     trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c
>       - copied, changed from r41647, trunk/reactos/ntoskrnl/mm/drvlck.c
> Removed:
>     trunk/reactos/ntoskrnl/mm/drvlck.c
>     trunk/reactos/ntoskrnl/mm/verifier.c
> Modified:
>     trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
>     trunk/reactos/ntoskrnl/mm/wset.c
>     trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
>     trunk/reactos/ntoskrnl/ntoskrnl.pspec
>
> Copied: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c (from r41647, 
> trunk/reactos/ntoskrnl/mm/drvlck.c)
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c?p2=trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c&p1=trunk/reactos/ntoskrnl/mm/drvlck.c&r1=41647&r2=41658&rev=41658&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/drvlck.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] Sun Jun 28 11:32:52 
> 2009
> @@ -1,102 +1,324 @@
>  /*
> - * COPYRIGHT:       See COPYING in the top level directory
> - * PROJECT:         ReactOS kernel
> - * FILE:            ntoskrnl/mm/drvlck.c
> - * PURPOSE:         Managing driver managing
> - *
> - * PROGRAMMERS:     David Welch ([email protected])
> - */
> -
> -/* INCLUDES 
> *****************************************************************/
> + * 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>
>  
> -/* FUNCTIONS 
> *****************************************************************/
> -
> -#undef MmLockPagableDataSection
> -
> -#if 0
> +#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
> -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
> +NTAPI
> +MmUnlockPageableImageSection(IN PVOID ImageSectionHandle)
> +{
> +    UNIMPLEMENTED;
> +}
> +
> +/*
> + * @unimplemented
> + */
> +VOID
> +NTAPI
> +MmLockPageableSectionByHandle(IN PVOID ImageSectionHandle)
> +{
> +    UNIMPLEMENTED;
> +}
> +
> +/*
> + * @unimplemented
> + */
>  PVOID
> -MmLockPagableCodeSection(IN PVOID AddressWithinSection)
> -{
> -   PVOID Handle;
> -   Handle = MmLocateMemoryAreaByAddress(NULL,AddressWithinSection);
> -   MmLockPagableSectionByHandle(Handle);
> -   return(Handle);
> -}
> -#endif
> -
> +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
>   */
> -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;
> +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 */
>
> Modified: trunk/reactos/ntoskrnl/mm/ARM3/miarm.h
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/miarm.h?rev=41658&r1=41657&r2=41658&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/ARM3/miarm.h [iso-8859-1] Sun Jun 28 11:32:52 
> 2009
> @@ -52,6 +52,7 @@
>  extern PMMPTE MiFirstReservedZeroingPte;
>  extern MI_PFN_CACHE_ATTRIBUTE 
> MiPlatformCacheAttributes[2][MmMaximumCacheType];
>  extern PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock;
> +extern ULONG MmBootImageSize;
>  
>  VOID
>  NTAPI
>
> Removed: trunk/reactos/ntoskrnl/mm/drvlck.c
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/drvlck.c?rev=41657&view=auto
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/drvlck.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/drvlck.c (removed)
> @@ -1,102 +1,0 @@
> -/*
> - * COPYRIGHT:       See COPYING in the top level directory
> - * PROJECT:         ReactOS kernel
> - * FILE:            ntoskrnl/mm/drvlck.c
> - * PURPOSE:         Managing driver managing
> - *
> - * PROGRAMMERS:     David Welch ([email protected])
> - */
> -
> -/* 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 */
>
> Removed: trunk/reactos/ntoskrnl/mm/verifier.c
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/verifier.c?rev=41657&view=auto
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/verifier.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/verifier.c (removed)
> @@ -1,190 +1,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 ([email protected])
> -*/
> -
> -/* 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 */
>
> Modified: trunk/reactos/ntoskrnl/mm/wset.c
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/wset.c?rev=41658&r1=41657&r2=41658&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/mm/wset.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/mm/wset.c [iso-8859-1] Sun Jun 28 11:32:52 2009
> @@ -46,16 +46,3 @@
>     }
>     return(STATUS_SUCCESS);
>  }
> -
> -/*
> - * @unimplemented
> - */
> -ULONG
> -NTAPI
> -MmTrimAllSystemPagableMemory (
> -     IN ULONG PurgeTransitionList
> -     )
> -{
> -     UNIMPLEMENTED;
> -     return 0;
> -}
>
> Modified: trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild?rev=41658&r1=41657&r2=41658&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/ntoskrnl-generic.rbuild [iso-8859-1] Sun Jun 28 
> 11:32:52 2009
> @@ -361,6 +361,7 @@
>               </if>
>               <directory name="ARM3">
>                       <file>contmem.c</file>
> +                     <file>drvmgmt.c</file>
>                       <file>dynamic.c</file>
>                       <file>hypermap.c</file>
>                       <file>init.c</file>
> @@ -372,7 +373,6 @@
>               <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>
> @@ -392,7 +392,6 @@
>               <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">
>
> Modified: trunk/reactos/ntoskrnl/ntoskrnl.pspec
> URL: 
> http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.pspec?rev=41658&r1=41657&r2=41658&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/ntoskrnl.pspec [iso-8859-1] Sun Jun 28 11:32:52 
> 2009
> @@ -771,9 +771,9 @@
>  @ 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)
> @@ -801,8 +801,8 @@
>  @ 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)
>
>
>   

_______________________________________________
Ros-dev mailing list
[email protected]
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to