From cca0753b28aba33ad72dcb2245a9fb80720b5bb8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 7 Mar 2015 18:09:37 +0100
Subject: ntdll: Process APC calls before starting process.

---
 dlls/ntdll/loader.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index e1444d2..bab4a2f 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2878,6 +2878,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
                                 ULONG_PTR unknown3, ULONG_PTR unknown4 )
 {
     static const WCHAR globalflagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
+    LARGE_INTEGER timeout;
     NTSTATUS status;
     WINE_MODREF *wm;
     LPCWSTR load_path;
@@ -2921,6 +2922,10 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
 
     virtual_release_address_space();
     virtual_clear_thread_stack();
+
+    timeout.QuadPart = 0;
+    NtDelayExecution( TRUE, &timeout );
+
     wine_switch_to_stack( start_process, kernel_start, NtCurrentTeb()->Tib.StackBase );
 
 error:
-- 
2.3.0

