Commit 72baffdb authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Load the main module before the other dlls.

parent ef4be71a
......@@ -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;
......
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