Commit 4bed3d23 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

winedevice: Use LdrFindEntryForAddress to find LDR_MODULE address.

parent 17ce029f
......@@ -50,15 +50,18 @@ static DRIVER_EXTENSION driver_extension;
/* find the LDR_MODULE corresponding to the driver module */
static LDR_MODULE *find_ldr_module( HMODULE module )
{
LIST_ENTRY *entry, *list = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
LDR_MODULE *ldr;
ULONG_PTR magic;
for (entry = list->Flink; entry != list; entry = entry->Flink)
LdrLockLoaderLock( 0, NULL, &magic );
if (LdrFindEntryForAddress( module, &ldr ))
{
LDR_MODULE *ldr = CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList);
if (ldr->BaseAddress == module) return ldr;
if (ldr->BaseAddress > (void *)module) break;
WARN( "module not found for %p\n", module );
ldr = NULL;
}
return NULL;
LdrUnlockLoaderLock( 0, magic );
return ldr;
}
/* load the driver module file */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment