forked from snowie2000/mactype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dll.h
31 lines (27 loc) · 845 Bytes
/
dll.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <windows.h>
typedef BOOL (__stdcall *ProcDllMain)(HINSTANCE, DWORD, LPVOID );
class CMemLoadDll
{
public:
CMemLoadDll();
~CMemLoadDll();
BOOL MemLoadLibrary( void* lpFileData , int DataLength, bool bInitDllMain, bool bFreeOnRavFail); // Dll file data buffer
FARPROC MemGetProcAddress(LPCSTR lpProcName);
DWORD_PTR GetImageBase() {return pImageBase;};
private:
BOOL isLoadOk;
BOOL CheckDataValide(void* lpFileData, int DataLength);
int CalcTotalImageSize();
void CopyDllDatas(void* pDest, void* pSrc);
BOOL FillRavAddress(void* pBase);
void DoRelocation(void* pNewBase);
int GetAlignedSize(int Origin, int Alignment);
private:
ProcDllMain pDllMain;
private:
DWORD_PTR pImageBase;
bool m_bInitDllMain;
PIMAGE_DOS_HEADER pDosHeader;
PIMAGE_NT_HEADERS32 pNTHeader;
PIMAGE_SECTION_HEADER pSectionHeader;
};