Author: sginsberg Date: Sat Oct 24 22:35:10 2009 New Revision: 43722
URL: http://svn.reactos.org/svn/reactos?rev=43722&view=rev Log: - Don't put PAGED_CODE() before variable declarations -- this makes MSVC very, very sad. Reformat and clean up the code a bit too.
Modified: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c
Modified: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c?... ============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] Sat Oct 24 22:35:10 2009 @@ -116,44 +116,49 @@ NTAPI MmPageEntireDriver(IN PVOID AddressWithinSection) { + //PMMPTE StartPte, EndPte; + PLDR_DATA_TABLE_ENTRY LdrEntry; PAGED_CODE(); - // - // We should find the driver loader entry and return its base address - // - //PMMPTE StartPte, EndPte; - PLDR_DATA_TABLE_ENTRY pLdrDataTabEntry = - MiLookupDataTableEntry(AddressWithinSection); - if (pLdrDataTabEntry) - { - // - // Is Paging disabled or it's mapped as an image - // - if ((MmDisablePagingExecutive & 1) || pLdrDataTabEntry->SectionPointer) - return pLdrDataTabEntry->DllBase; - - // - // Flush all queued DPCs. - // - KeFlushQueuedDpcs(); - - // - // Get PTE range for this section - // - //StartPte = MiGetPteAddress(pLdrDataTabEntry->DllBase); - //EndPte = MiGetPteAddress(pLdrDataTabEntry->DllBase + - // pLdrDataTabEntry->SizeOfImage); - - // - // Set paging for specified PTE range - // - //MiSetPagingOfDriver(StartPte, EndPte); - - // - // Return base address - // - return pLdrDataTabEntry->DllBase; - } - return NULL; + + // + // Get the loader entry + // + LdrEntry = MiLookupDataTableEntry(AddressWithinSection); + if (!LdrEntry) return NULL; + + // + // Check if paging of kernel mode is disabled or if the driver is mapped as + // an image + // + if ((MmDisablePagingExecutive & 0x1) || (LdrEntry->SectionPointer)) + { + // + // Don't do anything, just return the base address + // + return LdrEntry->DllBase; + } + + // + // Wait for active DPCs to finish before we page out the driver + // + KeFlushQueuedDpcs(); + + // + // Get the PTE range for the whole driver image + // + //StartPte = MiGetPteAddress(LdrEntry->DllBase); + //EndPte = MiGetPteAddress(LdrEntry->DllBase + + // LdrEntry->SizeOfImage); + + // + // Enable paging for the PTE range + // + //MiSetPagingOfDriver(StartPte, EndPte); + + // + // Return the base address + // + return LdrEntry->DllBase; }
/*