Skip to content

Commit

Permalink
ntdll: Change module search order in LdrFindEntryForAddress().
Browse files Browse the repository at this point in the history
CW-Bug-Id: #19827

To be dropped once we have module search tree implementation.
  • Loading branch information
Paul Gofman authored and ivyl committed Feb 15, 2024
1 parent c43a95d commit dc6bd58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dlls/ntdll/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,10 +1860,10 @@ NTSTATUS WINAPI LdrFindEntryForAddress( const void *addr, PLDR_DATA_TABLE_ENTRY
PLIST_ENTRY mark, entry;
PLDR_DATA_TABLE_ENTRY mod;

mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
for (entry = mark->Flink; entry != mark; entry = entry->Flink)
mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
for (entry = mark->Blink; entry != mark; entry = entry->Blink)
{
mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks);
mod = CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
if (mod->DllBase <= addr &&
(const char *)addr < (char*)mod->DllBase + mod->SizeOfImage)
{
Expand Down

0 comments on commit dc6bd58

Please sign in to comment.