Alexandre Julliard : server: Make the arguments for CreateRemoteThread client_ptr_t instead of void pointers .

Alexandre Julliard julliard at winehq.org
Wed Dec 31 07:44:58 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 30 15:30:11 2008 +0100

server: Make the arguments for CreateRemoteThread client_ptr_t instead of void pointers.

---

 dlls/ntdll/sync.c              |   10 +++++-----
 dlls/ntdll/thread.c            |    4 ++--
 include/wine/server_protocol.h |    8 ++++----
 server/protocol.def            |    6 +++---
 server/trace.c                 |    7 +++++--
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index ecfe6f7..ba8d65b 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -1007,16 +1007,16 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
         HANDLE handle;
         SIZE_T reserve = call->create_thread.reserve;
         SIZE_T commit = call->create_thread.commit;
+        void *func = wine_server_get_ptr( call->create_thread.func );
+        void *arg  = wine_server_get_ptr( call->create_thread.arg );
 
         result->type = call->type;
-        if (reserve == call->create_thread.reserve && commit == call->create_thread.commit)
+        if (reserve == call->create_thread.reserve && commit == call->create_thread.commit &&
+            (ULONG_PTR)func == call->create_thread.func && (ULONG_PTR)arg == call->create_thread.arg)
         {
             result->create_thread.status = RtlCreateUserThread( NtCurrentProcess(), NULL,
                                                                 call->create_thread.suspend, NULL,
-                                                                reserve, commit,
-                                                                call->create_thread.func,
-                                                                call->create_thread.arg,
-                                                                &handle, &id );
+                                                                reserve, commit, func, arg, &handle, &id );
             result->create_thread.handle = wine_server_obj_handle( handle );
             result->create_thread.tid = HandleToULong(id.UniqueThread);
         }
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index b164727..a79bdf3 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -483,8 +483,8 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
         memset( &call, 0, sizeof(call) );
 
         call.create_thread.type    = APC_CREATE_THREAD;
-        call.create_thread.func    = start;
-        call.create_thread.arg     = param;
+        call.create_thread.func    = wine_server_client_ptr( start );
+        call.create_thread.arg     = wine_server_client_ptr( param );
         call.create_thread.reserve = stack_reserve;
         call.create_thread.commit  = stack_commit;
         call.create_thread.suspend = suspended;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 6e60dab..521f727 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -362,11 +362,11 @@ typedef union
     struct
     {
         enum apc_type    type;
-        void (__stdcall *func)(void*);
-        void            *arg;
+        int              suspend;
+        client_ptr_t     func;
+        client_ptr_t     arg;
         mem_size_t       reserve;
         mem_size_t       commit;
-        int              suspend;
     } create_thread;
 } apc_call_t;
 
@@ -5059,6 +5059,6 @@ union generic_reply
     struct set_window_layered_info_reply set_window_layered_info_reply;
 };
 
-#define SERVER_PROTOCOL_VERSION 369
+#define SERVER_PROTOCOL_VERSION 370
 
 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/protocol.def b/server/protocol.def
index 966e900..62717a5 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -378,11 +378,11 @@ typedef union
     struct
     {
         enum apc_type    type;      /* APC_CREATE_THREAD */
-        void (__stdcall *func)(void*);  /* start function */
-        void            *arg;       /* argument for start function */
+        int              suspend;   /* suspended thread? */
+        client_ptr_t     func;      /* void (__stdcall *func)(void*);  start function */
+        client_ptr_t     arg;       /* argument for start function */
         mem_size_t       reserve;   /* reserve size for thread stack */
         mem_size_t       commit;    /* commit size for thread stack */
-        int              suspend;   /* suspended thread? */
     } create_thread;
 } apc_call_t;
 
diff --git a/server/trace.c b/server/trace.c
index 9954efd..d2a7cec 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -193,8 +193,11 @@ static void dump_apc_call( const apc_call_t *call )
         dump_uint64( &call->unmap_view.addr );
         break;
     case APC_CREATE_THREAD:
-        fprintf( stderr, "APC_CREATE_THREAD,func=%p,arg=%p,reserve=",
-                 call->create_thread.func, call->create_thread.arg );
+        fprintf( stderr, "APC_CREATE_THREAD,func=" );
+        dump_uint64( &call->create_thread.func );
+        fprintf( stderr, ",arg=" );
+        dump_uint64( &call->create_thread.arg );
+        fprintf( stderr, ",reserve=" );
         dump_uint64( &call->create_thread.reserve );
         fprintf( stderr, ",commit=" );
         dump_uint64( &call->create_thread.commit );




More information about the wine-cvs mailing list