From 8b929bd759334611c0c957482060168fe441cd5f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 19 Sep 2017 12:13:54 +0200 Subject: [PATCH] ntdll: Set the initial process context on i386. Signed-off-by: Alexandre Julliard --- dlls/ntdll/signal_i386.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index a373e3d85e3..4038436a426 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -2600,7 +2600,20 @@ void signal_init_process( CONTEXT *context, LPTHREAD_START_ROUTINE entry ) wine_ldt_init_locking( ldt_lock, ldt_unlock ); - /* FIXME: set the initial context */ + /* build the initial context */ + context->ContextFlags = CONTEXT_FULL; + context->SegCs = wine_get_cs(); + context->SegDs = wine_get_ds(); + context->SegEs = wine_get_es(); + context->SegFs = wine_get_fs(); + context->SegGs = wine_get_gs(); + context->SegSs = wine_get_ss(); + context->Eax = (DWORD)entry; + context->Ebx = (DWORD)NtCurrentTeb()->Peb; + context->Esp = (DWORD)NtCurrentTeb()->Tib.StackBase - 16; + context->Eip = (DWORD)call_thread_entry_point; + ((void **)context->Esp)[1] = kernel32_start_process; + ((void **)context->Esp)[2] = entry; return; error: