[ntoskrnl/mm/ARM3]

- Rewrite MmPageEntireDriver in a better way, fix bugs.

svn path=/trunk/; revision=43640
This commit is contained in:
Aleksey Bragin 2009-10-20 09:53:29 +00:00
parent 65aa515215
commit 87f0ae4ac5

View file

@ -116,32 +116,40 @@ PVOID
NTAPI
MmPageEntireDriver(IN PVOID AddressWithinSection)
{
PAGED_CODE();
//
// We should find the driver loader entry and return its base address
//
//PMMPTE Pte;
PLDR_DATA_TABLE_ENTRY pLdrDataTabEntry = MiLookupDataTableEntry(AddressWithinSection);
//PMMPTE StartPte, EndPte;
PLDR_DATA_TABLE_ENTRY pLdrDataTabEntry =
MiLookupDataTableEntry(AddressWithinSection);
if (pLdrDataTabEntry)
{
//
// Is Paging Disabled or Check if we had already mapped it in for this section
// Is Paging disabled or it's mapped as an image
//
if ( (MmDisablePagingExecutive & 1) || pLdrDataTabEntry->SectionPointer )
{
if ((MmDisablePagingExecutive & 1) || pLdrDataTabEntry->SectionPointer)
return pLdrDataTabEntry->DllBase;
}
//
// Flush all queued DPCs.
//
KeFlushQueuedDpcs();
//
// Get the PTE for this section
// Get PTE range for this section
//
//Pte = MiGetPteAddress(pLdrDataTabEntry->DllBase);
//StartPte = MiGetPteAddress(pLdrDataTabEntry->DllBase);
//EndPte = MiGetPteAddress(pLdrDataTabEntry->DllBase +
// pLdrDataTabEntry->SizeOfImage);
//
//MiSetPagingOfDriver( (Pte & (4,194,304 - 4) ) - 0x40000000 ,
// (Pte & (4,194,304 - 4) ) - 0x40000000 + 4 *
// pLdrDataTabEntry->SizeOfImage >> PAGE_SHIFT - 4 );
// Set paging for specified PTE range
//
//MiSetPagingOfDriver(StartPte, EndPte);
//
// Return base address
//
return pLdrDataTabEntry->DllBase;
}