-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
95 lines (83 loc) · 3.77 KB
/
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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "widget.h"
#include <QApplication>
#include <windows.h>
#include <fstream>
#include <QDebug>
#include <cassert>
#include <QLibrary>
#include <QMessageBox>
#include <QReadWriteLock>
using namespace std;
#pragma comment(lib, "D:/SSdesign/detours/lib.X64/detours.lib")
#pragma comment(lib, "ws2_32.lib")
wchar_t currentDirectory[0x1000];
QLibrary injectLib("injectionDLL");
void (*InjMessageBoxAFunc)(bool);
void (*InjMessageBoxWFunc)(bool);
void (*InjHeapCreateFunc)(bool);
void (*InjHeapDestroyFunc)(bool);
void (*InjHeapAllocFunc)(bool);
void (*InjHeapFreeFunc)(bool);
void (*InjOpenFileFunc)(bool);
void (*InjCreateFileFunc)(bool);
void (*InjReadFileFunc)(bool);
void (*InjWriteFileFunc)(bool);
void (*InjCloseHandleFunc)(bool);
void (*InjRegCreateKeyExFunc)(bool);
void (*InjRegSetValueExFunc)(bool);
void (*InjRegDeleteValueFunc)(bool);
void (*InjRegCloseKeyFunc)(bool);
void (*InjRegOpenKeyExFunc)(bool);
void (*InjRegDeleteKeyExFunc)(bool);
void (*InjSendFunc)(bool);
void (*InjRecvFunc)(bool);
void (*InjConnectFunc)(bool);
void (*InjBindFunc)(bool);
void (*InjSocketFunc)(bool);
void (*InjAcceptFunc)(bool);
bool (*getMutexSignal)(void);
void (*setMutexSignal)(void);
char* (*getLastHookBeforeCall)(void);
//bool (*MessageBoxAInjected)(void);
//bool (*MessageBoxWInjected)(void);
//bool (*HeapCreateInjected)(void);
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setApplicationVersion("2.9.1");
// 检查injectionDLL.dll是否存在
if(!injectLib.load()){
QMessageBox::critical(nullptr, "DLL缺失", "找不到injectionDLL.dll,程序无法执行!");
exit(1);
}
GetCurrentDirectory(0x1000, currentDirectory);
InjMessageBoxAFunc = (void(*)(bool))injectLib.resolve("openInjectMessageBoxA");
InjMessageBoxWFunc = (void(*)(bool))injectLib.resolve("openInjectMessageBoxW");
InjHeapCreateFunc = (void(*)(bool))injectLib.resolve("openInjectHeapCreate");
InjHeapDestroyFunc = (void(*)(bool))injectLib.resolve("openInjectHeapDestroy");
InjHeapAllocFunc = (void(*)(bool))injectLib.resolve("openInjectHeapAlloc");
InjHeapFreeFunc = (void(*)(bool))injectLib.resolve("openInjectHeapFree");
InjOpenFileFunc = (void(*)(bool))injectLib.resolve("openInjectOpenFile");
InjCreateFileFunc = (void(*)(bool))injectLib.resolve("openInjectCreateFile");
InjReadFileFunc = (void(*)(bool))injectLib.resolve("openInjectReadFile");
InjWriteFileFunc = (void(*)(bool))injectLib.resolve("openInjectWriteFile");
InjCloseHandleFunc = (void(*)(bool))injectLib.resolve("openInjectCloseHandle");
InjRegCreateKeyExFunc = (void(*)(bool))injectLib.resolve("openInjectRegCreateKeyEx");
InjRegSetValueExFunc = (void(*)(bool))injectLib.resolve("openInjectRegSetValueEx");
InjRegDeleteValueFunc = (void(*)(bool))injectLib.resolve("openInjectRegDeleteValue");
InjRegCloseKeyFunc = (void(*)(bool))injectLib.resolve("openInjectRegCloseKey");
InjRegOpenKeyExFunc = (void(*)(bool))injectLib.resolve("openInjectRegOpenKeyEx");
InjRegDeleteKeyExFunc = (void(*)(bool))injectLib.resolve("openInjectRegDeleteKeyEx");
InjSendFunc = (void(*)(bool))injectLib.resolve("openInjectSend");
InjRecvFunc = (void(*)(bool))injectLib.resolve("openInjectRecv");
InjConnectFunc = (void(*)(bool))injectLib.resolve("openInjectConnect");
InjBindFunc = (void(*)(bool))injectLib.resolve("openInjectBind");
InjSocketFunc = (void(*)(bool))injectLib.resolve("openInjectSocket");
InjAcceptFunc = (void(*)(bool))injectLib.resolve("openInjectAccept");
getMutexSignal = (bool(*)(void))injectLib.resolve("getMutexSignal");
setMutexSignal = (void(*)(void))injectLib.resolve("setMutexSignal");
getLastHookBeforeCall = (char*(*)(void))injectLib.resolve("getLastHookBeforeCall");
Widget w;
w.show();
return a.exec();
}