libPeConv
A library to load, manipulate, dump PE files.
Loading...
Searching...
No Matches
delayed_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
13#if (defined(_WIN32_WINNT) && _WIN32_WINNT > 0x0601) || __MINGW32__ //Windows SDK version 6.1 (Windows 7)
14#define DELAYLOAD_IMPORTS_DEFINED
15#endif
16
17#ifndef DELAYLOAD_IMPORTS_DEFINED
18#include "pshpack4.h"
19
21 union {
23 struct {
24 DWORD RvaBased : 1; // Delay load version 2
28
29 DWORD DllNameRVA; // RVA to the name of the target library (NULL-terminate ASCII string)
30 DWORD ModuleHandleRVA; // RVA to the HMODULE caching location (PHMODULE)
31 DWORD ImportAddressTableRVA; // RVA to the start of the IAT (PIMAGE_THUNK_DATA)
32 DWORD ImportNameTableRVA; // RVA to the start of the name table (PIMAGE_THUNK_DATA::AddressOfData)
33 DWORD BoundImportAddressTableRVA; // RVA to an optional bound IAT
34 DWORD UnloadInformationTableRVA; // RVA to an optional unload info table
35 DWORD TimeDateStamp; // 0 if not bound,
36 // Otherwise, date/time of the target DLL
37
39
41
42#include "poppack.h"
43#endif
44
45namespace peconv {
46
50 IMAGE_DELAYLOAD_DESCRIPTOR* get_delayed_imps(IN const BYTE* modulePtr, IN const size_t moduleSize, OUT size_t &dir_size);
51
59 bool load_delayed_imports(BYTE* modulePtr, const ULONGLONG moduleBase, t_function_resolver* func_resolver = nullptr);
60
61}; // namespace peconv
struct _IMAGE_DELAYLOAD_DESCRIPTOR IMAGE_DELAYLOAD_DESCRIPTOR
const IMAGE_DELAYLOAD_DESCRIPTOR * PCIMAGE_DELAYLOAD_DESCRIPTOR
struct _IMAGE_DELAYLOAD_DESCRIPTOR * PIMAGE_DELAYLOAD_DESCRIPTOR
Definitions of basic Imports Resolver classes. They can be used for filling imports when the PE is lo...
bool load_delayed_imports(BYTE *modulePtr, const ULONGLONG moduleBase, t_function_resolver *func_resolver=nullptr)
IMAGE_DELAYLOAD_DESCRIPTOR * get_delayed_imps(IN const BYTE *modulePtr, IN const size_t moduleSize, OUT size_t &dir_size)
Wrappers over various fields in the PE header. Read, write, parse PE headers.
union _IMAGE_DELAYLOAD_DESCRIPTOR::@0 Attributes
struct _IMAGE_DELAYLOAD_DESCRIPTOR::@0::@1 DUMMYSTRUCTNAME