Alexandre Julliard : ntdll: Load the main module before the other dlls.
Alexandre Julliard
julliard at winehq.org
Tue Feb 2 15:52:09 CST 2021
Module: wine
Branch: master
Commit: 72baffdb6d7ce2d8c2bb0656b48e6b963faa4de3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=72baffdb6d7ce2d8c2bb0656b48e6b963faa4de3
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Feb 2 10:12:16 2021 +0100
ntdll: Load the main module before the other dlls.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 49 +++++++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6a90770b3b4..d507250f0d1 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4031,29 +4031,6 @@ static NTSTATUS process_init(void)
load_global_options();
version_init();
- /* setup the load callback and create ntdll modref */
- RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
- NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
- &meminfo, sizeof(meminfo), NULL );
- status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
- assert( !status );
-
- if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
- NULL, 0, &wm )) != STATUS_SUCCESS)
- {
- MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
- NtTerminateProcess( GetCurrentProcess(), status );
- }
- RtlInitAnsiString( &func_name, "BaseThreadInitThunk" );
- if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name,
- 0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
- {
- MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %x\n", status );
- NtTerminateProcess( GetCurrentProcess(), status );
- }
-
- init_locale( wm->ldr.DllBase );
-
if (!(status = load_dll( params->DllPath.Buffer, params->ImagePathName.Buffer, NULL,
DONT_RESOLVE_DLL_REFERENCES, &wm )))
{
@@ -4115,11 +4092,27 @@ static NTSTATUS process_init(void)
}
#endif
- /* the main exe needs to be the first in the load order list */
- RemoveEntryList( &wm->ldr.InLoadOrderLinks );
- InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks );
- RemoveEntryList( &wm->ldr.InMemoryOrderLinks );
- InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderLinks );
+ RtlInitUnicodeString( &nt_name, L"\\??\\C:\\windows\\system32\\ntdll.dll" );
+ NtQueryVirtualMemory( GetCurrentProcess(), process_init, MemoryBasicInformation,
+ &meminfo, sizeof(meminfo), NULL );
+ status = build_builtin_module( params->DllPath.Buffer, &nt_name, meminfo.AllocationBase, 0, &wm );
+ assert( !status );
+
+ if ((status = load_dll( params->DllPath.Buffer, L"C:\\windows\\system32\\kernel32.dll",
+ NULL, 0, &wm )) != STATUS_SUCCESS)
+ {
+ MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
+ NtTerminateProcess( GetCurrentProcess(), status );
+ }
+ RtlInitAnsiString( &func_name, "BaseThreadInitThunk" );
+ if ((status = LdrGetProcedureAddress( wm->ldr.DllBase, &func_name,
+ 0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
+ {
+ MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %x\n", status );
+ NtTerminateProcess( GetCurrentProcess(), status );
+ }
+
+ init_locale( wm->ldr.DllBase );
RtlCreateUserStack( 0, 0, 0, 0x10000, 0x10000, &stack );
teb->Tib.StackBase = stack.StackBase;
More information about the wine-cvs
mailing list