-
Notifications
You must be signed in to change notification settings - Fork 45
/
Main.cpp
56 lines (40 loc) · 1008 Bytes
/
Main.cpp
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
47
48
49
50
51
52
53
54
55
56
#include "APIDummy.h"
#include "CIL.h"
#include <stdio.h>
#include <intrin.h>
VOID WINAPI ShowConsole()
{
AllocConsole();
AttachConsole(GetCurrentProcessId());
freopen("CON", "w", stdout);
char cc[128];
sprintf_s(cc, "Client: %i", GetCurrentProcessId());
SetConsoleTitleA(cc);
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
DisableThreadLibraryCalls(hinstDLL);
if (fdwReason == DLL_PROCESS_ATTACH)
{
//ShowConsole(); //Uncomment for debugging.
if (Hook_InitializeResMan(true)) {
printf("Resman is hooked.\n");
}
return TRUE;
}
printf("Hook failed.\n");
return FALSE;
}
DWORD GetFuncAddress(LPCSTR lpModule, LPCSTR lpFunc)
{
auto mod = LoadLibraryA(lpModule);
if (!mod)
{
return 0;
}
auto address = (DWORD)GetProcAddress(mod, lpFunc);
printf(__FUNCTION__ " [%s] %s @ %8X\n", lpModule, lpFunc, address);
return (DWORD)GetProcAddress(mod, lpFunc);
}
APIDummy::APIDummy() {
}