-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdllmain.cpp
More file actions
31 lines (30 loc) · 842 Bytes
/
dllmain.cpp
File metadata and controls
31 lines (30 loc) · 842 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
#include "PatternScan.h"
#include <iostream>
DWORD WINAPI main(LPVOID lpParameter)
{
FILE* f;
AllocConsole();
freopen_s(&f, "CONOUT$", "w", stdout);
const BYTE pattern[] = { 0x80, 0x26, 0x68, 0x0E, 0xB0, 0x00 };
LPCSTR patternMask = "xxxxx?";
LPVOID address = FindPattern(pattern, patternMask);
FreeLibraryAndExitThread((HMODULE)lpParameter, NULL);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
CreateThread(NULL, 0, main, hModule, 0, NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}