Alexandre Julliard : ntdll: Return the kernel process start address from __wine_kernel_init().

Alexandre Julliard julliard at winehq.org
Thu Feb 14 16:19:11 CST 2019


Module: wine
Branch: master
Commit: 42df4dccd578d0f7f635d7b6eaf9ddedf7c65987
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=42df4dccd578d0f7f635d7b6eaf9ddedf7c65987

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Feb 14 16:45:03 2019 +0100

ntdll: Return the kernel process start address from __wine_kernel_init().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/process.c | 4 ++--
 dlls/ntdll/loader.c     | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index df2d0d6..ad257a0 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1336,7 +1336,7 @@ static void set_process_name( int argc, char *argv[] )
  *
  * Wine initialisation: load and start the main exe file.
  */
-void CDECL __wine_kernel_init(void)
+void * CDECL __wine_kernel_init(void)
 {
     static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2',0};
     static const WCHAR dotW[] = {'.',0};
@@ -1458,7 +1458,7 @@ void CDECL __wine_kernel_init(void)
 
     if (!params->CurrentDirectory.Handle) chdir("/"); /* avoid locking removable devices */
 
-    LdrInitializeThunk( start_process_wrapper, 0, 0, 0 );
+    return start_process_wrapper;
 
  error:
     ExitProcess( GetLastError() );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6becb44..d6b8950 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3386,8 +3386,6 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
     WINE_MODREF *wm;
     PEB *peb = NtCurrentTeb()->Peb;
 
-    kernel32_start_process = kernel_start;
-
     /* allocate the modref for the main exe (if not already done) */
     wm = get_modref( peb->ImageBaseAddress );
     assert( wm );
@@ -3558,7 +3556,7 @@ void __wine_process_init(void)
     NTSTATUS status;
     ANSI_STRING func_name;
     UNICODE_STRING nt_name;
-    void (* DECLSPEC_NORETURN CDECL init_func)(void);
+    void * (CDECL *init_func)(void);
 
     thread_init();
 
@@ -3584,5 +3582,8 @@ void __wine_process_init(void)
         MESSAGE( "wine: could not find __wine_kernel_init in kernel32.dll, status %x\n", status );
         exit(1);
     }
-    init_func();
+
+    kernel32_start_process = init_func();
+
+    LdrInitializeThunk( NULL, 0, 0, 0 );
 }




More information about the wine-cvs mailing list