Alexandre Julliard : kernel32: Remove __wine_kernel_init().

Alexandre Julliard julliard at winehq.org
Tue Dec 10 15:58:49 CST 2019


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 10 11:08:40 2019 +0100

kernel32: Remove __wine_kernel_init().

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

---

 dlls/kernel32/kernel32.spec |  2 +-
 dlls/kernel32/kernel_main.c |  3 +++
 dlls/kernel32/process.c     | 30 +++++++-----------------------
 dlls/ntdll/loader.c         |  9 +++------
 4 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index daf93aebfd..4118d29b3d 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1686,4 +1686,4 @@
 @ cdecl wine_get_dos_file_name(str)
 
 # Init code
-@ cdecl __wine_kernel_init()
+@ cdecl __wine_start_process()
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c
index 9247e3c117..be355fe724 100644
--- a/dlls/kernel32/kernel_main.c
+++ b/dlls/kernel32/kernel_main.c
@@ -84,6 +84,9 @@ static BOOL process_attach( HMODULE module )
 {
     RTL_USER_PROCESS_PARAMETERS *params = NtCurrentTeb()->Peb->ProcessParameters;
 
+    kernel32_handle = module;
+    RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter );
+
     NtQuerySystemInformation( SystemBasicInformation, &system_info, sizeof(system_info), NULL );
 
     /* Setup registry timezone information */
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index e5e51a93d8..7b8b8adcc2 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -104,9 +104,7 @@ __ASM_GLOBAL_FUNC( call_process_entry,
                     __ASM_CFI(".cfi_same_value %ebp\n\t")
                     "ret" )
 
-extern void WINAPI start_process( LPTHREAD_START_ROUTINE entry, PEB *peb ) DECLSPEC_HIDDEN;
-extern void WINAPI start_process_wrapper(void) DECLSPEC_HIDDEN;
-__ASM_GLOBAL_FUNC( start_process_wrapper,
+__ASM_GLOBAL_FUNC( __wine_start_process,
                    "pushl %ebp\n\t"
                    __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
                    __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
@@ -120,16 +118,18 @@ static inline DWORD call_process_entry( PEB *peb, LPTHREAD_START_ROUTINE entry )
 {
     return entry( peb );
 }
-static void WINAPI start_process( LPTHREAD_START_ROUTINE entry, PEB *peb );
-#define start_process_wrapper start_process
 #endif
 
 /***********************************************************************
- *           start_process
+ *           __wine_start_process
  *
  * Startup routine of a new process. Runs on the new process stack.
  */
-void WINAPI start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
+#ifdef __i386__
+void CDECL start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
+#else
+void CDECL __wine_start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
+#endif
 {
     BOOL being_debugged;
 
@@ -161,22 +161,6 @@ void WINAPI start_process( LPTHREAD_START_ROUTINE entry, PEB *peb )
 }
 
 
-/***********************************************************************
- *           __wine_kernel_init
- *
- * Wine initialisation: load and start the main exe file.
- */
-void * CDECL __wine_kernel_init(void)
-{
-    static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2',0};
-
-    kernel32_handle = GetModuleHandleW(kernel32W);
-    RtlSetUnhandledExceptionFilter( UnhandledExceptionFilter );
-
-    return start_process_wrapper;
-}
-
-
 /***********************************************************************
  *           wait_input_idle
  *
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index d87d6857d7..2f203447ed 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -4237,7 +4237,6 @@ void __wine_process_init(void)
     NTSTATUS status;
     ANSI_STRING func_name;
     UNICODE_STRING nt_name;
-    void * (CDECL *init_func)(void);
     INITIAL_TEB stack;
     BOOL suspend;
     SIZE_T info_size;
@@ -4273,11 +4272,11 @@ void __wine_process_init(void)
         MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
         exit(1);
     }
-    RtlInitAnsiString( &func_name, "__wine_kernel_init" );
+    RtlInitAnsiString( &func_name, "__wine_start_process" );
     if ((status = LdrGetProcedureAddress( wm->ldr.BaseAddress, &func_name,
-                                          0, (void **)&init_func )) != STATUS_SUCCESS)
+                                          0, (void **)&kernel32_start_process )) != STATUS_SUCCESS)
     {
-        MESSAGE( "wine: could not find __wine_kernel_init in kernel32.dll, status %x\n", status );
+        MESSAGE( "wine: could not find __wine_start_process in kernel32.dll, status %x\n", status );
         exit(1);
     }
 
@@ -4323,8 +4322,6 @@ void __wine_process_init(void)
         NtTerminateProcess( GetCurrentProcess(), status );
     }
 
-    kernel32_start_process = init_func();
-
     virtual_set_large_address_space();
 
     /* the main exe needs to be the first in the load order list */




More information about the wine-cvs mailing list