[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!)

svn path=/trunk/; revision=61659
This commit is contained in:
Timo Kreuzer 2014-01-17 21:49:43 +00:00
parent f9a9a6e8de
commit 6ea50da3a2

View file

@ -818,14 +818,16 @@ LdrProcessDriverModule(PLDR_DATA_TABLE_ENTRY LdrEntry,
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;
/*
@ -869,6 +871,22 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
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
*/