Alexandre Julliard : Revert "ntdll: Get rid of the server_init_process_done() Unix library callback."
Alexandre Julliard
julliard at winehq.org
Fri Aug 28 15:17:59 CDT 2020
Module: wine
Branch: master
Commit: 2b9a0550bcda166afdf852370397e1041c096f5f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2b9a0550bcda166afdf852370397e1041c096f5f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Aug 28 21:05:37 2020 +0200
Revert "ntdll: Get rid of the server_init_process_done() Unix library callback."
This partially reverts commit 1581fb619b879b58a402bc64ad81bde265b926e8.
Steam wants Eip to be valid even before LdrInitializeThunk.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/loader.c | 6 ++----
dlls/ntdll/unix/loader.c | 2 +-
dlls/ntdll/unix/server.c | 4 ++--
dlls/ntdll/unix/unix_private.h | 2 +-
dlls/ntdll/unixlib.h | 5 ++++-
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index d3ade9555b..8e76e39fa5 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3426,16 +3426,12 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
#ifdef __i386__
entry = (void **)&context->Eax;
- if (!context->Eip) context->Eip = (DWORD_PTR)kernel32_start_process;
#elif defined(__x86_64__)
entry = (void **)&context->Rcx;
- if (!context->Rip) context->Rip = (DWORD_PTR)kernel32_start_process;
#elif defined(__arm__)
entry = (void **)&context->R0;
- if (!context->Pc) context->Pc = (DWORD_PTR)kernel32_start_process;
#elif defined(__aarch64__)
entry = (void **)&context->u.s.X0;
- if (!context->Pc) context->Pc = (DWORD_PTR)kernel32_start_process;
#endif
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
@@ -4053,6 +4049,8 @@ static void process_init(void)
teb->Tib.StackBase = stack.StackBase;
teb->Tib.StackLimit = stack.StackLimit;
teb->DeallocationStack = stack.DeallocationStack;
+
+ unix_funcs->server_init_process_done( kernel32_start_process );
}
/***********************************************************************
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 6f25f4ae87..ff75581286 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1368,6 +1368,7 @@ static struct unix_funcs unix_funcs =
get_locales,
virtual_release_address_space,
exec_process,
+ server_init_process_done,
set_show_dot_files,
load_so_dll,
load_builtin_dll,
@@ -1400,7 +1401,6 @@ static void start_main_thread(void)
init_files();
NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
p__wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs );
- server_init_process_done();
}
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index cc46b02bb7..6d96f581b7 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -1453,7 +1453,7 @@ void server_init_process(void)
/***********************************************************************
* server_init_process_done
*/
-void server_init_process_done(void)
+void CDECL server_init_process_done( void *relay )
{
PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt = get_exe_nt_header();
@@ -1486,7 +1486,7 @@ void server_init_process_done(void)
SERVER_END_REQ;
assert( !status );
- signal_start_thread( entry, peb, suspend, NULL, pLdrInitializeThunk, NtCurrentTeb() );
+ signal_start_thread( entry, peb, suspend, relay, pLdrInitializeThunk, NtCurrentTeb() );
}
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 813d65fc22..76410b0b2a 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -117,6 +117,7 @@ extern USHORT * CDECL get_unix_codepage_data(void) DECLSPEC_HIDDEN;
extern void CDECL get_locales( WCHAR *sys, WCHAR *user ) DECLSPEC_HIDDEN;
extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
+extern void CDECL server_init_process_done( void *relay ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
CONTEXT *context ) DECLSPEC_HIDDEN;
@@ -166,7 +167,6 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
extern void server_init_process(void) DECLSPEC_HIDDEN;
-extern void server_init_process_done(void) DECLSPEC_HIDDEN;
extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN;
extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index 0fa5bba4d8..4c352c0a4b 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -27,7 +27,7 @@
struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 100
+#define NTDLL_UNIXLIB_VERSION 101
struct unix_funcs
{
@@ -84,6 +84,9 @@ struct unix_funcs
/* thread/process functions */
NTSTATUS (CDECL *exec_process)( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTSTATUS status );
+ /* server functions */
+ void (CDECL *server_init_process_done)( void *relay );
+
/* file functions */
void (CDECL *set_show_dot_files)( BOOL enable );
More information about the wine-cvs
mailing list