Rizin
unix-like reverse engineering framework and cli tools
|
#include <assert.h>
#include <io.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include "uv.h"
#include "internal.h"
#include "handle-inl.h"
#include "stream-inl.h"
#include "req-inl.h"
Go to the source code of this file.
Macros | |
#define | COMMON_LVB_REVERSE_VIDEO 0x4000 |
#define | InterlockedOr _InterlockedOr |
#define | UNICODE_REPLACEMENT_CHARACTER (0xfffd) |
#define | ANSI_NORMAL 0x0000 |
#define | ANSI_ESCAPE_SEEN 0x0002 |
#define | ANSI_CSI 0x0004 |
#define | ANSI_ST_CONTROL 0x0008 |
#define | ANSI_IGNORE 0x0010 |
#define | ANSI_IN_ARG 0x0020 |
#define | ANSI_IN_STRING 0x0040 |
#define | ANSI_BACKSLASH_SEEN 0x0080 |
#define | ANSI_EXTENSION 0x0100 |
#define | ANSI_DECSCUSR 0x0200 |
#define | MAX_INPUT_BUFFER_LENGTH 8192 |
#define | MAX_CONSOLE_CHAR 8192 |
#define | ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 |
#define | CURSOR_SIZE_SMALL 25 |
#define | CURSOR_SIZE_LARGE 100 |
#define | VK_CASE(vk, normal_str, shift_str, ctrl_str, shift_ctrl_str) |
#define | KEV handle->tty.rd.last_input_record.Event.KeyEvent |
#define | FLIP_FGBG |
#define | FLUSH_TEXT() |
#define | ENSURE_BUFFER_SPACE(wchars_needed) |
Enumerations | |
enum | uv__read_console_status_e { NOT_STARTED , IN_PROGRESS , TRAP_REQUESTED , COMPLETED } |
#define ENSURE_BUFFER_SPACE | ( | wchars_needed | ) |
#define FLIP_FGBG |
#define FLUSH_TEXT | ( | ) |
#define KEV handle->tty.rd.last_input_record.Event.KeyEvent |
#define VK_CASE | ( | vk, | |
normal_str, | |||
shift_str, | |||
ctrl_str, | |||
shift_ctrl_str | |||
) |
Definition at line 631 of file tty.c.
References len, NULL, and VK_CASE.
Referenced by uv_process_tty_read_raw_req().
Definition at line 1084 of file tty.c.
References assert(), DWORD, err, handle, HANDLE, IN_PROGRESS, InterlockedExchange, InterlockedOr, INVALID_HANDLE_VALUE, L, LONG, NULL, status, TRAP_REQUESTED, TRUE, uv__read_console_status, uv__restore_screen_state, uv__saved_screen_state, UV_HANDLE_CANCELLATION_PENDING, uv_sem_post(), uv_sem_wait(), and uv_tty_output_lock.
Referenced by uv_tty_read_stop().
|
static |
Definition at line 2333 of file tty.c.
References DWORD, ENABLE_VIRTUAL_TERMINAL_PROCESSING, FALSE, handle, uv__need_check_vterm_state, uv__vterm_state, and UV_TTY_SUPPORTED.
Referenced by uv_tty_init().
|
static |
Definition at line 2397 of file tty.c.
References uv__tty_console_resized.
Referenced by uv__tty_console_resize_message_loop_thread().
|
static |
Definition at line 2349 of file tty.c.
References DWORD, FALSE, msg, MSG, NT_SUCCESS, NULL, pNtQueryInformationProcess, ProcessConsoleHostProcess, pSetWinEventHook, status, TRUE, uv__tty_console_resize_event(), uv__tty_console_resize_watcher_thread(), and uv__tty_console_resized.
Referenced by uv_console_init().
|
static |
Definition at line 2407 of file tty.c.
References uv__tty_console_resized, and uv__tty_console_signal_resize().
Referenced by uv__tty_console_resize_message_loop_thread().
|
static |
Definition at line 2418 of file tty.c.
References assert(), height, SIGWINCH, uv__signal_dispatch(), uv__tty_console_handle, uv__tty_console_height, uv__tty_console_resize_mutex, uv__tty_console_width, uv_mutex_lock(), uv_mutex_unlock(), and width.
Referenced by uv__tty_console_resize_watcher_thread(), and uv_process_tty_read_raw_req().
Definition at line 2212 of file tty.c.
References bufs, DWORD, error(), handle, uv__count_bufs(), uv_translate_sys_error(), and uv_tty_write_bufs().
Referenced by uv_try_write().
void uv_console_init | ( | void | ) |
Definition at line 166 of file tty.c.
References INVALID_HANDLE_VALUE, L, NULL, uv__tty_console_handle, uv__tty_console_height, uv__tty_console_resize_message_loop_thread(), uv__tty_console_resize_mutex, uv__tty_console_width, uv_mutex_init(), uv_sem_init(), and uv_tty_output_lock.
Referenced by uv_init().
void uv_process_tty_connect_req | ( | uv_loop_t * | loop, |
uv_tty_t * | handle, | ||
uv_connect_t * | req | ||
) |
Definition at line 960 of file tty.c.
References assert(), bytes, DECREASE_ACTIVE_COUNT, DECREASE_PENDING_REQ_COUNT, DWORD, GET_REQ_ERROR, handle, loop, req, REQ_SUCCESS, UV_HANDLE_CANCELLATION_PENDING, UV_HANDLE_READ_PENDING, UV_HANDLE_READING, UV_HANDLE_TTY_READABLE, uv_null_buf_, uv_translate_sys_error(), and uv_tty_queue_read().
Referenced by uv_process_tty_read_req().
Definition at line 697 of file tty.c.
References assert(), DECREASE_ACTIVE_COUNT, DECREASE_PENDING_REQ_COUNT, DWORD, GET_REQ_ERROR, get_vt100_fn_key(), handle, KEV, loop, memcpy(), NULL, out, req, REQ_SUCCESS, tty, uv__tty_console_signal_resize(), uv_buf_init(), UV_HANDLE_READ_PENDING, UV_HANDLE_READING, UV_HANDLE_TTY_RAW, UV_HANDLE_TTY_READABLE, uv_null_buf_, uv_translate_sys_error(), and uv_tty_queue_read().
Referenced by uv_process_tty_read_req().
Definition at line 1002 of file tty.c.
References assert(), handle, loop, req, UV_HANDLE_TTY_READABLE, uv_process_tty_read_line_req(), and uv_process_tty_read_raw_req().
void uv_process_tty_write_req | ( | uv_loop_t * | loop, |
uv_tty_t * | handle, | ||
uv_write_t * | req | ||
) |
Definition at line 2227 of file tty.c.
References DECREASE_PENDING_REQ_COUNT, err, GET_REQ_ERROR, handle, loop, NULL, req, UNREGISTER_HANDLE_REQ, uv_translate_sys_error(), and uv_want_endgame().
|
static |
Definition at line 292 of file tty.c.
References COMMON_LVB_REVERSE_VIDEO, uv_tty_default_bg_bright, uv_tty_default_bg_color, uv_tty_default_cursor_info, uv_tty_default_fg_bright, uv_tty_default_fg_color, uv_tty_default_inverse, and uv_tty_default_text_attributes.
Referenced by uv_tty_init().
Definition at line 1315 of file tty.c.
References count, DWORD, test_evm::end, error(), handle, info(), L, start, uv_tty_make_real_coord(), x1, and x2.
Referenced by uv_tty_write_bufs().
void uv_tty_close | ( | uv_tty_t * | handle | ) |
Definition at line 2249 of file tty.c.
References assert(), close, handle, INVALID_HANDLE_VALUE, uv__handle_closing, UV_HANDLE_READABLE, UV_HANDLE_READING, UV_HANDLE_WRITABLE, uv_tty_read_stop(), and uv_want_endgame().
Referenced by uv_close().
|
static |
Definition at line 1200 of file tty.c.
Definition at line 2270 of file tty.c.
References assert(), DECREASE_PENDING_REQ_COUNT, handle, loop, NULL, UNREGISTER_HANDLE_REQ, uv__handle_close, UV_HANDLE_CLOSED, UV_HANDLE_CLOSING, and UV_HANDLE_TTY_READABLE.
Referenced by uv_process_endgames().
int uv_tty_get_vterm_state | ( | uv_tty_vtermstate_t * | state | ) |
Definition at line 2447 of file tty.c.
References uv__vterm_state, uv_sem_post(), uv_sem_wait(), and uv_tty_output_lock.
Definition at line 417 of file tty.c.
References EINTR, err, height, info(), ioctl, TIOCGWINSZ, tty, UV__ERR, uv__stream_fd, uv_sem_post(), uv_sem_wait(), uv_translate_sys_error(), uv_tty_output_lock, uv_tty_update_virtual_window(), uv_tty_virtual_height, uv_tty_virtual_width, width, winsize::ws_col, and winsize::ws_row.
Referenced by main().
Definition at line 190 of file tty.c.
References ANSI_NORMAL, DWORD, EINTR, F_GETFL, F_SETFL, FALSE, fcntl, fd, flags, handle, HANDLE, INVALID_HANDLE_VALUE, loop, memset(), NULL, O_ACCMODE, O_NOCTTY, O_RDONLY, O_WRONLY, path, QUEUE_REMOVE, r, skip(), tty, type, uv__close(), uv__determine_vterm_state(), uv__dup2_cloexec(), UV__ERR, uv__get_osfhandle(), uv__need_check_vterm_state, uv__nonblock, uv__once_init(), uv__open_cloexec(), uv__stream_init(), uv__stream_open(), uv__tty_is_slave(), uv_connection_init(), UV_FILE, uv_guess_handle(), UV_HANDLE_BLOCKING_WRITES, UV_HANDLE_BOUND, UV_HANDLE_READABLE, UV_HANDLE_TTY_READABLE, UV_HANDLE_WRITABLE, uv_null_buf_, uv_sem_post(), uv_sem_wait(), uv_stream_init(), uv_translate_sys_error(), uv_tty_capture_initial_style(), UV_TTY_MODE_NORMAL, uv_tty_output_lock, uv_tty_update_virtual_window(), and UV_UNKNOWN_HANDLE.
Referenced by main().
|
static |
Definition at line 486 of file tty.c.
References assert(), bytes, COMPLETED, DWORD, handle, HANDLE, IN_PROGRESS, InterlockedExchange, InterlockedOr, INVALID_HANDLE_VALUE, LONG, loop, MAX_INPUT_BUFFER_LENGTH, NULL, pos, POST_COMPLETION_FOR_REQ, req, SET_REQ_ERROR, SET_REQ_SUCCESS, status, TRAP_REQUESTED, uv__read_console_status, uv__restore_screen_state, uv__saved_screen_state, uv_sem_post(), and uv_tty_output_lock.
Referenced by uv_tty_queue_read_line().
|
static |
Definition at line 1163 of file tty.c.
References info(), uv_tty_update_virtual_window(), uv_tty_virtual_height, uv_tty_virtual_offset, uv_tty_virtual_width, and x.
Referenced by uv_tty_clear(), and uv_tty_move_caret().
|
static |
Definition at line 1221 of file tty.c.
References error(), handle, info(), pos, uv_tty_make_real_coord(), and x.
Referenced by uv_tty_restore_state(), and uv_tty_write_bufs().
|
static |
Definition at line 435 of file tty.c.
References assert(), handle, loop, NULL, POST_COMPLETION_FOR_REQ, req, and SET_REQ_SUCCESS.
Referenced by uv_tty_queue_read_raw().
Definition at line 622 of file tty.c.
References handle, loop, UV_HANDLE_TTY_RAW, uv_tty_queue_read_line(), and uv_tty_queue_read_raw().
Referenced by uv_process_tty_read_line_req(), uv_process_tty_read_raw_req(), and uv_tty_read_start().
Definition at line 582 of file tty.c.
References assert(), FALSE, handle, INVALID_HANDLE_VALUE, loop, memset(), NOT_STARTED, NULL, r, req, SET_REQ_ERROR, uv__read_console_status, uv__restore_screen_state, uv_buf_init(), UV_HANDLE_READ_PENDING, UV_HANDLE_READING, uv_insert_pending_req(), and uv_tty_line_read_thread().
Referenced by uv_tty_queue_read().
Definition at line 455 of file tty.c.
References assert(), handle, INVALID_HANDLE_VALUE, loop, memset(), NULL, r, req, SET_REQ_ERROR, UV_HANDLE_READ_PENDING, UV_HANDLE_READING, uv_insert_pending_req(), uv_null_buf_, and uv_tty_post_raw_read().
Referenced by uv_tty_queue_read().
int uv_tty_read_start | ( | uv_tty_t * | handle, |
uv_alloc_cb | alloc_cb, | ||
uv_read_cb | read_cb | ||
) |
Definition at line 1018 of file tty.c.
References handle, INCREASE_ACTIVE_COUNT, loop, SET_REQ_SUCCESS, UV_HANDLE_READ_PENDING, UV_HANDLE_READING, UV_HANDLE_TTY_READABLE, uv_insert_pending_req(), and uv_tty_queue_read().
Referenced by uv_read_start(), and uv_tty_set_mode().
Definition at line 1054 of file tty.c.
References DECREASE_ACTIVE_COUNT, DWORD, err, handle, memset(), uv__cancel_read_console(), UV_HANDLE_CANCELLATION_PENDING, UV_HANDLE_READ_PENDING, UV_HANDLE_READING, and UV_HANDLE_TTY_RAW.
Referenced by uv_read_stop(), uv_tty_close(), and uv_tty_set_mode().
Definition at line 1251 of file tty.c.
References count, DWORD, error(), handle, L, uv_tty_default_cursor_info, uv_tty_default_text_attributes, uv_tty_update_virtual_window(), and uv_tty_virtual_offset.
Referenced by uv_tty_write_bufs().
int uv_tty_reset_mode | ( | void | ) |
Definition at line 2324 of file tty.c.
References err, orig_termios, orig_termios_fd, TCSANOW, termios_spinlock, and UV__ERR.
|
static |
Definition at line 1588 of file tty.c.
References error(), handle, info(), UV_HANDLE_TTY_SAVED_ATTRIBUTES, UV_HANDLE_TTY_SAVED_POSITION, and uv_tty_move_caret().
Referenced by uv_tty_write_bufs().
|
static |
Definition at line 1559 of file tty.c.
References error(), handle, info(), UV_HANDLE_TTY_SAVED_ATTRIBUTES, UV_HANDLE_TTY_SAVED_POSITION, uv_tty_update_virtual_window(), and uv_tty_virtual_offset.
Referenced by uv_tty_write_bufs().
Definition at line 1648 of file tty.c.
References CURSOR_SIZE_LARGE, CURSOR_SIZE_SMALL, error(), handle, and uv_tty_default_cursor_info.
Referenced by uv_tty_write_bufs().
Definition at line 1628 of file tty.c.
References error(), and handle.
Referenced by uv_tty_write_bufs().
int uv_tty_set_mode | ( | uv_tty_t * | tty, |
uv_tty_mode_t | mode | ||
) |
Definition at line 350 of file tty.c.
References BRKINT, CS8, DWORD, ECHO, err, fd, flags, ICANON, ICRNL, IEXTEN, INPCK, ISIG, ISTRIP, IXON, NULL, ONLCR, orig_termios, orig_termios_fd, TCSADRAIN, termios_spinlock, autogen_x86imm::tmp, tty, UV__ERR, uv__stream_fd, uv__tty_make_raw(), UV_HANDLE_READING, UV_HANDLE_TTY_RAW, UV_HANDLE_TTY_READABLE, uv_sem_post(), uv_sem_wait(), uv_translate_sys_error(), UV_TTY_MODE_IO, UV_TTY_MODE_NORMAL, UV_TTY_MODE_RAW, uv_tty_output_lock, uv_tty_read_start(), uv_tty_read_stop(), VMIN, and VTIME.
Referenced by main().
Definition at line 1403 of file tty.c.
References argv, COMMON_LVB_REVERSE_VIDEO, error(), FLIP_FGBG, handle, i, info(), uv_tty_default_bg_bright, uv_tty_default_bg_color, uv_tty_default_fg_bright, uv_tty_default_fg_color, and uv_tty_default_inverse.
Referenced by uv_tty_write_bufs().
void uv_tty_set_vterm_state | ( | uv_tty_vtermstate_t | state | ) |
Definition at line 2440 of file tty.c.
References FALSE, uv__need_check_vterm_state, uv__vterm_state, uv_sem_post(), uv_sem_wait(), and uv_tty_output_lock.
|
static |
Definition at line 1140 of file tty.c.
References info(), uv_tty_virtual_height, uv_tty_virtual_offset, and uv_tty_virtual_width.
Referenced by uv_tty_get_winsize(), uv_tty_init(), uv_tty_make_real_coord(), uv_tty_reset(), and uv_tty_save_state().
int uv_tty_write | ( | uv_loop_t * | loop, |
uv_write_t * | req, | ||
uv_tty_t * | handle, | ||
const uv_buf_t | bufs[], | ||
unsigned int | nbufs, | ||
uv_write_cb | cb | ||
) |
Definition at line 2182 of file tty.c.
References bufs, cb, DWORD, error(), handle, loop, REGISTER_HANDLE_REQ, req, SET_REQ_ERROR, SET_REQ_SUCCESS, uv_insert_pending_req(), UV_REQ_INIT, and uv_tty_write_bufs().
Referenced by uv_write().
|
static |
Definition at line 1673 of file tty.c.
References ANSI_BACKSLASH_SEEN, ANSI_CSI, ANSI_DECSCUSR, ANSI_ESCAPE_SEEN, ANSI_EXTENSION, ANSI_IGNORE, ANSI_IN_ARG, ANSI_IN_STRING, ANSI_NORMAL, ANSI_ST_CONTROL, ARRAY_SIZE, bufs, c, d, DWORD, ENSURE_BUFFER_SPACE, error(), FLUSH_TEXT, handle, i, int, L, MAX_CONSOLE_CHAR, STATUS_SUCCESS, UINT16_MAX, UNICODE_REPLACEMENT_CHARACTER, uv__vterm_state, uv_sem_post(), uv_sem_wait(), uv_tty_clear(), uv_tty_move_caret(), uv_tty_output_lock, uv_tty_reset(), uv_tty_restore_state(), uv_tty_save_state(), uv_tty_set_cursor_shape(), uv_tty_set_cursor_visibility(), uv_tty_set_style(), UV_TTY_SUPPORTED, value, and x.
Referenced by uv__tty_try_write(), and uv_tty_write().
|
static |
Definition at line 162 of file tty.c.
Referenced by uv__determine_vterm_state(), uv_tty_init(), and uv_tty_set_vterm_state().
|
static |
Definition at line 87 of file tty.c.
Referenced by uv__cancel_read_console(), uv_tty_line_read_thread(), and uv_tty_queue_read_line().
Definition at line 88 of file tty.c.
Referenced by uv__cancel_read_console(), uv_tty_line_read_thread(), and uv_tty_queue_read_line().
|
static |
Definition at line 89 of file tty.c.
Referenced by uv__cancel_read_console(), and uv_tty_line_read_thread().
|
static |
Definition at line 127 of file tty.c.
Referenced by uv__tty_console_signal_resize(), and uv_console_init().
|
static |
Definition at line 128 of file tty.c.
Referenced by uv__tty_console_signal_resize(), and uv_console_init().
|
static |
Definition at line 131 of file tty.c.
Referenced by uv__tty_console_signal_resize(), and uv_console_init().
|
static |
Definition at line 130 of file tty.c.
Referenced by uv__tty_console_resize_event(), uv__tty_console_resize_message_loop_thread(), and uv__tty_console_resize_watcher_thread().
|
static |
Definition at line 129 of file tty.c.
Referenced by uv__tty_console_signal_resize(), and uv_console_init().
|
static |
Definition at line 163 of file tty.c.
Referenced by uv__determine_vterm_state(), uv_tty_get_vterm_state(), uv_tty_set_vterm_state(), and uv_tty_write_bufs().
Definition at line 78 of file tty.c.
Referenced by uv_process_tty_read_line_req(), uv_process_tty_read_raw_req(), uv_tty_init(), and uv_tty_queue_read_raw().
|
static |
Definition at line 156 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_set_style().
|
static |
Definition at line 154 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_set_style().
|
static |
Definition at line 159 of file tty.c.
Referenced by uv_tty_capture_initial_style(), uv_tty_reset(), and uv_tty_set_cursor_shape().
|
static |
Definition at line 155 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_set_style().
|
static |
Definition at line 153 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_set_style().
|
static |
Definition at line 157 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_set_style().
|
static |
Definition at line 150 of file tty.c.
Referenced by uv_tty_capture_initial_style(), and uv_tty_reset().
|
static |
Definition at line 148 of file tty.c.
Referenced by uv__cancel_read_console(), uv_console_init(), uv_tty_get_vterm_state(), uv_tty_get_winsize(), uv_tty_init(), uv_tty_line_read_thread(), uv_tty_set_mode(), uv_tty_set_vterm_state(), and uv_tty_write_bufs().
|
static |
Definition at line 119 of file tty.c.
Referenced by uv_tty_get_winsize(), uv_tty_make_real_coord(), and uv_tty_update_virtual_window().
|
static |
Definition at line 118 of file tty.c.
Referenced by uv_tty_make_real_coord(), uv_tty_reset(), uv_tty_save_state(), and uv_tty_update_virtual_window().
|
static |
Definition at line 120 of file tty.c.
Referenced by uv_tty_get_winsize(), uv_tty_make_real_coord(), and uv_tty_update_virtual_window().