ntdll: Implement DbgUiIssueRemoteBreakin.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-07-05 13:21:14 +02:00 committed by Alexandre Julliard
parent b37eb06ba3
commit 7f9faf10c7
9 changed files with 59 additions and 12 deletions

View File

@ -584,14 +584,6 @@ ULONG WINAPIV EtwTraceMessage( TRACEHANDLE handle, ULONG flags, LPGUID guid, USH
return ret;
}
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
void WINAPI DbgUiRemoteBreakin( void *arg )
{
FIXME("stub\n");
}
NTSTATUS WINAPI NtCreateLowBoxToken(HANDLE *token_handle, HANDLE existing_token_handle, ACCESS_MASK desired_access,
OBJECT_ATTRIBUTES *object_attributes, SID *package_sid, ULONG capability_count,
SID_AND_ATTRIBUTES *capabilities, ULONG handle_count, HANDLE *handle)

View File

@ -39,7 +39,7 @@
@ stub DbgUiConvertStateChangeStructure
# @ stub DbgUiDebugActiveProcess
# @ stub DbgUiGetThreadDebugObject
# @ stub DbgUiIssueRemoteBreakin
@ stdcall DbgUiIssueRemoteBreakin(long)
@ stdcall DbgUiRemoteBreakin(ptr)
# @ stub DbgUiSetThreadDebugObject
# @ stub DbgUiStopDebugging

View File

@ -1365,3 +1365,32 @@ done:
RtlFreeHeap( GetProcessHeap(), 0, unixdir );
return status;
}
/***********************************************************************
* DbgUiRemoteBreakin (NTDLL.@)
*/
void WINAPI DbgUiRemoteBreakin( void *arg )
{
TRACE( "\n" );
if (NtCurrentTeb()->Peb->BeingDebugged) DbgBreakPoint();
RtlExitUserThread( STATUS_SUCCESS );
}
/***********************************************************************
* DbgUiIssueRemoteBreakin (NTDLL.@)
*/
NTSTATUS WINAPI DbgUiIssueRemoteBreakin( HANDLE process )
{
apc_call_t call;
apc_result_t result;
NTSTATUS status;
TRACE( "(%p)\n", process );
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;
}

View File

@ -575,6 +575,11 @@ BOOL invoke_apc( const apc_call_t *call, apc_result_t *result )
else result->create_thread.status = STATUS_INVALID_PARAMETER;
break;
}
case APC_BREAK_PROCESS:
result->type = APC_BREAK_PROCESS;
result->break_process.status = RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, NULL, 0, 0,
DbgUiRemoteBreakin, NULL, NULL, NULL );
break;
default:
server_protocol_error( "get_apc_request: bad type %d\n", call->type );
break;

View File

@ -449,7 +449,8 @@ enum apc_type
APC_VIRTUAL_UNLOCK,
APC_MAP_VIEW,
APC_UNMAP_VIEW,
APC_CREATE_THREAD
APC_CREATE_THREAD,
APC_BREAK_PROCESS
};
typedef union
@ -638,6 +639,11 @@ typedef union
thread_id_t tid;
obj_handle_t handle;
} create_thread;
struct
{
enum apc_type type;
unsigned int status;
} break_process;
} apc_result_t;
enum irp_type
@ -6702,6 +6708,6 @@ union generic_reply
struct resume_process_reply resume_process_reply;
};
#define SERVER_PROTOCOL_VERSION 585
#define SERVER_PROTOCOL_VERSION 586
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -2294,6 +2294,8 @@ NTSYSAPI void WINAPI DbgUserBreakPoint(void);
#endif /* __i386__ && __GNUC__ */
NTSYSAPI NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
NTSYSAPI NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);
NTSYSAPI NTSTATUS WINAPI DbgUiIssueRemoteBreakin(HANDLE);
NTSYSAPI void WINAPI DbgUiRemoteBreakin(void*);
NTSYSAPI NTSTATUS WINAPI LdrAccessResource(HMODULE,const IMAGE_RESOURCE_DATA_ENTRY*,void**,PULONG);
NTSYSAPI NTSTATUS WINAPI LdrAddRefDll(ULONG,HMODULE);
NTSYSAPI NTSTATUS WINAPI LdrFindResourceDirectory_U(HMODULE,const LDR_RESOURCE_INFO*,ULONG,const IMAGE_RESOURCE_DIRECTORY**);

View File

@ -465,7 +465,8 @@ enum apc_type
APC_VIRTUAL_UNLOCK,
APC_MAP_VIEW,
APC_UNMAP_VIEW,
APC_CREATE_THREAD
APC_CREATE_THREAD,
APC_BREAK_PROCESS
};
typedef union
@ -654,6 +655,11 @@ typedef union
thread_id_t tid; /* thread id */
obj_handle_t handle; /* handle to new thread */
} create_thread;
struct
{
enum apc_type type; /* APC_BREAK_PROCESS */
unsigned int status; /* status returned by call */
} break_process;
} apc_result_t;
enum irp_type

View File

@ -1643,6 +1643,7 @@ DECL_HANDLER(queue_apc)
}
break;
case APC_CREATE_THREAD:
case APC_BREAK_PROCESS:
process = get_process_from_handle( req->handle, PROCESS_CREATE_THREAD );
break;
default:

View File

@ -218,6 +218,9 @@ static void dump_apc_call( const char *prefix, const apc_call_t *call )
dump_uint64( ",commit=", &call->create_thread.commit );
fprintf( stderr, ",suspend=%u", call->create_thread.suspend );
break;
case APC_BREAK_PROCESS:
fprintf( stderr, "APC_BREAK_PROCESS" );
break;
default:
fprintf( stderr, "type=%u", call->type );
break;
@ -298,6 +301,9 @@ static void dump_apc_result( const char *prefix, const apc_result_t *result )
get_status_name( result->create_thread.status ),
result->create_thread.tid, result->create_thread.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;