Make retrieval of debug port object handle optional. Also, skip debug port object handle retrieval if serving requests that don't need it (i.e. ProcessDebugPort and ProcessDebugFlags).
This also eliminates the extra round trip to the server for closing the unneeded debug port object handle.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- dlls/ntdll/unix/process.c | 13 ++++--------- server/process.c | 2 +- server/protocol.def | 1 + 3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index c834ef85c79..dfe040eeb25 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1259,19 +1259,16 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class if (!info) ret = STATUS_ACCESS_VIOLATION; else { - HANDLE debug; - SERVER_START_REQ(get_process_debug_info) { req->handle = wine_server_obj_handle( handle ); + req->want_debug_obj = 0; ret = wine_server_call( req ); - debug = wine_server_ptr_handle( reply->debug ); } SERVER_END_REQ; if (ret == STATUS_SUCCESS) { *(DWORD_PTR *)info = ~0ul; - NtClose( debug ); } else if (ret == STATUS_PORT_NOT_SET) { @@ -1290,18 +1287,15 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class if (!info) ret = STATUS_ACCESS_VIOLATION; else { - HANDLE debug; - SERVER_START_REQ(get_process_debug_info) { req->handle = wine_server_obj_handle( handle ); + req->want_debug_obj = 0; ret = wine_server_call( req ); - debug = wine_server_ptr_handle( reply->debug ); *(DWORD *)info = reply->debug_children; } SERVER_END_REQ; - if (ret == STATUS_SUCCESS) NtClose( debug ); - else if (ret == STATUS_PORT_NOT_SET) ret = STATUS_SUCCESS; + if (ret == STATUS_PORT_NOT_SET) ret = STATUS_SUCCESS; } } else ret = STATUS_INFO_LENGTH_MISMATCH; @@ -1323,6 +1317,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class SERVER_START_REQ(get_process_debug_info) { req->handle = wine_server_obj_handle( handle ); + req->want_debug_obj = 1; ret = wine_server_call( req ); *(HANDLE *)info = wine_server_ptr_handle( reply->debug ); } diff --git a/server/process.c b/server/process.c index 81c94a3c81d..0f33dcfffa2 100644 --- a/server/process.c +++ b/server/process.c @@ -1528,7 +1528,7 @@ DECL_HANDLER(get_process_debug_info)
reply->debug_children = process->debug_children; if (!process->debug_obj) set_error( STATUS_PORT_NOT_SET ); - else reply->debug = alloc_handle( current->process, process->debug_obj, MAXIMUM_ALLOWED, 0 ); + else if (req->want_debug_obj) reply->debug = alloc_handle( current->process, process->debug_obj, MAXIMUM_ALLOWED, 0 ); release_object( process ); }
diff --git a/server/protocol.def b/server/protocol.def index c83e6a2ef7c..1e73e2783f8 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -968,6 +968,7 @@ typedef struct /* Retrieve debug information about a process */ @REQ(get_process_debug_info) obj_handle_t handle; /* process handle */ + int want_debug_obj; /* want debug port object? */ @REPLY obj_handle_t debug; /* handle to debug port */ int debug_children; /* inherit debugger to child processes */