ntdll: Create a remote thread in DbgUiIssueRemoteBreakin().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-11-09 12:33:30 +01:00
parent e5d37832ee
commit 8dc6987ba5
9 changed files with 12 additions and 47 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -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
*/

View File

@ -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;

View File

@ -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 );

View File

@ -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 ### */

View File

@ -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

View File

@ -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:

View File

@ -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;