libPeConv
A library to load, manipulate, dump PE files.
imports_loader.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <windows.h>
9
10#include "pe_hdrs_helper.h"
11#include "function_resolver.h"
12
13namespace peconv {
14
19 {
20 public:
21 ImportThunksCallback(BYTE* _modulePtr, size_t _moduleSize)
22 : modulePtr(_modulePtr), moduleSize(_moduleSize)
23 {
24 this->is64b = is64bit((BYTE*)modulePtr);
25 }
26
34 virtual bool processThunks(LPSTR libName, ULONG_PTR origFirstThunkPtr, ULONG_PTR firstThunkPtr) = 0;
35
36 protected:
37 BYTE* modulePtr;
38 size_t moduleSize;
39 bool is64b;
40 };
41
49 bool process_import_table(IN BYTE* modulePtr, IN SIZE_T moduleSize, IN ImportThunksCallback *callback);
50
57 bool load_imports(BYTE* modulePtr, t_function_resolver* func_resolver=nullptr);
58
62 bool has_valid_import_table(const PBYTE modulePtr, size_t moduleSize);
63
68 bool is_valid_import_name(const PBYTE modulePtr, const size_t moduleSize, LPSTR lib_name);
69
70}; // namespace peconv
virtual bool processThunks(LPSTR libName, ULONG_PTR origFirstThunkPtr, ULONG_PTR firstThunkPtr)=0
ImportThunksCallback(BYTE *_modulePtr, size_t _moduleSize)
Definitions of basic Imports Resolver classes. They can be used for filling imports when the PE is lo...
bool has_valid_import_table(const PBYTE modulePtr, size_t moduleSize)
bool process_import_table(IN BYTE *modulePtr, IN SIZE_T moduleSize, IN ImportThunksCallback *callback)
bool is64bit(IN const BYTE *pe_buffer)
bool is_valid_import_name(const PBYTE modulePtr, const size_t moduleSize, LPSTR lib_name)
bool load_imports(BYTE *modulePtr, t_function_resolver *func_resolver=nullptr)
Wrappers over various fields in the PE header. Read, write, parse PE headers.