forked from zzyGodofWar/EVplayer2Crack
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdllmain.cpp
82 lines (61 loc) · 1.62 KB
/
dllmain.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <Windows.h>
#include <processthreadsapi.h>
#include "MinHook.h"
#ifdef _WIN64
#pragma comment(lib,"libMinHook.x64.lib")
#else
#pragma comment(lib,"libMinHook.x86.lib")
#endif // _WIN64
void InitApiHook();
HWND thisHwnd;
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)InitApiHook, 0, 0, 0);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
PVOID orgSetWindowDisplayAffinity;
PVOID orgOpenProcess;
typedef BOOL(WINAPI *lpSetWindowDisplayAffinity)(HWND, DWORD);
BOOL WINAPI mySetWindowDisplayAffinity(
HWND hWnd,
DWORD dwAffinity
) {
return ((lpSetWindowDisplayAffinity)orgSetWindowDisplayAffinity)(hWnd, 0);
}
HANDLE
WINAPI
myOpenProcess(
_In_ DWORD dwDesiredAccess,
_In_ BOOL bInheritHandle,
_In_ DWORD dwProcessId
) {
return (HANDLE)-1;
}
void InitApiHook() {
if (MH_Initialize()) {
MessageBoxA(NULL, "初始化失败", "失败", 0);
}
if (MH_CreateHook(SetWindowDisplayAffinity, mySetWindowDisplayAffinity, &orgSetWindowDisplayAffinity)) {
MessageBoxA(NULL, "创建HOOK失败", "失败", 0);
}
MH_EnableHook(SetWindowDisplayAffinity);
thisHwnd = FindWindowA("Qt5QWindowIcon", "EVPlayer2");
SetWindowDisplayAffinity(thisHwnd, 0);
MessageBoxA(NULL, "By Fizzy", "破解成功", 0);
if (MH_CreateHook(OpenProcess, myOpenProcess, &orgOpenProcess)) {
MessageBoxA(NULL, "创建HOOK失败", "失败", 0);
}
MH_EnableHook(OpenProcess);
}