Rizin
unix-like reverse engineering framework and cli tools
|
#include <ntstatus.h>
#include "windows_debug.h"
#include "../../common_windows.h"
#include <w32dbg_wrap.h>
Go to the source code of this file.
Macros | |
#define | WIN32_NO_STATUS |
#define | SystemHandleInformation 16 |
Variables | |
const DWORD | wait_time = 1000 |
static RzList * | lib_list = NULL |
static bool | breaked = false |
#define SystemHandleInformation 16 |
Definition at line 14 of file windows_debug.c.
#define WIN32_NO_STATUS |
Definition at line 5 of file windows_debug.c.
Definition at line 782 of file windows_debug.c.
References LIB_ITEM::BaseOfDll, LIB_ITEM::hFile, lib_list, libfree(), LIB_ITEM::Name, NULL, LIB_ITEM::Path, LIB_ITEM::pid, pid, rz_file_basename(), rz_list_append(), rz_list_newf(), RZ_LOG_ERROR, RZ_NEW0, and strdup().
Referenced by w32_dbg_wait().
|
static |
Definition at line 107 of file windows_debug.c.
References dbg, find_thread(), free(), NULL, pid, rz_list_append(), rz_list_newf(), RZ_LOG_ERROR, RZ_NEW0, rz_return_val_if_fail, and rz_debug_t::threads.
Referenced by w32_dbg_wait().
|
inlinestatic |
Definition at line 594 of file windows_debug.c.
References W32DbgWInst::pi, and pid.
Referenced by w32_attach().
|
static |
Definition at line 1425 of file windows_debug.c.
References DWORD, free(), get_process_path(), path, ph, pid, rz_debug_pid_t::ppid, and rz_debug_pid_new().
Referenced by w32_pid_list().
|
inlinestatic |
Definition at line 155 of file windows_debug.c.
References resume_thread().
Referenced by w32_continue().
|
static |
Definition at line 773 of file windows_debug.c.
References rz_list_iter_t::data, findlibcmp(), lib_list, NULL, and rz_list_find().
Referenced by w32_dbg_wait().
|
inlinestatic |
Definition at line 99 of file windows_debug.c.
References rz_list_iter_t::data, dbg, NULL, rz_list_find(), rz_debug_t::threads, and w32_findthread_cmp().
Referenced by add_thread(), get_thread_handle_from_tid(), is_thread_alive(), uv_resident_set_memory(), w32_continue(), w32_dbg_wait(), w32_info(), w32_select(), and w32_thread_list().
|
static |
Definition at line 768 of file windows_debug.c.
References LIB_ITEM::BaseOfDll, LIB_ITEM::hFile, and INVALID_HANDLE_VALUE.
Referenced by find_library().
|
inlinestatic |
Definition at line 409 of file windows_debug.c.
References control, RZ_PERM_R, RZ_PERM_RW, RZ_PERM_W, and value.
Referenced by w32_hwbp_arm_add(), and w32_hwbp_arm_del().
Definition at line 400 of file windows_debug.c.
References control, type, and value.
Referenced by w32_hwbp_arm_add(), and w32_hwbp_arm_del().
|
static |
Definition at line 1249 of file windows_debug.c.
References DWORD, FALSE, NULL, path, ph, pid, resolve_path(), and autogen_x86imm::tmp.
Referenced by build_debug_pid(), and w32_thread_list().
Definition at line 199 of file windows_debug.c.
References is_process_alive(), memcpy(), and rz_sys_perror.
Referenced by w32_dbg_wait(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), and w32_reg_read().
Definition at line 529 of file windows_debug.c.
References dbg, find_thread(), HANDLE, THREAD_ITEM::hThread, NULL, W32DbgWInst::pi, rz_debug_t::plugin_data, and rz_return_val_if_fail.
Referenced by w32_reg_read(), and w32_reg_write().
Definition at line 1206 of file windows_debug.c.
References RZ_PERM_R, RZ_PERM_RW, RZ_PERM_RWX, RZ_PERM_W, and RZ_PERM_X.
Referenced by w32_map_protect().
|
inlinestatic |
Definition at line 434 of file windows_debug.c.
Referenced by w32_hwbp_arm_add(), and w32_hwbp_arm_del().
Definition at line 177 of file windows_debug.c.
References code, DWORD, and ph.
Referenced by get_thread_context().
Definition at line 162 of file windows_debug.c.
References THREAD_ITEM::bFinished, dbg, find_thread(), and THREAD_ITEM::hThread.
Referenced by w32_dbg_wait(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), w32_reg_read(), w32_reg_write(), and w32_select().
|
inlinestatic |
Definition at line 430 of file windows_debug.c.
References b, RZ_PERM_R, RZ_PERM_RW, and RZ_PERM_W.
Referenced by w32_hwbp_arm_add(), and w32_hwbp_arm_del().
|
static |
Definition at line 811 of file windows_debug.c.
References lib_list, and NULL.
Referenced by w32_info().
|
static |
Definition at line 758 of file windows_debug.c.
References free(), LIB_ITEM::hFile, INVALID_HANDLE_VALUE, LIB_ITEM::Name, and LIB_ITEM::Path.
Referenced by add_library().
|
inlinestatic |
|
static |
Definition at line 391 of file windows_debug.c.
Referenced by w32_reg_read().
|
static |
Definition at line 778 of file windows_debug.c.
References lib_list, and rz_list_delete_data().
Referenced by w32_dbg_wait().
Definition at line 716 of file windows_debug.c.
References DWORD, get_file_name_from_handle(), L, length, name, NULL, path, ph, and autogen_x86imm::tmp.
Referenced by get_process_path(), w32_dbg_wait(), and w32_info_exe().
Definition at line 147 of file windows_debug.c.
References rz_sys_perror.
Referenced by continue_thread(), w32_dbg_wait(), w32_detach(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), w32_reg_read(), and w32_reg_write().
Definition at line 188 of file windows_debug.c.
References memcpy(), RZ_MIN, and rz_sys_perror.
Referenced by w32_hwbp_arm_add(), w32_hwbp_arm_del(), and w32_reg_write().
Definition at line 16 of file windows_debug.c.
References b, FALSE, HANDLE, and NULL.
Referenced by w32_init().
Definition at line 139 of file windows_debug.c.
References rz_sys_perror.
Referenced by w32_dbg_wait(), w32_hwbp_arm_add(), w32_hwbp_arm_del(), w32_reg_read(), w32_reg_write(), and w32_select().
Definition at line 387 of file windows_debug.c.
Referenced by w32_reg_write().
Definition at line 598 of file windows_debug.c.
References already_attached(), rz_debug_t::cur, dbg, INVALID_HANDLE_VALUE, rz_debug_t::main_pid, NULL, W32DbgWInst::params, W32DbgWInst::pi, pid, rz_debug_t::plugin_data, W32DbgWParams::ret, rz_debug_continue(), rz_sys_perror, W32DbgWParams::type, W32_ATTACH, w32dbg_wrap_wait_ret(), w32dbgw_err, and rz_debug_plugin_t::wait.
Referenced by w32_attach_new_process().
Definition at line 817 of file windows_debug.c.
References dbg, eprintf, rz_debug_t::pid, pid, rz_debug_select(), rz_debug_t::tid, w32_attach(), and w32_detach().
Referenced by w32_select().
void w32_break_process | ( | void * | user | ) |
Definition at line 912 of file windows_debug.c.
References breaked, rz_core_bind_t::cfggeti, rz_core_bind_t::core, rz_debug_t::corebind, dbg, eprintf, W32DbgWInst::pi, rz_debug_t::plugin_data, rz_sys_perror, and w32_select().
Referenced by w32_dbg_wait().
Definition at line 1144 of file windows_debug.c.
References THREAD_ITEM::bFinished, breaked, THREAD_ITEM::bSuspended, W32DbgWParams::continue_status, continue_thread(), dbg, find_thread(), THREAD_ITEM::hThread, INVALID_HANDLE_VALUE, W32DbgWInst::params, pid, rz_debug_t::plugin_data, rz_list_delete_data(), rz_sys_perror, rz_debug_t::threads, rz_debug_t::tid, W32DbgWParams::type, W32_CONTINUE, w32_select(), w32dbg_wrap_wait_ret(), w32dbgw_err, and w32dbgw_ret.
Referenced by w32_dbg_wait().
Definition at line 927 of file windows_debug.c.
References add_library(), add_thread(), rz_debug_reason_t::addr, THREAD_ITEM::bFinished, rz_debug_t::bits, rz_debug_t::bp, breaked, calloc(), rz_core_bind_t::cmdf, rz_core_bind_t::core, rz_debug_t::corebind, dbg, THREAD_ITEM::dwExitCode, test_evm::end, eprintf, EXCEPTION_BREAKPOINT, EXCEPTION_SINGLE_STEP, FALSE, find_library(), find_thread(), free(), get_thread_context(), THREAD_ITEM::hThread, is_thread_alive(), lib_list, rz_debug_t::main_pid, memset(), NULL, W32DbgWInst::params, W32DbgWInst::pi, rz_debug_t::pid, pid, rz_debug_t::plugin_data, rz_debug_t::reason, remove_library(), resolve_path(), resume_thread(), rz_bp_get_at(), rz_cons_break_pop(), rz_cons_break_push(), rz_cons_sleep_begin(), rz_cons_sleep_end(), RZ_DEBUG_REASON_BREAKPOINT, RZ_DEBUG_REASON_DEAD, RZ_DEBUG_REASON_EXIT_LIB, RZ_DEBUG_REASON_EXIT_PID, RZ_DEBUG_REASON_EXIT_TID, RZ_DEBUG_REASON_NEW_LIB, RZ_DEBUG_REASON_NEW_PID, RZ_DEBUG_REASON_NEW_TID, RZ_DEBUG_REASON_SIGNAL, RZ_DEBUG_REASON_STEP, RZ_DEBUG_REASON_UNKNOWN, RZ_DEBUG_REASON_USERSUSP, rz_list_purge(), RZ_SYS_BITS_16, RZ_SYS_BITS_32, RZ_SYS_BITS_64, rz_sys_perror, rz_time_now(), rz_warn_if_reached, rz_debug_reason_t::signum, cmd_descs_generate::str, suspend_thread(), rz_debug_t::threads, rz_debug_reason_t::tid, rz_debug_t::tid, rz_debug_reason_t::timestamp, autogen_x86imm::tmp, TRUE, rz_debug_reason_t::type, W32DbgWParams::type, w32_break_process(), w32_continue(), w32_detach(), w32_select(), W32_WAIT, w32dbg_wrap_wait_ret(), w32dbgw_err, w32dbgw_ret, W32DbgWParams::wait, wait_time, W32DbgWInst::winbase, windows_exception_to_reason(), windows_is_exception_fatal(), and windows_print_exception_event().
Definition at line 1471 of file windows_debug.c.
References _UNICODE_STRING::Buffer, desc, FALSE, free(), _OBJECT_TYPE_INFORMATION::GenericMapping, handle, HANDLE, _SYSTEM_HANDLE_INFORMATION::HandleCount, _SYSTEM_HANDLE_INFORMATION::Handles, i, L, _UNICODE_STRING::Length, malloc(), _OBJECT_TYPE_INFORMATION::Name, NULL, ph, pid, PVOID, realloc(), rz_debug_desc_free(), rz_debug_desc_new(), rz_list_append(), rz_list_newf(), RZ_PERM_R, RZ_PERM_W, RZ_PERM_X, rz_sys_perror, status, STATUS_INFO_LENGTH_MISMATCH, SystemHandleInformation, autogen_x86imm::tmp, and ULONG.
Definition at line 622 of file windows_debug.c.
References THREAD_ITEM::bFinished, THREAD_ITEM::bSuspended, dbg, THREAD_ITEM::hThread, lib_list, memset(), W32DbgWInst::params, W32DbgWInst::pi, rz_debug_t::pid, pid, rz_debug_t::plugin_data, resume_thread(), W32DbgWParams::ret, rz_list_purge(), rz_debug_t::threads, W32DbgWParams::type, W32_DETACH, and w32dbg_wrap_wait_ret().
Referenced by w32_attach_new_process(), and w32_dbg_wait().
|
static |
Definition at line 95 of file windows_debug.c.
References THREAD_ITEM::tid.
Referenced by find_thread().
int w32_hwbp_arm_add | ( | RzDebug * | dbg, |
RzBreakpoint * | bp, | ||
RzBreakpointItem * | b | ||
) |
Definition at line 438 of file windows_debug.c.
References ARM64_MAX_BREAKPOINTS, ARM64_MAX_WATCHPOINTS, b, control, dbg, eprintf, get_arm64_hwwp_values(), get_arm_hwbp_values(), get_thread_context(), i, is_breakpoint(), is_thread_alive(), is_watchpoint(), W32DbgWInst::pi, rz_debug_t::plugin_data, resume_thread(), rz_return_val_if_fail, set_thread_context(), suspend_thread(), ut64(), and value.
int w32_hwbp_arm_del | ( | RzDebug * | dbg, |
RzBreakpoint * | bp, | ||
RzBreakpointItem * | b | ||
) |
Definition at line 485 of file windows_debug.c.
References ARM64_MAX_BREAKPOINTS, ARM64_MAX_WATCHPOINTS, b, rz_debug_t::bits, control, dbg, get_arm64_hwwp_values(), get_arm_hwbp_values(), get_thread_context(), i, is_breakpoint(), is_thread_alive(), is_watchpoint(), W32DbgWInst::pi, rz_debug_t::plugin_data, resume_thread(), set_thread_context(), suspend_thread(), ut64(), and value.
RzDebugInfo* w32_info | ( | RzDebug * | dbg, |
const char * | arg | ||
) |
Definition at line 1404 of file windows_debug.c.
References dbg, find_thread(), last_library(), NULL, rz_debug_t::pid, rdi, RZ_DBG_PROC_SLEEP, RZ_NEW0, rz_debug_t::tid, w32_info_exe(), and w32_info_user().
|
static |
Definition at line 1396 of file windows_debug.c.
References dbg, NULL, W32DbgWInst::pi, rz_debug_t::plugin_data, rdi, and resolve_path().
Referenced by w32_info().
|
static |
Definition at line 1339 of file windows_debug.c.
References dbg, DWORD, free(), HANDLE, LPWSTR, malloc(), NULL, W32DbgWInst::pi, rz_debug_t::plugin_data, rdi, rz_str_newf(), and rz_sys_perror.
Referenced by w32_info().
Definition at line 37 of file windows_debug.c.
References ACCESS_MASK, dbg, DWORD, DWORD64, eprintf, HANDLE, rz_io_bind_t::io, rz_debug_t::iob, L, LPWSTR, PDWORD, PDWORD64, PHANDLE, rz_debug_t::plugin_data, PULONG, PVOID, setup_debug_privileges(), ULONG, and ut64().
Definition at line 890 of file windows_debug.c.
References dbg, lib_list, NULL, W32DbgWInst::pi, rz_debug_t::plugin_data, rz_list_purge(), and rz_debug_t::threads.
RzDebugMap* w32_map_alloc | ( | RzDebug * | dbg, |
ut64 | addr, | ||
int | size | ||
) |
Definition at line 1186 of file windows_debug.c.
References addr, dbg, NULL, W32DbgWInst::pi, rz_debug_t::plugin_data, rz_debug_map_get(), rz_debug_map_sync(), rz_sys_perror, and ut64().
Definition at line 1197 of file windows_debug.c.
References addr, dbg, W32DbgWInst::pi, rz_debug_t::plugin_data, and rz_sys_perror.
Definition at line 1229 of file windows_debug.c.
References addr, dbg, DWORD, io_perms_to_prot(), W32DbgWInst::pi, and rz_debug_t::plugin_data.
Definition at line 1443 of file windows_debug.c.
References test_group_name::all, build_debug_pid(), dbg, HANDLE, INVALID_HANDLE_VALUE, list(), NULL, W32DbgWInst::pi, rz_debug_t::pid, pid, rz_debug_t::plugin_data, rz_list_append(), and rz_sys_perror.
Definition at line 544 of file windows_debug.c.
References CONTEXT_ALL, dbg, get_thread_context(), get_thread_handle_from_tid(), HANDLE, INVALID_HANDLE_VALUE, is_thread_alive(), print_fpu_context(), resume_thread(), suspend_thread(), rz_debug_t::tid, and type.
Referenced by w32_thread_list().
Definition at line 570 of file windows_debug.c.
References dbg, get_thread_handle_from_tid(), HANDLE, INVALID_HANDLE_VALUE, is_thread_alive(), resume_thread(), RZ_REG_TYPE_DRX, set_thread_context(), suspend_thread(), rz_debug_t::tid, transfer_drx(), and type.
Definition at line 837 of file windows_debug.c.
References THREAD_ITEM::bFinished, THREAD_ITEM::bSuspended, rz_core_bind_t::cfggeti, rz_core_bind_t::core, rz_debug_t::corebind, dbg, find_thread(), free(), THREAD_ITEM::hThread, is_thread_alive(), W32DbgWInst::pi, rz_debug_t::pid, pid, rz_debug_t::plugin_data, rz_list_newf(), suspend_thread(), rz_debug_t::threads, THREAD_ITEM::tid, rz_debug_t::tid, and w32_attach_new_process().
Referenced by w32_break_process(), w32_continue(), and w32_dbg_wait().
Definition at line 395 of file windows_debug.c.
Definition at line 1280 of file windows_debug.c.
References THREAD_ITEM::bFinished, THREAD_ITEM::bSuspended, dbg, DWORD, FALSE, find_thread(), free(), get_process_path(), HANDLE, INVALID_HANDLE_VALUE, list(), NULL, path, pc, pc_from_context(), ph, rz_debug_t::pid, pid, RZ_DBG_PROC_DEAD, RZ_DBG_PROC_RUN, RZ_DBG_PROC_SLEEP, rz_debug_pid_new(), rz_list_append(), RZ_REG_TYPE_GPR, rz_sys_perror, status, strdup(), rz_debug_t::tid, ut64(), and w32_reg_read().
Definition at line 815 of file windows_debug.c.
Referenced by rz_analysis_block_recurse(), rz_analysis_block_recurse_depth_first(), rz_analysis_block_recurse_followthrough(), rz_cons_break_clear(), rz_cons_break_end(), rz_cons_is_breaked(), rz_cons_memcat(), w32_break_process(), w32_continue(), and w32_dbg_wait().
Definition at line 12 of file windows_debug.c.
Referenced by add_library(), find_library(), last_library(), remove_library(), w32_dbg_wait(), w32_detach(), and w32_kill().
Definition at line 11 of file windows_debug.c.
Referenced by w32_dbg_wait().