Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_list.h>
Go to the source code of this file.
Classes | |
struct | rz_mmap_t |
Typedefs | |
typedef struct rz_mmap_t | RzMmap |
deflate uncompressed data to zlib or gzipped, use MAX_WBITS as the window size logarithm.
Definition at line 340 of file compression.c.
References MAX_WBITS, NULL, rz_deflatew(), rz_return_val_if_fail, and src.
RZ_API ut8* rz_deflatew | ( | RZ_NONNULL const ut8 * | src, |
int | srcLen, | ||
int * | srcConsumed, | ||
int * | dstLen, | ||
int | wbits | ||
) |
Definition at line 267 of file file.c.
References test-lz4-speed::cwd, free(), NULL, rz_file_abspath_rel(), rz_return_val_if_fail, and rz_sys_getdir().
Referenced by file_save(), get_file_in_cur_dir(), getcommapath(), prj_dir_abs(), rz_cons_hud_path(), rz_core_cmd_file(), rz_core_file_open(), rz_core_file_print(), rz_core_file_reopen_debug(), rz_core_raw_file_print(), rz_core_rtr_http_run(), rz_core_run_script(), rz_debug_get_baddr(), rz_file_exists(), rz_file_path(), rz_lang_prompt(), rz_main_rizin(), and rz_test_chdir_fromtest().
Definition at line 219 of file file.c.
References test-lz4-speed::cwd, free(), NULL, rp, rz_path_home_expand(), RZ_STR_ISEMPTY, rz_str_newf(), RZ_SYS_DIR, strdup(), and autogen_x86imm::tmp.
Referenced by prj_relative_restore(), rz_file_abspath(), and rz_test_main().
Definition at line 83 of file file.c.
References NULL, path, rz_return_val_if_fail, and rz_str_rchr().
Referenced by add_library(), addroflib(), autocmplt_cmd_arg_file(), cb_binprefix(), extract_binobj(), get_file_in_cur_dir(), MAIN_NAME(), prompt_add_file(), rz_cmd_debug_dmi(), rz_cmd_debug_dmS_handler(), rz_core_pdb_load_info(), rz_debug_dmp_init(), rz_lib_open(), and sigdb_signature_resolve_details().
RZ_API char* rz_file_binsh | ( | void | ) |
Definition at line 393 of file file.c.
References free(), rz_file_path(), RZ_STR_ISNOTEMPTY, rz_sys_getenv(), and strdup().
Referenced by rz_run_start(), and rz_sys_cmdbg().
Definition at line 1179 of file file.c.
References close, d, dst, free(), lseek, mask, O_CREAT, O_RDONLY, O_TRUNC, O_WRONLY, RZ_LOG_ERROR, rz_str_replace(), rz_sys_cmdf(), rz_sys_perror, s, SEEK_END, SEEK_SET, src, SSIZE_MAX, and strdup().
Referenced by rz_cmd_shell_cp_handler().
RZ_API bool rz_file_deflate | ( | RZ_NONNULL const char * | src, |
RZ_NONNULL const char * | dst | ||
) |
zip the contents of src and store in dst
src | source file (string containing filename) |
dst | destination file (string containing filename) |
Definition at line 1329 of file file.c.
References dst, NULL, O_CREAT, O_RDONLY, O_WRONLY, rz_buf_free(), rz_buf_new_file(), rz_deflate_buf(), rz_return_val_if_fail, src, and ut64().
Referenced by rz_project_save_file().
Definition at line 120 of file file.c.
References NULL, path, rz_return_val_if_fail, rz_str_rchr(), and strdup().
Referenced by autocmplt_cmd_arg_file(), download(), prj_dir_abs(), rz_core_bin_pdb_get_filename(), and sdb_disk_create().
RZ_API const char* rz_file_dos_basename | ( | RZ_BORROW RZ_NONNULL const char * | path | ) |
Definition at line 102 of file file.c.
References NULL, path, rz_return_val_if_fail, and rz_str_rchr().
Referenced by rz_bin_pdb_download(), rz_core_bin_pdb_get_filename(), rz_debug_dmp_maps(), rz_debug_dmp_modules(), and rz_debug_winkd_maps().
Definition at line 838 of file file.c.
References append, eprintf, fd, benchmark::FILE, len, rz_return_val_if_fail, RZ_STR_ISEMPTY, rz_sys_fopen(), rz_sys_perror, and rz_sys_truncate().
Referenced by __dumpSections(), convert_dot_str_to_image(), dump_maps(), extract_binobj(), http_logf(), rz_buf_dump(), rz_core_rtr_http_run(), rz_egg_Cfile_parseCompiled(), rz_egg_Cfile_parser(), rz_file_touch(), rz_main_rizin(), rz_main_rz_bin(), rz_reopen_debug_rzrun_handler(), rz_run_start(), rz_test_main(), save_test_file_for_fix(), set_profile_string(), and visual_comma().
Definition at line 192 of file file.c.
References file_stat(), free(), rz_file_abspath(), rz_return_val_if_fail, RZ_STR_ISEMPTY, cmd_descs_generate::str, and StructStat.
Referenced by __func_name_from_ord(), bin_pe_parse_imports(), database_load(), download(), download_and_write(), find_include(), get_file_in_cur_dir(), get_main_arena_with_symbol(), GetHeapGlobalsOffset(), lang_lib_file_run(), load_sdb(), load_theme(), run_commands(), rz_analysis_function_cc_load_handler(), rz_bin_pdb_extract_in_folder(), rz_cmd_debug_dmi(), rz_cmd_info_pdb_load_handler(), rz_cmd_info_pdb_show_handler(), rz_cmd_kuery(), rz_core_analysis_cc_init(), rz_core_bin_apply_config(), rz_core_bin_pdb_get_filename(), rz_core_cmd_str_pipe(), rz_core_config_init(), rz_core_file_reopen_debug(), rz_core_io_file_open(), rz_core_rtr_http_run(), rz_core_visual_hud(), rz_egg_Cfile_parser(), rz_file_fexists(), rz_file_path(), rz_file_slurp(), rz_file_truncate(), rz_lib_path(), rz_main_rizin(), rz_platform_load_profile_sdb(), rz_platform_target_index_load_sdb(), rz_project_load_file_raw(), rz_resolve_jemalloc(), rz_run_start(), rz_sysreg_load_sdb(), rz_test_test_database_load_fuzz(), rz_type_db_load_callables_sdb(), rz_type_db_load_sdb(), rz_types_open_file(), rz_write_hex_from_file_handler(), and set_bin_relocs().
Definition at line 1263 of file file.c.
References files, free(), NULL, path, recursive_search_glob(), rz_list_append(), rz_list_free(), rz_list_newf(), rz_str_home(), rz_str_last(), rz_str_newf(), rz_str_newlen(), RZ_SYS_DIR, and strdup().
Referenced by rz_flirt_scan_handler(), and rz_sign_sigdb_load_database().
Definition at line 529 of file file.c.
References free(), in, int, NULL, out, rz_file_slurp(), rz_inflate(), rz_return_val_if_fail, and cmd_descs_generate::str.
Definition at line 794 of file file.c.
References append, eprintf, fd, benchmark::FILE, i, IS_PRINTABLE, len, PFMT64x, RZ_MIN, rz_sys_fopen(), rz_sys_truncate(), and ut64().
RZ_API bool rz_file_inflate | ( | RZ_NONNULL const char * | src, |
RZ_NONNULL const char * | dst | ||
) |
unzip the contents of src and store in dst
src | source file (string containing filename) |
dst | destination file (string containing filename) |
Definition at line 1361 of file file.c.
References dst, NULL, O_CREAT, O_RDONLY, O_WRONLY, rz_buf_free(), rz_buf_new_file(), rz_inflate_buf(), rz_return_val_if_fail, src, and ut64().
Referenced by rz_project_load_file_raw().
Definition at line 214 of file file.c.
References rz_return_val_if_fail, and RZ_STR_ISEMPTY.
Referenced by autocmplt_cmd_arg_file(), and rz_test_main().
Definition at line 147 of file file.c.
References ext, rz_return_val_if_fail, and rz_str_lchr().
Referenced by rz_core_run_script().
RZ_API bool rz_file_is_deflated | ( | RZ_NONNULL const char * | src | ) |
check whether a file is a deflated (gzip) file
src | source file (string containing filename) |
Definition at line 1392 of file file.c.
References free(), header, NULL, rz_file_slurp_range(), rz_return_val_if_fail, rz_str_nlen(), and src.
Referenced by rz_project_load_file_raw().
Definition at line 167 of file file.c.
References file_stat(), rz_return_val_if_fail, RZ_STR_ISEMPTY, cmd_descs_generate::str, and StructStat.
Referenced by analysis_sigdb_add(), autocmplt_cmd_arg_file(), autocomplete_process_path(), database_load(), get_file_in_cur_dir(), hash_parse_cmdline(), linux_thread_list(), recursive_search_glob(), rz_bin_pdb_extract_in_folder(), rz_cons_hud_path(), rz_core_parse_rizinrc(), rz_core_rtr_http_run(), rz_diff_is_file(), rz_file_rm(), rz_file_tmpdir(), rz_file_truncate(), rz_main_rizin(), rz_main_rz_find(), rz_sign_sigdb_load_database(), rz_syscmd_ls(), rz_test_chdir(), rz_test_chdir_fromtest(), rz_test_test_database_load_fuzz(), rzfind_open(), session_sdb_save(), and showfile().
Definition at line 159 of file file.c.
References file_stat(), cmd_descs_generate::str, and StructStat.
Referenced by rz_core_parse_rizinrc(), rz_file_slurp(), rz_file_truncate(), rz_sys_fopen(), rz_syscmd_ls(), and try_load_file().
RZ_API int rz_file_mkstemp | ( | RZ_NULLABLE const char * | prefix, |
char ** | oname | ||
) |
Definition at line 1058 of file file.c.
References c, free(), h, L, LPWSTR, malloc(), mask, name, NULL, O_BINARY, O_EXCL, O_RDWR, path, prefix, rz_file_tmpdir(), rz_str_ncpy(), rz_str_newf(), rz_sys_open(), strdup(), suffix, and umask.
Referenced by assemble(), binutils_assemble(), config_path(), interact_commands(), rz_core_cmd_str_pipe(), rz_core_editor(), rz_core_sysenv_begin(), rz_project_load_file_raw(), and rz_project_save_file().
Definition at line 972 of file file.c.
References file_mmap(), regress::m, NULL, rz_file_mmap_free(), RZ_NEW0, rz_sys_open(), and strdup().
Referenced by buf_mmap_init().
Definition at line 995 of file file.c.
References close, free(), regress::m, and munmap.
Referenced by buf_mmap_fini(), file_mmap(), rz_file_mmap(), and rz_file_mmap_resize().
Definition at line 1017 of file file.c.
References file_mmap(), regress::m, munmap, NULL, rz_file_mmap_free(), rz_sys_open(), and rz_sys_truncate().
Referenced by buf_mmap_resize().
Definition at line 354 of file file.c.
References file, free(), NULL, path, rz_file_abspath(), rz_file_exists(), RZ_JOIN_2_PATHS, rz_return_val_if_fail, rz_str_endswith(), rz_str_newf(), RZ_SYS_ENVSEP, rz_sys_getenv(), cmd_descs_generate::str, and strdup().
Referenced by dot_executable_path(), getViewerPath(), rz_cmd_shell_which_handler(), rz_core_run_script(), rz_egg_Cfile_getCompiler(), rz_file_binsh(), rz_main_rizin(), rz_run_start(), rz_test_chdir(), and rz_test_main().
RZ_API RZ_OWN char* rz_file_path_join | ( | RZ_NONNULL const char * | s1, |
RZ_NULLABLE const char * | s2 | ||
) |
Concatenate two paths to create a new one with s1+s2 with the correct path separator.
s1 | First path |
s2 | Second path, can be NULL |
Definition at line 1312 of file file.c.
References NULL, rz_return_val_if_fail, rz_str_newf(), RZ_SYS_DIR, s1, s2, and strdup().
Referenced by __get_panels_config_dir_path(), autocmplt_cmd_arg_file(), cmd_print_format(), load_scripts_for(), load_sdb(), main_help(), rizin_fortune_file(), rz_core_analysis_cc_init(), rz_core_bin_apply_config(), rz_core_init(), rz_core_theme_load(), rz_core_visual_hud(), rz_path_home(), rz_path_prefix(), rz_platform_profiles_init(), rz_platform_target_index_init(), rz_run_config_env(), rz_sysreg_set_arch(), rz_type_db_init(), and rzfind_open_dir().
Definition at line 332 of file file.c.
References NULL, path, r, rz_str_replace(), RZ_SYS_DIR, and strdup().
Referenced by prj_relative_make().
Definition at line 343 of file file.c.
References NULL, path, r, rz_str_replace(), RZ_SYS_DIR, and strdup().
Referenced by prj_relative_restore().
Definition at line 892 of file file.c.
References NULL, path, readlink, repeat(), rz_return_val_if_fail, RZ_STR_ISEMPTY, and strdup().
Definition at line 278 of file file.c.
References i, malloc(), memcpy(), NULL, path, r, and RZ_SYS_DIR.
Referenced by prj_relative_make().
Definition at line 865 of file file.c.
References free(), LPWSTR, rmdir, rz_file_is_directory(), RZ_STR_ISEMPTY, and unlink.
Referenced by __clear_layout_cb(), __rap_reg_profile(), download(), rz_cmd_debug(), rz_cmd_debug_dmi(), rz_cmd_shell_rm_handler(), rz_core_cmd_str_pipe(), rz_core_cmd_subst_i(), rz_core_editor(), rz_core_sysenv_end(), rz_egg_Cfile_parser(), rz_egg_load_file(), rz_project_load_file_raw(), rz_project_save_file(), and system_exec().
Definition at line 775 of file file.c.
References free(), NULL, path, root, rz_return_val_if_fail, rz_str_append(), rz_str_replace(), RZ_SYS_DIR, s, and strdup().
Referenced by rz_core_rtr_http_run().
Definition at line 205 of file file.c.
References file_stat(), rz_return_val_if_fail, RZ_STR_ISEMPTY, cmd_descs_generate::str, StructStat, and ut64().
Referenced by rz_egg_Cfile_parser(), rz_type_parse_file(), rz_type_parse_file_stateless(), and showfile().
RZ_API RZ_OWN char* rz_file_slurp | ( | const char * | str, |
RZ_NULLABLE size_t * | usz | ||
) |
Definition at line 454 of file file.c.
References BS, eprintf, fd, benchmark::FILE, free(), malloc(), NULL, r, realloc(), rz_file_exists(), rz_file_is_regular(), RZ_FREE, rz_return_val_if_fail, rz_sys_fopen(), SEEK_END, SEEK_SET, cmd_descs_generate::str, and UT16_MAX.
Referenced by __open(), __rap_reg_profile(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), getFileData(), getstr(), hash_parse_any(), interact_commands(), linux_info(), rcc_next(), read_test_file_for_fix(), rz_asm_pseudo_incbin(), rz_bin_fatmach0_new(), rz_bin_mz_new(), rz_bin_te_new(), rz_buf_new_slurp(), rz_cmd_debug_dml_handler(), rz_cmd_search(), rz_cons_hud_file(), rz_core_cmd_file(), rz_core_cmd_str_pipe(), rz_core_cmd_subst_i(), rz_core_editor(), rz_core_fortune_list(), rz_core_rtr_http_run(), rz_core_visual_cmd(), rz_debug_plugin_set_reg_profile(), rz_egg_Cfile_parseCompiled(), rz_egg_include(), rz_egg_load_file(), rz_file_gzslurp(), rz_file_slurp_line(), rz_file_slurp_lines(), rz_file_slurp_lines_from_bottom(), rz_file_slurp_random_line_count(), rz_lang_run_file(), rz_load_panels_layout(), rz_main_rizin(), rz_main_rz_agent(), rz_main_rz_asm(), rz_main_rz_find(), rz_main_rz_gg(), rz_reg_parse_gdb_profile(), rz_reg_set_profile(), rz_run_parsefile(), rz_str_version(), rz_syscmd_cat(), rz_syscmd_join(), rz_syscmd_sort(), rz_syscmd_uniq(), rz_test_load_asm_test_file(), rz_test_load_cmd_test_file(), rz_test_load_json_test_file(), rz_type_parse_file(), rz_type_parse_file_stateless(), rz_write_assembly_file_handler(), rz_write_from_file_handler(), rz_write_hex_from_file_handler(), rz_write_unified_patch_handler(), and visual_comma().
Definition at line 552 of file file.c.
References bytes, c, fd, benchmark::FILE, free(), malloc(), NULL, rz_return_val_if_fail, rz_sys_fopen(), SEEK_END, SEEK_SET, and cmd_descs_generate::str.
Definition at line 673 of file file.c.
References free(), i, setup::line, lines(), NULL, rz_file_slurp(), rz_return_val_if_fail, cmd_descs_generate::str, and strdup().
Referenced by core_analysis_graph_label(), rz_bin_addr2text(), and step_line().
Definition at line 736 of file file.c.
References count, free(), i, setup::line, lines(), NULL, rz_file_slurp(), rz_return_val_if_fail, cmd_descs_generate::str, and strdup().
Referenced by rz_syscmd_head().
Definition at line 708 of file file.c.
References free(), i, setup::line, lines(), NULL, rz_file_slurp(), rz_return_val_if_fail, cmd_descs_generate::str, and strdup().
Referenced by rz_syscmd_tail().
Definition at line 624 of file file.c.
References i, NULL, rz_file_slurp_random_line_count(), and rz_return_val_if_fail.
Definition at line 630 of file file.c.
References free(), i, setup::line, lines(), NULL, rz_file_slurp(), rz_num_irand(), rz_num_rand(), rz_return_val_if_fail, start, cmd_descs_generate::str, and strdup().
Referenced by rz_core_fortune_get_random(), and rz_file_slurp_random_line().
Definition at line 595 of file file.c.
References fd, benchmark::FILE, int, malloc(), NULL, off, rz_sys_fopen(), SEEK_SET, and cmd_descs_generate::str.
Referenced by rz_file_is_deflated().
Definition at line 1048 of file file.c.
References free(), path, PFMT64x, prefix, rz_file_tmpdir(), rz_str_newf(), RZ_SYS_DIR, and rz_time_now().
Referenced by __rap_reg_profile(), rz_cmd_debug_dmi(), rz_core_cmd_subst_i(), rz_main_rizin(), rz_reopen_debug_rzrun_handler(), and set_profile_string().
RZ_API char* rz_file_tmpdir | ( | void | ) |
Definition at line 1132 of file file.c.
References calloc(), DWORD, eprintf, free(), len, LPWSTR, NULL, path, rz_file_is_directory(), RZ_FREE, rz_sys_getenv(), and strdup().
Referenced by rz_core_config_init(), rz_file_mkstemp(), rz_file_temp(), rz_path_home(), rz_path_home_prefix(), and rz_str_home().
Definition at line 833 of file file.c.
References NULL, rz_file_dump(), and rz_return_val_if_fail.
Definition at line 47 of file file.c.
References close, eprintf, fd, ftruncate, O_RDWR, O_SYNC, r, rz_file_exists(), rz_file_is_directory(), rz_file_is_regular(), rz_return_val_if_fail, and rz_sys_open().
inflate zlib compressed or gzipped, automatically accepts either the zlib or gzip format, and use MAX_WBITS as the window size logarithm.
Definition at line 18 of file compression.c.
References MAX_WBITS, NULL, rz_inflatew(), rz_return_val_if_fail, and src.
Referenced by __open(), rz_cmd_print(), rz_file_gzslurp(), and rz_sign_flirt_parse_compressed_pattern_from_buffer().
RZ_API ut8* rz_inflate_ignore_header | ( | RZ_NONNULL const ut8 * | src, |
int | srcLen, | ||
int * | srcConsumed, | ||
int * | dstLen | ||
) |
inflate zlib compressed or gzipped. The input must be a raw stream with no header or trailer.
Definition at line 28 of file compression.c.
References MAX_WBITS, NULL, rz_inflatew(), rz_return_val_if_fail, and src.
Referenced by rz_sign_flirt_parse_compressed_pattern_from_buffer().
RZ_API ut8* rz_inflatew | ( | RZ_NONNULL const ut8 * | src, |
int | srcLen, | ||
int * | srcConsumed, | ||
int * | dstLen, | ||
int | wbits | ||
) |
Definition at line 319 of file compression.c.
References NULL.
Referenced by rz_inflate(), and rz_inflate_ignore_header().
Definition at line 408 of file file.c.
References BS, close, dup, dup2, eprintf, free(), i, malloc(), NULL, read(), realloc(), and RZ_FREE.
Referenced by hash_context_create_desc_io_stdin(), hash_parse_any(), hash_parse_hexadecimal(), hash_parse_string(), rax(), rz_main_rizin(), rz_main_rz_asm(), and rzfind_open().