Author: tkreuzer
Date: Fri Jan 17 21:49:43 2014
New Revision: 61659
URL:
http://svn.reactos.org/svn/reactos?rev=61659&view=rev
Log:
[NTOSKRNL]
Lookup new Ldr entries in IopInitializeBuiltinDriver (we used the old ones from the loader
block, that are not valid anymore after the drivers have been relocated!)
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Fri Jan 17 21:49:43 2014
@@ -818,14 +818,16 @@
NTSTATUS
NTAPI
INIT_FUNCTION
-IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
+IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY BootLdrEntry)
{
PDEVICE_NODE DeviceNode;
PDRIVER_OBJECT DriverObject;
NTSTATUS Status;
PWCHAR FileNameWithoutPath;
LPWSTR FileExtension;
- PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName;
+ PUNICODE_STRING ModuleName = &BootLdrEntry->BaseDllName;
+ PLDR_DATA_TABLE_ENTRY LdrEntry;
+ PLIST_ENTRY NextEntry;
UNICODE_STRING ServiceName;
/*
@@ -868,6 +870,22 @@
DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName,
Status);
return(Status);
}
+
+ /* Lookup the new Ldr entry in PsLoadedModuleList */
+ NextEntry = PsLoadedModuleList.Flink;
+ while (NextEntry != &PsLoadedModuleList)
+ {
+ LdrEntry = CONTAINING_RECORD(NextEntry,
+ LDR_DATA_TABLE_ENTRY,
+ InLoadOrderLinks);
+ if (RtlEqualUnicodeString(ModuleName, &LdrEntry->BaseDllName, TRUE))
+ {
+ break;
+ }
+
+ NextEntry = NextEntry->Flink;
+ }
+ NT_ASSERT(NextEntry != &PsLoadedModuleList);
/*
* Initialize the driver