=?UTF-8?Q?Michael=20M=C3=BCller=20?=: ntdll: Do not sort InMemoryOrderModuleList by memory address.
Alexandre Julliard
julliard at winehq.org
Thu Jul 7 09:48:23 CDT 2016
Module: wine
Branch: master
Commit: 77be592845591c05a574b720b15c49e7cd1720c7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77be592845591c05a574b720b15c49e7cd1720c7
Author: Michael Müller <michael at fds-team.de>
Date: Thu Jul 7 06:43:25 2016 +0200
ntdll: Do not sort InMemoryOrderModuleList by memory address.
Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index a0049fe..d9176d7 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -355,7 +355,6 @@ static WINE_MODREF *get_modref( HMODULE hmod )
mod = CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList);
if (mod->BaseAddress == hmod)
return cached_modref = CONTAINING_RECORD(mod, WINE_MODREF, ldr);
- if (mod->BaseAddress > (void*)hmod) break;
}
return NULL;
}
@@ -932,7 +931,6 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
WINE_MODREF *wm;
const WCHAR *p;
const IMAGE_NT_HEADERS *nt = RtlImageNtHeader(hModule);
- PLIST_ENTRY entry, mark;
if (!(wm = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wm) ))) return NULL;
@@ -965,18 +963,8 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList,
&wm->ldr.InLoadOrderModuleList);
-
- /* insert module in MemoryList, sorted in increasing base addresses */
- mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
- for (entry = mark->Flink; entry != mark; entry = entry->Flink)
- {
- if (CONTAINING_RECORD(entry, LDR_MODULE, InMemoryOrderModuleList)->BaseAddress > wm->ldr.BaseAddress)
- break;
- }
- entry->Blink->Flink = &wm->ldr.InMemoryOrderModuleList;
- wm->ldr.InMemoryOrderModuleList.Blink = entry->Blink;
- wm->ldr.InMemoryOrderModuleList.Flink = entry;
- entry->Blink = &wm->ldr.InMemoryOrderModuleList;
+ InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
+ &wm->ldr.InMemoryOrderModuleList);
/* wait until init is called for inserting into this list */
wm->ldr.InInitializationOrderModuleList.Flink = NULL;
@@ -1386,7 +1374,6 @@ NTSTATUS WINAPI LdrFindEntryForAddress(const void* addr, PLDR_MODULE* pmod)
*pmod = mod;
return STATUS_SUCCESS;
}
- if (mod->BaseAddress > addr) break;
}
return STATUS_NO_MORE_ENTRIES;
}
@@ -3088,6 +3075,8 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
/* the main exe needs to be the first in the load order list */
RemoveEntryList( &wm->ldr.InLoadOrderModuleList );
InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderModuleList );
+ RemoveEntryList( &wm->ldr.InMemoryOrderModuleList );
+ InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0 )) != STATUS_SUCCESS) goto error;
if ((status = server_init_process_done()) != STATUS_SUCCESS) goto error;
More information about the wine-cvs
mailing list