Author: ion
Date: Thu Feb 22 21:30:50 2007
New Revision: 25875
URL:
http://svn.reactos.org/svn/reactos?rev=25875&view=rev
Log:
- Rename LdrLoadModule to MmLoadSystemImage and change prototype. No code change except
update callers and return ImageBaseAddress parameter when requested.
Modified:
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/include/internal/ldr.h
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/ldr/loader.c
trunk/reactos/ntoskrnl/mm/sysldr.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c Thu Feb 22 21:30:50 2007
@@ -1267,7 +1267,6 @@
PVOID ImageBase;
ULONG_PTR EntryPoint;
NTSTATUS Status;
- PLDR_DATA_TABLE_ENTRY ModuleObject;
ULONG DirSize;
PIMAGE_NT_HEADERS NtHeader;
@@ -1283,11 +1282,15 @@
/* Load the driver */
ImageName = DriverInfo->DriverName;
- Status = LdrLoadModule(&ImageName, &ModuleObject);
+ Status = MmLoadSystemImage(&ImageName,
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ &ImageBase);
if (!NT_SUCCESS(Status)) return Status;
/* Return the export pointer */
- ImageBase = ModuleObject->DllBase;
DriverInfo->ExportSectionPointer =
RtlImageDirectoryEntryToData(ImageBase,
TRUE,
@@ -1479,11 +1482,15 @@
ImageName = *(PUNICODE_STRING)Buffer;
/* Load the image */
- Status = LdrLoadModule(&ImageName, &ModuleObject);
+ Status = MmLoadSystemImage(&ImageName,
+ NULL,
+ NULL,
+ 0,
+ (PVOID)&ModuleObject,
+ &ImageBase);
if (!NT_SUCCESS(Status)) return Status;
/* Get the headers */
- ImageBase = ModuleObject->DllBase;
NtHeader = RtlImageNtHeader(ImageBase);
if (!NtHeader)
{
Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ldr.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ldr.h Thu Feb 22 21:30:50 2007
@@ -66,10 +66,12 @@
NTSTATUS
NTAPI
-LdrLoadModule(
- PUNICODE_STRING Filename,
- PLDR_DATA_TABLE_ENTRY *ModuleObject
-);
+MmLoadSystemImage(IN PUNICODE_STRING FileName,
+ IN PUNICODE_STRING NamePrefix OPTIONAL,
+ IN PUNICODE_STRING LoadedName OPTIONAL,
+ IN ULONG Flags,
+ OUT PVOID *ModuleObject,
+ OUT PVOID *ImageBaseAddress);
NTSTATUS
NTAPI
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Thu Feb 22 21:30:50 2007
@@ -455,7 +455,7 @@
else
{
DPRINT("Loading module\n");
- Status = LdrLoadModule(&ServiceImagePath, ModuleObject);
+ Status = MmLoadSystemImage(&ServiceImagePath, NULL, NULL, 0,
(PVOID)ModuleObject, NULL);
}
}
else
@@ -1721,11 +1721,10 @@
* Load the driver module
*/
- Status = LdrLoadModule(&ImagePath, &ModuleObject);
-
+ Status = MmLoadSystemImage(&ImagePath, NULL, NULL, 0, (PVOID)&ModuleObject,
NULL);
if (!NT_SUCCESS(Status))
{
- DPRINT("LdrLoadModule() failed (Status %lx)\n", Status);
+ DPRINT("MmLoadSystemImage() failed (Status %lx)\n", Status);
IopFreeDeviceNode(DeviceNode);
goto ReleaseCapturedString;
}
Modified: trunk/reactos/ntoskrnl/ldr/loader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ldr/loader.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ldr/loader.c (original)
+++ trunk/reactos/ntoskrnl/ldr/loader.c Thu Feb 22 21:30:50 2007
@@ -173,9 +173,12 @@
//
NTSTATUS
NTAPI
-LdrLoadModule(
- PUNICODE_STRING FileName,
- PLDR_DATA_TABLE_ENTRY *ModuleObject )
+MmLoadSystemImage(IN PUNICODE_STRING FileName,
+ IN PUNICODE_STRING NamePrefix OPTIONAL,
+ IN PUNICODE_STRING LoadedName OPTIONAL,
+ IN ULONG Flags,
+ OUT PVOID *ModuleObject,
+ OUT PVOID *ImageBaseAddress)
{
PVOID ModuleLoadBase;
NTSTATUS Status;
@@ -199,7 +202,8 @@
PCHAR MissingApiName, Buffer;
PWCHAR MissingDriverName;
- *ModuleObject = NULL;
+ if (ModuleObject) *ModuleObject = NULL;
+ if (ImageBaseAddress) *ImageBaseAddress = NULL;
DPRINT("Loading Module %wZ...\n", FileName);
@@ -507,7 +511,8 @@
/* Cleanup */
ExFreePool(ModuleLoadBase);
- *ModuleObject = Module;
+ if (ModuleObject) *ModuleObject = Module;
+ if (ImageBaseAddress) *ImageBaseAddress = Module->DllBase;
/* Hook for KDB on loading a driver. */
KDB_LOADDRIVER_HOOK(FileName, Module);
Modified: trunk/reactos/ntoskrnl/mm/sysldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/sysldr.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/sysldr.c (original)
+++ trunk/reactos/ntoskrnl/mm/sysldr.c Thu Feb 22 21:30:50 2007
@@ -484,7 +484,12 @@
DllName.Buffer[(DllName.MaximumLength - 1) / 2] = UNICODE_NULL;
/* Load the image */
- Status = LdrLoadModule(&DllName, &DllEntry);
+ Status = MmLoadSystemImage(&DllName,
+ NamePrefix,
+ NULL,
+ 0,
+ (PVOID)&DllEntry,
+ &DllBase);
if (NT_SUCCESS(Status))
{
/* We can free the DLL Name */
@@ -511,8 +516,7 @@
/* We're now loaded */
Loaded = TRUE;
- /* Get the base address and other information */
- DllBase = DllEntry->DllBase;
+ /* Sanity check */
ASSERT(DllBase = DllEntry->DllBase);
/* Call the initialization routines */