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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-02-14 16:45:03 +01:00
parent 698b26a432
commit 42df4dccd5
2 changed files with 7 additions and 6 deletions

View File

@ -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() );

View File

@ -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 );
}