libPeConv
A library to load, manipulate, dump PE files.
Loading...
Searching...
No Matches
imports_uneraser.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <windows.h>
9
10#include <string>
11
12#include <set>
13#include <map>
14
15#include <iterator>
16#include "fix_imports.h"
17#include "caves.h"
18
19namespace peconv {
20
25 {
26 public:
27 ImportsUneraser(PVOID _modulePtr, size_t _moduleSize)
28 : modulePtr((PBYTE)_modulePtr), moduleSize(_moduleSize)
29 {
31 }
32
41 bool uneraseDllImports(IN OUT IMAGE_IMPORT_DESCRIPTOR* lib_desc, IN ImportedDllCoverage &dllCoverage, OUT OPTIONAL ImpsNotCovered* not_covered);
42
46 bool uneraseDllName(IMAGE_IMPORT_DESCRIPTOR* lib_desc, const std::string &dll_name);
47
48 protected:
55 bool writeFoundDllName(IMAGE_IMPORT_DESCRIPTOR* lib_desc, const std::string &dll_name);
56
66 template <typename FIELD_T, typename IMAGE_THUNK_DATA_T>
67 bool fillImportNames(IN OUT IMAGE_IMPORT_DESCRIPTOR* lib_desc,
68 IN const FIELD_T ordinal_flag,
69 IN std::map<ULONGLONG, std::set<ExportedFunc>> &addr_to_func,
70 OUT OPTIONAL ImpsNotCovered* not_covered
71 );
72
73 template <typename FIELD_T>
74 bool findNameInBinaryAndFill(IMAGE_IMPORT_DESCRIPTOR* lib_desc,
75 LPVOID call_via_ptr,
76 LPVOID thunk_ptr,
77 const FIELD_T ordinal_flag,
78 std::map<ULONGLONG, std::set<ExportedFunc>> &addr_to_func
79 );
80
87 template <typename FIELD_T, typename IMAGE_THUNK_DATA_T>
88 bool writeFoundFunction(IMAGE_THUNK_DATA_T* desc, const FIELD_T ordinal_flag, const ExportedFunc &foundFunc);
89
90 PBYTE modulePtr;
91 size_t moduleSize;
92 bool is64;
93 };
94}
Functions related to finding caves in the loaded PE file.
bool writeFoundDllName(IMAGE_IMPORT_DESCRIPTOR *lib_desc, const std::string &dll_name)
ImportsUneraser(PVOID _modulePtr, size_t _moduleSize)
bool fillImportNames(IN OUT IMAGE_IMPORT_DESCRIPTOR *lib_desc, IN const FIELD_T ordinal_flag, IN std::map< ULONGLONG, std::set< ExportedFunc > > &addr_to_func, OUT OPTIONAL ImpsNotCovered *not_covered)
bool uneraseDllName(IMAGE_IMPORT_DESCRIPTOR *lib_desc, const std::string &dll_name)
bool writeFoundFunction(IMAGE_THUNK_DATA_T *desc, const FIELD_T ordinal_flag, const ExportedFunc &foundFunc)
bool uneraseDllImports(IN OUT IMAGE_IMPORT_DESCRIPTOR *lib_desc, IN ImportedDllCoverage &dllCoverage, OUT OPTIONAL ImpsNotCovered *not_covered)
bool findNameInBinaryAndFill(IMAGE_IMPORT_DESCRIPTOR *lib_desc, LPVOID call_via_ptr, LPVOID thunk_ptr, const FIELD_T ordinal_flag, std::map< ULONGLONG, std::set< ExportedFunc > > &addr_to_func)
Functions and classes responsible for fixing Import Table. A definition of ImportedDllCoverage class.
bool is64bit(IN const BYTE *pe_buffer)