4 #include "../Include/Winheaders.h"
5 #include "../Include/Macro.h"
6 #include "../PE/PEImage.h"
8 #include "../Process/MemBlock.h"
28 NoExceptions = 0x01000,
29 PartialExcept = 0x02000,
30 NoDelayLoad = 0x04000,
35 ENUM_OPS( eLoadFlags )
38 typedef enum LdrRefFlags( *LdrCallback )(
void* context, const ModuleData& modInfo);
46 typedef std::vector<ptr_t> vecPtr;
50 std::wstring FilePath;
51 std::wstring FileName;
53 ptr_t pExpTableAddr = 0;
55 eLoadFlags flags = NoFlags;
56 bool initialized =
false;
59 typedef std::vector<std::unique_ptr<ImageContext>> vecImageCtx;
69 BLACKBONE_API ~MMap(
void );
80 const std::wstring& path,
81 eLoadFlags flags = NoFlags,
82 LdrCallback ldrCallback =
nullptr,
83 void* ldrContext =
nullptr
97 void* buffer,
size_t size,
99 eLoadFlags flags = NoFlags,
100 LdrCallback ldrCallback =
nullptr,
101 void* ldrContext =
nullptr
119 BLACKBONE_API
inline void reset() { _images.clear(); _pAContext.
Reset(); _usedBlocks.clear(); }
134 const std::wstring& path,
135 void* buffer,
size_t size,
136 bool asImage =
false,
137 eLoadFlags flags = NoFlags,
138 LdrCallback ldrCallback =
nullptr,
139 void* ldrContext =
nullptr
149 const std::wstring& path,
150 void* buffer,
size_t size,
bool asImage,
151 eLoadFlags flags = NoFlags
165 bool RunModuleInitializers(
ImageContext* pImage, DWORD dwReason );
194 bool ResolveImport(
ImageContext* pImage,
bool useDelayed =
false );
228 bool CreateActx(
const std::wstring& path,
int id = 2,
bool asImage =
true );
242 NTSTATUS ConcealVad(
const MemBlock& imageMem );
250 NTSTATUS AllocateInHighMem(
MemBlock& imageMem,
size_t size );
265 module_t MapPureManaged();
272 DWORD GetSectionProt( DWORD characteristics );
278 LdrCallback _ldrCallback =
nullptr;
279 void* _ldrContext =
nullptr;
281 std::vector<std::pair<ptr_t, size_t>> _usedBlocks;
Exception handling support for arbitrary code
Definition: MExcept.h:12
BLACKBONE_API const ModuleData * MapImage(const std::wstring &path, eLoadFlags flags=NoFlags, LdrCallback ldrCallback=nullptr, void *ldrContext=nullptr)
Manually map PE image into underlying target process
Definition: MMap.cpp:34
Image data
Definition: MMap.h:44
Primitive PE parsing class
Definition: PEImage.h:55
Manual image mapper
Definition: MMap.h:64
BLACKBONE_API void Cleanup()
Remove any traces from remote process
Definition: MMap.cpp:1113
Definition: MemBlock.h:39
BLACKBONE_API void reset()
Reset local data
Definition: MMap.h:119
BLACKBONE_API bool UnmapAllModules()
Unmap all manually mapped modules
Definition: MMap.cpp:346
Definition: AsmHelper32.cpp:6
BLACKBONE_API void Reset()
Try to free memory and reset pointers
Definition: MemBlock.cpp:199