Skip to main content

pe_assembler/types/tables/
mod.rs

1use serde::{Deserialize, Serialize};
2
3/// Import table entry
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct ImportEntry {
6    /// DLL name
7    pub dll_name: String,
8    /// List of imported functions
9    pub functions: Vec<String>,
10}
11
12/// Import table structure
13///
14/// Describes the functions imported by the PE file from external DLLs
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct ImportTable {
17    /// List of import entries
18    pub entries: Vec<ImportEntry>,
19}
20
21impl ImportTable {
22    pub fn new() -> Self {
23        Self { entries: Vec::new() }
24    }
25}
26
27impl Default for ImportTable {
28    fn default() -> Self {
29        Self::new()
30    }
31}
32
33/// Export table structure
34///
35/// Describes the functions exported by the PE file to external modules
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct ExportTable {
38    /// Module name
39    pub name: String,
40    /// List of exported functions
41    pub functions: Vec<String>,
42}
43
44impl ExportTable {
45    pub fn new() -> Self {
46        Self { name: String::new(), functions: Vec::new() }
47    }
48}
49
50impl Default for ExportTable {
51    fn default() -> Self {
52        Self::new()
53    }
54}