Alexandre Julliard : ntdll: Store the kernel32 process entry point in a global variable.

Alexandre Julliard julliard at winehq.org
Tue Sep 19 15:47:04 CDT 2017


Module: wine
Branch: master
Commit: a003f0aed80660cbf30c108de7da018233efa023
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a003f0aed80660cbf30c108de7da018233efa023

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Sep 19 11:59:58 2017 +0200

ntdll: Store the kernel32 process entry point in a global variable.

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

---

 dlls/ntdll/loader.c     | 17 +++--------------
 dlls/ntdll/ntdll_misc.h |  1 +
 dlls/ntdll/thread.c     |  1 +
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 295b5e8..1bfd8f1 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -100,12 +100,6 @@ struct builtin_load_info
 static struct builtin_load_info default_load_info;
 static struct builtin_load_info *builtin_load_info = &default_load_info;
 
-struct start_params
-{
-    void                   *kernel_start;
-    LPTHREAD_START_ROUTINE  entry;
-};
-
 static HANDLE main_exe_file;
 static UINT tls_module_count;      /* number of modules with TLS directory */
 static IMAGE_TLS_DIRECTORY *tls_dirs;  /* array of TLS directories */
@@ -3106,8 +3100,7 @@ static void load_global_options(void)
  */
 static void start_process( void *arg )
 {
-    struct start_params *start_params = (struct start_params *)arg;
-    call_thread_entry_point( start_params->kernel_start, start_params->entry );
+    call_thread_entry_point( kernel32_start_process, arg );
 }
 
 /******************************************************************
@@ -3122,8 +3115,8 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
     WINE_MODREF *wm;
     LPCWSTR load_path;
     PEB *peb = NtCurrentTeb()->Peb;
-    struct start_params start_params;
 
+    kernel32_start_process = kernel_start;
     if (main_exe_file) NtClose( main_exe_file );  /* at this point the main module is created */
 
     /* allocate the modref for the main exe (if not already done) */
@@ -3159,16 +3152,12 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
     if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) goto error;
     heap_set_debug_flags( GetProcessHeap() );
 
-    /* Store original entrypoint (in case it gets corrupted) */
-    start_params.kernel_start = kernel_start;
-    start_params.entry = wm->ldr.EntryPoint;
-
     status = wine_call_on_stack( attach_process_dlls, wm, NtCurrentTeb()->Tib.StackBase );
     if (status != STATUS_SUCCESS) goto error;
 
     virtual_release_address_space();
     virtual_clear_thread_stack();
-    wine_switch_to_stack( start_process, &start_params, NtCurrentTeb()->Tib.StackBase );
+    wine_switch_to_stack( start_process, wm->ldr.EntryPoint, NtCurrentTeb()->Tib.StackBase );
 
 error:
     ERR( "Main exe initialization for %s failed, status %x\n",
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 7b13448..baa10ce 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -114,6 +114,7 @@ extern UNICODE_STRING system_dir DECLSPEC_HIDDEN;
 
 typedef LONG (WINAPI *PUNHANDLED_EXCEPTION_FILTER)(PEXCEPTION_POINTERS);
 extern PUNHANDLED_EXCEPTION_FILTER unhandled_exception_filter DECLSPEC_HIDDEN;
+extern LPTHREAD_START_ROUTINE kernel32_start_process DECLSPEC_HIDDEN;
 
 /* redefine these to make sure we don't reference kernel symbols */
 #define GetProcessHeap()       (NtCurrentTeb()->Peb->ProcessHeap)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 6ded7ea..85ceb2b 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -51,6 +51,7 @@ WINE_DECLARE_DEBUG_CHANNEL(relay);
 struct _KUSER_SHARED_DATA *user_shared_data = NULL;
 
 PUNHANDLED_EXCEPTION_FILTER unhandled_exception_filter = NULL;
+LPTHREAD_START_ROUTINE kernel32_start_process = NULL;
 
 /* info passed to a starting thread */
 struct startup_info




More information about the wine-cvs mailing list