Alexandre Julliard : server: Don' t return the process exe file to the client.

Alexandre Julliard julliard at winehq.org
Mon Sep 24 15:48:23 CDT 2018


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Sep 24 19:16:40 2018 +0200

server: Don't return the process exe file to the client.

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

---

 dlls/ntdll/loader.c            |  4 +---
 dlls/ntdll/ntdll_misc.h        |  2 +-
 dlls/ntdll/thread.c            | 10 +++-------
 include/wine/server_protocol.h |  4 ++--
 server/process.c               |  3 ---
 server/protocol.def            |  1 -
 server/request.h               |  3 +--
 server/trace.c                 |  3 +--
 8 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 26b2431..a66a708 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -117,7 +117,6 @@ struct builtin_load_info
 static struct builtin_load_info default_load_info;
 static struct builtin_load_info *builtin_load_info = &default_load_info;
 
-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 */
 LIST_ENTRY tls_links = { &tls_links, &tls_links };
@@ -3331,7 +3330,6 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
     PEB *peb = NtCurrentTeb()->Peb;
 
     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) */
     wm = get_modref( peb->ImageBaseAddress );
@@ -3506,7 +3504,7 @@ void __wine_process_init(void)
     ANSI_STRING func_name;
     void (* DECLSPEC_NORETURN CDECL init_func)(void);
 
-    main_exe_file = thread_init();
+    thread_init();
 
     /* retrieve current umask */
     FILE_umask = umask(0777);
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 165f083..85ba707 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -73,7 +73,7 @@ extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
 extern void DECLSPEC_NORETURN signal_exit_process( int status ) DECLSPEC_HIDDEN;
 extern void version_init( const WCHAR *appname ) DECLSPEC_HIDDEN;
 extern void debug_init(void) DECLSPEC_HIDDEN;
-extern HANDLE thread_init(void) DECLSPEC_HIDDEN;
+extern void thread_init(void) DECLSPEC_HIDDEN;
 extern void actctx_init(void) DECLSPEC_HIDDEN;
 extern void virtual_init(void) DECLSPEC_HIDDEN;
 extern void virtual_init_threading(void) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 8171638..3019a74 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -105,7 +105,7 @@ static inline void get_unicode_string( UNICODE_STRING *str, WCHAR **src, WCHAR *
  *
  * Fill the RTL_USER_PROCESS_PARAMETERS structure from the server.
  */
-static NTSTATUS init_user_process_params( SIZE_T data_size, HANDLE *exe_file )
+static NTSTATUS init_user_process_params( SIZE_T data_size )
 {
     void *ptr;
     WCHAR *src, *dst;
@@ -125,7 +125,6 @@ static NTSTATUS init_user_process_params( SIZE_T data_size, HANDLE *exe_file )
             data_size = wine_server_reply_size( reply );
             info_size = reply->info_size;
             env_size  = data_size - info_size;
-            *exe_file = wine_server_ptr_handle( reply->exe_file );
         }
     }
     SERVER_END_REQ;
@@ -273,13 +272,12 @@ static ULONG_PTR get_image_addr(void)
  *
  * NOTES: The first allocated TEB on NT is at 0x7ffde000.
  */
-HANDLE thread_init(void)
+void thread_init(void)
 {
     TEB *teb;
     void *addr;
     BOOL suspend;
     SIZE_T size, info_size;
-    HANDLE exe_file = 0;
     LARGE_INTEGER now;
     NTSTATUS status;
     struct ntdll_thread_data *thread_data;
@@ -378,7 +376,7 @@ HANDLE thread_init(void)
     /* allocate user parameters */
     if (info_size)
     {
-        init_user_process_params( info_size, &exe_file );
+        init_user_process_params( info_size );
     }
     else
     {
@@ -404,8 +402,6 @@ HANDLE thread_init(void)
     fill_cpu_info();
 
     NtCreateKeyedEvent( &keyed_event, GENERIC_READ | GENERIC_WRITE, NULL, 0 );
-
-    return exe_file;
 }
 
 
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 051fbc6..e8611ce 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -785,10 +785,10 @@ struct get_startup_info_request
 struct get_startup_info_reply
 {
     struct reply_header __header;
-    obj_handle_t exe_file;
     data_size_t  info_size;
     /* VARARG(info,startup_info,info_size); */
     /* VARARG(env,unicode_str); */
+    char __pad_12[4];
 };
 
 
@@ -6531,6 +6531,6 @@ union generic_reply
     struct terminate_job_reply terminate_job_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 564
+#define SERVER_PROTOCOL_VERSION 565
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/process.c b/server/process.c
index d497626..b512141 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1261,9 +1261,6 @@ DECL_HANDLER(get_startup_info)
 
     if (!info) return;
 
-    if (process->exe_file &&
-        !(reply->exe_file = alloc_handle( process, process->exe_file, GENERIC_READ, 0 ))) return;
-
     /* we return the data directly without making a copy so this can only be called once */
     reply->info_size = info->info_size;
     size = info->data_size;
diff --git a/server/protocol.def b/server/protocol.def
index 9fb38f7..1a76f22 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -778,7 +778,6 @@ struct rawinput_device
 /* Retrieve the new process startup info */
 @REQ(get_startup_info)
 @REPLY
-    obj_handle_t exe_file;     /* file handle for main exe */
     data_size_t  info_size;    /* size of startup info */
     VARARG(info,startup_info,info_size); /* startup information */
     VARARG(env,unicode_str);   /* environment */
diff --git a/server/request.h b/server/request.h
index f498a94..0e3f465 100644
--- a/server/request.h
+++ b/server/request.h
@@ -756,8 +756,7 @@ C_ASSERT( FIELD_OFFSET(struct new_thread_reply, tid) == 8 );
 C_ASSERT( FIELD_OFFSET(struct new_thread_reply, handle) == 12 );
 C_ASSERT( sizeof(struct new_thread_reply) == 16 );
 C_ASSERT( sizeof(struct get_startup_info_request) == 16 );
-C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, exe_file) == 8 );
-C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, info_size) == 12 );
+C_ASSERT( FIELD_OFFSET(struct get_startup_info_reply, info_size) == 8 );
 C_ASSERT( sizeof(struct get_startup_info_reply) == 16 );
 C_ASSERT( FIELD_OFFSET(struct init_process_done_request, gui) == 12 );
 C_ASSERT( FIELD_OFFSET(struct init_process_done_request, module) == 16 );
diff --git a/server/trace.c b/server/trace.c
index a2fe660..7b54c4f 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1276,8 +1276,7 @@ static void dump_get_startup_info_request( const struct get_startup_info_request
 
 static void dump_get_startup_info_reply( const struct get_startup_info_reply *req )
 {
-    fprintf( stderr, " exe_file=%04x", req->exe_file );
-    fprintf( stderr, ", info_size=%u", req->info_size );
+    fprintf( stderr, " info_size=%u", req->info_size );
     dump_varargs_startup_info( ", info=", min(cur_size,req->info_size) );
     dump_varargs_unicode_str( ", env=", cur_size );
 }




More information about the wine-cvs mailing list