Alexandre Julliard : ntdll: Create a remote thread in DbgUiIssueRemoteBreakin().

Alexandre Julliard julliard at winehq.org
Tue Nov 9 15:55:06 CST 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Nov  9 12:33:30 2021 +0100

ntdll: Create a remote thread in DbgUiIssueRemoteBreakin().

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

---

 dlls/ntdll/process.c           |  9 ++++++++-
 dlls/ntdll/unix/loader.c       |  3 ---
 dlls/ntdll/unix/server.c       | 28 ----------------------------
 dlls/ntdll/unix/unix_private.h |  1 -
 dlls/ntdll/unixlib.h           |  3 +--
 include/wine/server_protocol.h |  5 ++---
 server/protocol.def            |  3 +--
 server/thread.c                |  1 -
 server/trace.c                 |  6 ------
 9 files changed, 12 insertions(+), 47 deletions(-)

diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 160b1f549c9..82b8daa47af 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -552,5 +552,12 @@ void WINAPI DbgUiRemoteBreakin( void *arg )
  */
 NTSTATUS WINAPI DbgUiIssueRemoteBreakin( HANDLE process )
 {
-    return unix_funcs->DbgUiIssueRemoteBreakin( process );
+    HANDLE handle;
+    NTSTATUS status;
+    OBJECT_ATTRIBUTES attr = { sizeof(attr) };
+
+    status = NtCreateThreadEx( &handle, THREAD_ALL_ACCESS, &attr, process,
+                               DbgUiRemoteBreakin, NULL, 0, 0, 0, 0, NULL );
+    if (!status) NtClose( handle );
+    return status;
 }
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index ea7f18602da..99226d472da 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -110,7 +110,6 @@ static const char so_dir[] = "/aarch64-unix";
 static const char so_dir[] = "";
 #endif
 
-void     (WINAPI *pDbgUiRemoteBreakin)( void *arg ) = NULL;
 NTSTATUS (WINAPI *pKiRaiseUserExceptionDispatcher)(void) = NULL;
 NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) = NULL;
 void     (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) = NULL;
@@ -1082,7 +1081,6 @@ static void load_ntdll_functions( HMODULE module )
     if (!(p##name = (void *)find_named_export( module, ntdll_exports, #name ))) \
         ERR( "%s not found\n", #name )
 
-    GET_FUNC( DbgUiRemoteBreakin );
     GET_FUNC( KiRaiseUserExceptionDispatcher );
     GET_FUNC( KiUserExceptionDispatcher );
     GET_FUNC( KiUserApcDispatcher );
@@ -2144,7 +2142,6 @@ static struct unix_funcs unix_funcs =
 #ifdef __aarch64__
     NtCurrentTeb,
 #endif
-    DbgUiIssueRemoteBreakin,
     RtlGetSystemTimePrecise,
     RtlWaitOnAddress,
     RtlWakeAddressAll,
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 46d403df326..399b1cceb16 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -574,17 +574,6 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
         if (!self) NtClose( wine_server_ptr_handle(call->dup_handle.dst_process) );
         break;
     }
-    case APC_BREAK_PROCESS:
-    {
-        HANDLE handle;
-
-        result->type = APC_BREAK_PROCESS;
-        result->break_process.status = NtCreateThreadEx( &handle, THREAD_ALL_ACCESS, NULL,
-                                                         NtCurrentProcess(), pDbgUiRemoteBreakin, NULL,
-                                                         0, 0, 0, 0, NULL );
-        if (!result->break_process.status) NtClose( handle );
-        break;
-    }
     default:
         server_protocol_error( "get_apc_request: bad type %d\n", call->type );
         break;
@@ -1639,23 +1628,6 @@ void server_init_thread( void *entry_point, BOOL *suspend )
 }
 
 
-/***********************************************************************
- *           DbgUiIssueRemoteBreakin
- */
-NTSTATUS WINAPI DbgUiIssueRemoteBreakin( HANDLE process )
-{
-    apc_call_t call;
-    apc_result_t result;
-    NTSTATUS status;
-
-    memset( &call, 0, sizeof(call) );
-    call.type = APC_BREAK_PROCESS;
-    status = server_queue_process_apc( process, &call, &result );
-    if (status) return status;
-    return result.break_process.status;
-}
-
-
 /******************************************************************************
  *           NtDuplicateObject
  */
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 6b8835bcba0..641de0c465f 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -92,7 +92,6 @@ static const LONG teb_offset = 0x2000;
 #define FILE_USE_FILE_POINTER_POSITION ((LONGLONG)-2)
 
 /* callbacks to PE ntdll from the Unix side */
-extern void     (WINAPI *pDbgUiRemoteBreakin)( void *arg ) DECLSPEC_HIDDEN;
 extern NTSTATUS (WINAPI *pKiRaiseUserExceptionDispatcher)(void) DECLSPEC_HIDDEN;
 extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
 extern void     (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h
index d56259deff2..62030d91cdb 100644
--- a/dlls/ntdll/unixlib.h
+++ b/dlls/ntdll/unixlib.h
@@ -26,7 +26,7 @@
 struct _DISPATCHER_CONTEXT;
 
 /* increment this when you change the function table */
-#define NTDLL_UNIXLIB_VERSION 127
+#define NTDLL_UNIXLIB_VERSION 128
 
 struct unix_funcs
 {
@@ -36,7 +36,6 @@ struct unix_funcs
 #endif
 
     /* other Win32 API functions */
-    NTSTATUS      (WINAPI *DbgUiIssueRemoteBreakin)( HANDLE process );
     LONGLONG      (WINAPI *RtlGetSystemTimePrecise)(void);
     NTSTATUS      (WINAPI *RtlWaitOnAddress)( const void *addr, const void *cmp, SIZE_T size,
                                               const LARGE_INTEGER *timeout );
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index c561b48714d..5a66e9aff8f 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -470,8 +470,7 @@ enum apc_type
     APC_MAP_VIEW,
     APC_UNMAP_VIEW,
     APC_CREATE_THREAD,
-    APC_DUP_HANDLE,
-    APC_BREAK_PROCESS
+    APC_DUP_HANDLE
 };
 
 typedef struct
@@ -6263,7 +6262,7 @@ union generic_reply
 
 /* ### protocol_version begin ### */
 
-#define SERVER_PROTOCOL_VERSION 735
+#define SERVER_PROTOCOL_VERSION 736
 
 /* ### protocol_version end ### */
 
diff --git a/server/protocol.def b/server/protocol.def
index 6a25db0326f..ad6d2bb58d0 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -486,8 +486,7 @@ enum apc_type
     APC_MAP_VIEW,
     APC_UNMAP_VIEW,
     APC_CREATE_THREAD,
-    APC_DUP_HANDLE,
-    APC_BREAK_PROCESS
+    APC_DUP_HANDLE
 };
 
 typedef struct
diff --git a/server/thread.c b/server/thread.c
index b85df68af92..55eb8513af8 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1734,7 +1734,6 @@ DECL_HANDLER(queue_apc)
         }
         break;
     case APC_CREATE_THREAD:
-    case APC_BREAK_PROCESS:
         process = get_process_from_handle( req->handle, PROCESS_CREATE_THREAD );
         break;
     case APC_DUP_HANDLE:
diff --git a/server/trace.c b/server/trace.c
index 6e78f8281f0..903e323273b 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -237,9 +237,6 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
                  call->dup_handle.src_handle, call->dup_handle.dst_process, call->dup_handle.access,
                  call->dup_handle.attributes, call->dup_handle.options );
         break;
-    case APC_BREAK_PROCESS:
-        fprintf( stderr, "APC_BREAK_PROCESS" );
-        break;
     default:
         fprintf( stderr, "type=%u", call->type );
         break;
@@ -324,9 +321,6 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result )
         fprintf( stderr, "APC_DUP_HANDLE,status=%s,handle=%04x",
                  get_status_name( result->dup_handle.status ), result->dup_handle.handle );
         break;
-    case APC_BREAK_PROCESS:
-        fprintf( stderr, "APC_BREAK_PROCESS,status=%s", get_status_name( result->break_process.status ) );
-        break;
     default:
         fprintf( stderr, "type=%u", result->type );
         break;




More information about the wine-cvs mailing list