|
The COFFI library's main class. More...
Inheritance diagram for coffi:Public Member Functions | |
| coffi (const coffi &)=delete | |
| Discards the copy constructor. | |
| bool | load (const std::string &file_name) |
| Initializes the coffi object by loading data from COFF binary file. More... | |
| bool | load (std::istream &stream) |
| Initializes the coffi object by loading data from COFF binary file. More... | |
| bool | save (const std::string &file_name) |
| Creates a file in COFF binary format. More... | |
| bool | save (std::ostream &stream) |
| Creates a file in COFF binary format. More... | |
| void | create (coffi_architecture_t architecture) |
| Cleans and/or initializes the coffi object. More... | |
| void | create_optional_header (uint16_t magic=OH_MAGIC_PE32) |
| Initializes an optional header for the coffi object. More... | |
| dos_header * | get_msdos_header () |
| Returns the MS-DOS header. More... | |
| const dos_header * | get_msdos_header () const |
| Returns the MS-DOS header. More... | |
| coff_header * | get_header () |
| Returns the COFF header. More... | |
| const coff_header * | get_header () const |
| Returns the COFF header. More... | |
| optional_header * | get_optional_header () |
| Returns the optional COFF header. More... | |
| const optional_header * | get_optional_header () const |
| Returns the optional COFF header. More... | |
| win_header * | get_win_header () |
| Returns the Windows NT header. More... | |
| const win_header * | get_win_header () const |
| Returns the Windows NT header. More... | |
| sections & | get_sections () |
| Returns a list of the COFF sections. More... | |
| const sections & | get_sections () const |
| Returns a list of the COFF sections. More... | |
| section * | add_section (const std::string &name) |
| Add a COFF section. More... | |
| directories & | get_directories () |
| Returns a list of the PE data directories. More... | |
| const directories & | get_directories () const |
| Returns a list of the PE data directories. More... | |
| directory * | add_directory (const image_data_directory &rva_and_size) |
| Add a PE data directory. More... | |
| bool | is_PE32_plus () |
| PE32+ format check. More... | |
| int | get_addressable_unit () const |
| Returns the character type size in bytes. More... | |
| coffi_architecture_t | get_architecture () const |
| Returns the coffi object architecture. More... | |
| void | layout () |
| Performs the layout of the file. More... | |
Public Member Functions inherited from coffi_strings | |
| coffi_strings (const coffi_strings &)=delete | |
| Discards the copy constructor. | |
| uint32_t | get_strings_size () const |
| void | set_strings_size (uint32_t value) |
| virtual std::string | string_to_name (const char *str) const |
| Converts an 8-bytes symbol short name into a full name, eventually by looking into the strings table. More... | |
| virtual std::string | section_string_to_name (const char *str) const |
| Converts an 8-bytes section short name into a full name, eventually by looking into the strings table. More... | |
| virtual void | name_to_string (const std::string &name, char *str) |
| Converts symbol full name into an 8-bytes short name, eventually creating an entry in the strings table. More... | |
| virtual void | name_to_section_string (const std::string &name, char *str) |
| Converts section full name into an 8-bytes short name, eventually creating an entry in the strings table. More... | |
| virtual const char * | get_strings () const |
| virtual void | set_strings (const char *str, uint32_t size) |
Public Member Functions inherited from coffi_symbols | |
| virtual symbol * | get_symbol (uint32_t index) |
| Gets a symbol from its index. More... | |
| virtual const symbol * | get_symbol (uint32_t index) const |
| Gets a symbol from its index. More... | |
| virtual symbol * | get_symbol (const std::string &name) |
| Gets a symbol from its name. More... | |
| virtual const symbol * | get_symbol (const std::string &name) const |
| Gets a symbol from its name. More... | |
| std::vector< symbol > * | get_symbols () |
| const std::vector< symbol > * | get_symbols () const |
| symbol * | add_symbol (const std::string &name) |
| Adds a symbol in the table. More... | |
|
inline |
Add a PE data directory.
This function is relevant only for the PE architecture (see COFFI_ARCHITECTURE_PE).
| [in] | rva_and_size | Relative virtual address (RVA) and size |
|
inline |
|
inline |
Cleans and/or initializes the coffi object.
| [in] | architecture | COFF architecture, see coffi_architecture_t for the list of supported architectures |
|
inline |
Initializes an optional header for the coffi object.
The optional header format depends on the architecture:
| [in] | magic | Used only for the PE files (COFFI_ARCHITECTURE_PE): OH_MAGIC_PE32 for PE32 format, OH_MAGIC_PE32PLUS for PE32+ format. |
|
inlinevirtual |
Returns the character type size in bytes.
Auto-detects the addressable unit: are the addresses in bytes or 2-bytes words?
Some targets have 2-bytes characters, this changes how offsets are computed in the file.
Implements architecture_provider.
|
inlinevirtual |
Returns the coffi object architecture.
Implements architecture_provider.
|
inline |
Returns a list of the PE data directories.
This function is relevant only for the PE architecture (see COFFI_ARCHITECTURE_PE).
|
inline |
Returns a list of the PE data directories.
This function is relevant only for the PE architecture (see COFFI_ARCHITECTURE_PE).
|
inline |
|
inlinevirtual |
Returns the COFF header.
Implements sections_provider.
|
inline |
Returns the MS-DOS header.
|
inlinevirtual |
Returns the MS-DOS header.
Implements sections_provider.
|
inline |
Returns the optional COFF header.
|
inlinevirtual |
Returns the optional COFF header.
Implements sections_provider.
|
inline |
|
inlinevirtual |
Returns a list of the COFF sections.
Implements sections_provider.
|
inline |
Returns the Windows NT header.
|
inlinevirtual |
Returns the Windows NT header.
Implements sections_provider.
|
inline |
PE32+ format check.
|
inline |
|
inline |
|
inline |
Initializes the coffi object by loading data from COFF binary file.
| [in] | stream | File to load, as an opened stream. |
|
inline |
Creates a file in COFF binary format.
Before saving, performs the following modififications:
| [in] | file_name | File path of the file to create. |
|
inline |
Creates a file in COFF binary format.
| [in] | stream | File to create, as an opened stream. |