Rizin
unix-like reverse engineering framework and cli tools
rz_bin_virtual_file_t Struct Reference

#include <rz_bin.h>

Public Attributes

RZ_OWN RZ_NONNULL char * name
 
RZ_NONNULL RzBufferbuf
 
bool buf_owned
 whether buf is owned and freed by this RzBinVirtualFile More...
 

Detailed Description

A virtual file is a binary buffer, exposed by a bin plugin for a loaded file. These virtual files can be used whenever data that is related to the file but not directly represented-as is in the raw file should be mapped into the virtual address space. Common examples for this include compressed segments or patching relocations. The idea is that the bin plugin exposes virtual files and then refers to them in the RzBinMap it returns.

For example, when there is a binary format that contains a compressed segment called "text", the bin plugin would create a virtual file:

   RzBinVirtualFile {
     .name = "text_decompressed",
     .buf = rz_buf_new_with_bytes(<decompressed bytes>, <decompressed size>),
     ...
   }

which it can then use for mapping by referring to its exact name:

RzBinMap {
  .vsize = <decompressed size>,
  .name = "text",
  .vfile_name = "text_decompressed",
  ...
}

When RzBin is used as part of RzCore, these virtual files can be opened as RzIO files using an URI like vfile://<binfile id>/<filename>. By default, RzCore sets everything up automatically though so it is rather rare that one has to manually work with these URIs.

Definition at line 595 of file rz_bin.h.

Member Data Documentation

◆ buf

RZ_NONNULL RzBuffer* rz_bin_virtual_file_t::buf

Definition at line 597 of file rz_bin.h.

Referenced by get_virtual_files(), rz_bin_virtual_file_free(), and virtual_files().

◆ buf_owned

bool rz_bin_virtual_file_t::buf_owned

whether buf is owned and freed by this RzBinVirtualFile

Definition at line 598 of file rz_bin.h.

Referenced by get_virtual_files(), rz_bin_virtual_file_free(), and virtual_files().

◆ name


The documentation for this struct was generated from the following file: