- Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathmain.cpp
More file actions
Latest commit
46 lines (36 loc) · 835 Bytes
/
Copy pathmain.cpp
File metadata and controls
46 lines (36 loc) · 835 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
#include<windows.h>
#include"resource.h"
#include"MemoryModulePP.h"
BOOLLoadDllFromRes(PVOID *pDllData, DWORD *dwDllSize)
{
HMODULE hInstance = GetModuleHandle(NULL);
HRSRC hRes;
#if defined(_WIN64)
hRes = FindResource(hInstance, MAKEINTRESOURCE(IDR_DLL_X641),TEXT("DLL_X64"));
#else
hRes = FindResource(hInstance, MAKEINTRESOURCE(IDR_DLL_X861), TEXT("DLL_X86"));
#endif
if (hRes == NULL)
{
returnFALSE;
}
*pDllData = (PVOID)LoadResource(hInstance, hRes);
*dwDllSize = SizeofResource(hInstance, hRes);
returnTRUE;
}
intmain()
{
PVOID pDllData = NULL;
DWORD dwDllSize = 0;
PMEMORYMODULE pMemdll = NULL;
if (LoadDllFromRes(&pDllData,&dwDllSize))
{
pMemdll = MemoryLoadLibrary(pDllData, dwDllSize);
if (pMemdll != NULL)
{
MemoryFreeLibrary(pMemdll);
}
}
getchar();
}