forked from strivexjun/XAntiDebug
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.cpp
More file actions
44 lines (33 loc) · 715 Bytes
/
example.cpp
File metadata and controls
44 lines (33 loc) · 715 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
// example.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <windows.h>
#include "XAntiDebug/XAntiDebug.h"
int _tmain(int argc, _TCHAR* argv[])
{
//
// 推荐使用 FLAG_DETECT_DEBUGGER | FLAG_DETECT_HARDWAREBREAKPOINT,如果你对原理不熟悉的,不要用其他的
//
XAD_STATUS status;
XAntiDebug antiDbg(GetModuleHandle(NULL), FLAG_FULLON);
BOOL result;
//
// 在程序最早的时候初始化 如 WinMain 或 DllMain
//
status = antiDbg.XAD_Initialize();
if (status != XAD_OK)
{
printf("initialize error. %d\n", status);
return 0;
}
//
// 调用检测
//
for (;;)
{
result = antiDbg.XAD_ExecuteDetect();
printf("result = %s\n", result ? "true" : "false");
getchar();
}
return 0;
}