Author: tkreuzer
Date: Thu Nov 5 21:57:53 2009
New Revision: 43980
URL:
http://svn.reactos.org/svn/reactos?rev=43980&view=rev
Log:
use RtlPcToFileHeader instead of RtlpLookupModuleBase
Modified:
branches/ros-amd64-bringup/reactos/dll/ntdll/rtl/libsupp.c
branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
branches/ros-amd64-bringup/reactos/ntoskrnl/rtl/libsupp.c
Modified: branches/ros-amd64-bringup/reactos/dll/ntdll/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/dll/n…
==============================================================================
--- branches/ros-amd64-bringup/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] Thu Nov 5
21:57:53 2009
@@ -384,63 +384,6 @@
return NULL;
}
-
-PVOID
-NTAPI
-RtlpLookupModuleBase(
- PVOID Address)
-{
- NTSTATUS Status;
- MEMORY_BASIC_INFORMATION MemoryInformation;
- ULONG_PTR Base, Limit;
- PIMAGE_DOS_HEADER DosHeader;
- PIMAGE_NT_HEADERS NtHeader;
-
- Status = NtQueryVirtualMemory(NtCurrentProcess(),
- Address,
- MemoryBasicInformation,
- &MemoryInformation,
- sizeof(MEMORY_BASIC_INFORMATION),
- NULL);
- if (!NT_SUCCESS(Status))
- {
- return NULL;
- }
-
- /* FIXME: remove these checks? */
- Base = (ULONG_PTR)MemoryInformation.BaseAddress;
- Limit = Base + MemoryInformation.RegionSize;
- if ( ((ULONG_PTR)Address < Base) ||
- ((ULONG_PTR)Address >= Limit) )
- {
- /* WTF? */
- return NULL;
- }
-
- /* Check if we got the right kind of memory */
- if ( (MemoryInformation.State != MEM_COMMIT) ||
- (MemoryInformation.Type != MEM_IMAGE) )
- {
- return NULL;
- }
-
- /* Check DOS magic */
- DosHeader = MemoryInformation.AllocationBase;
- if (DosHeader->e_magic != IMAGE_DOS_MAGIC)
- {
- return NULL;
- }
-
- /* Check NT header */
- NtHeader = (PVOID)((ULONG_PTR)DosHeader + DosHeader->e_lfanew);
- if (NtHeader->Signature != IMAGE_PE_MAGIC)
- {
- return NULL;
- }
-
- return MemoryInformation.AllocationBase;
-}
-
/*
* Ldr Resource support code
Modified: branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/r…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] Thu Nov 5
21:57:53 2009
@@ -58,11 +58,6 @@
*/
} UNWIND_INFO, *PUNWIND_INFO;
-PVOID
-NTAPI
-RtlpLookupModuleBase(
- PVOID Address);
-
/* FUNCTIONS *****************************************************************/
PRUNTIME_FUNCTION
@@ -77,8 +72,7 @@
PIMAGE_DATA_DIRECTORY Directory;
/* Find ModuleBase */
- DosHeader = RtlpLookupModuleBase((PVOID)ControlPc);
- if (!DosHeader)
+ if (!RtlPcToFileHeader((PVOID)ControlPc, (PVOID*)&DosHeader))
{
return NULL;
}
Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/rtl/libsupp.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Thu Nov 5
21:57:53 2009
@@ -30,26 +30,26 @@
PVOID
NTAPI
-RtlpLookupModuleBase(
- PVOID Address)
+RtlPcToFileHeader(
+ IN PVOID PcValue,
+ OUT PVOID *BaseOfImage)
{
PLDR_DATA_TABLE_ENTRY LdrEntry;
BOOLEAN InSystem;
- PVOID p;
/* Get the base for this file */
- if ((ULONG_PTR)Address > (ULONG_PTR)MmHighestUserAddress)
+ if ((ULONG_PTR)PcValue > (ULONG_PTR)MmHighestUserAddress)
{
/* We are in kernel */
- p = KiPcToFileHeader(Address, &LdrEntry, FALSE, &InSystem);
+ *BaseOfImage = KiPcToFileHeader(PcValue, &LdrEntry, FALSE, &InSystem);
}
else
{
/* We are in user land */
- p = KiRosPcToUserFileHeader(Address, &LdrEntry);
- }
-
- return p;
+ *BaseOfImage = KiRosPcToUserFileHeader(PcValue, &LdrEntry);
+ }
+
+ return *BaseOfImage;
}
VOID