资源简介
QQ华夏,过反调试检测代码,仅用于学习交流,切勿用于违法用途,否则本人一概不负责任,不同意切建议勿下载或者立即删除。
代码片段和文件信息
#include “Main.h“
#include “PassSafe.h“
BOOL APIENTRY DllMain(
HMODULE hModule
DWORD ul_reason_for_call
LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
QQhxPassSafe();
}break;
case DLL_THREAD_ATTACH:
{
}break;
case DLL_THREAD_DETACH:
{
}break;
case DLL_PROCESS_DETACH:
{
}break;
}
return TRUE;
}
void QQhxPassSafe()
{
// 检测调试器附加
ULONG IsDebuggerPresentAddr = 0;
ULONG CheckRemoteDebuggerPresentAddr = 0;
ULONG NtQueryInformationProcessAddr = 0;
IsDebuggerPresentAddr = GetModuleFunction(“KERNELbase.DLL“ “IsDebuggerPresent“);
if (!IsDebuggerPresentAddr)
{
MessageBox(NULL “未找到 IsDebuggerPresent“ “错误“ MB_OK);
return;
}
CheckRemoteDebuggerPresentAddr = GetModuleFunction(“kernel32.dll“ “CheckRemoteDebuggerPresent“);
if (!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL “未找到 CheckRemoteDebuggerPresent“ “错误“ MB_OK);
return;
}
NtQueryInformationProcessAddr = GetModuleFunction(“ntdll.dll“ “NtQueryInformationProcess“);
if (!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL “未找到 NtQueryInformationProcess“ “错误“ MB_OK);
return;
}
JMP(IsDebuggerPresentAddr (ULONG)PassSafe_IsDebuggerPresent);
JMP(CheckRemoteDebuggerPresentAddr (ULONG)PassSafe_CheckRemoteDebuggerPresent);
JMP(NtQueryInformationProcessAddr (ULONG)PassSafe_NtQueryInformationProcess);
// 检测断点
ULONG NtSetinformationThreadAddr = 0;
NtSetinformationThreadAddr = GetModuleFunction(“ntdll.dll“ “NtSetInformationThread“);
if (!CheckRemoteDebuggerPresentAddr)
{
MessageBox(NULL “未找到 NtSetinformationThread“ “错误“ MB_OK);
return;
}
JMP(NtSetinformationThreadAddr (ULONG)PassSafe_NtSetInformationThread);
// 检测进程 游戏会枚举进程是否存在非法调试器
ULONG EnumProcessesAddr = GetModuleFunction(“PSAPI.DLL“ “EnumProcesses“);
if (!EnumProcessesAddr || !SetMemoryProtect(EnumProcessesAddr 8 PAGE_EXECUTE_READWRITE))
{
MessageBox(NULL “Pass EnumProcesses 失败“ “错误“ MB_OK);
return;
}
else
{
byte code[] = { 0xB80x000x000x000x000xC20x0C0x00 };
memcpy((void*)EnumProcessesAddr code 8);
}
// 检测窗口 游戏会枚举窗口文字是否有非法文字
ULONG EnumWindowsAddr = GetModuleFunction(“user32.dll“ “EnumWindows“);
if (!EnumWindowsAddr || !SetMemoryProtect(EnumWindowsAddr 8 PAGE_EXECUTE_READWRITE))
{
MessageBox(NULL “Pass EnumWindows 失败“ “错误“ MB_OK);
return;
}
else
{
byte code[] = { 0xB80x000x000x000x000xC20x080x00 };
memcpy((void*)EnumWindowsAddr code 8);
}
// 创建一个线程等待游戏加载完检测模块在恢复HOOK
HANDLE hThread = CreateThread(NULL 0 PassSafeThread NULL 0 NULL);
if (!hThread)
{
MessageBox(NULL “创建 PassSafeThread 失败“ “错误“ MB_OK);
return;
}
CloseHandle(hThread);
}
ULONG GetModuleFunction(const char* szModuleName const char* szFunctionName)
{
HMODULE hModule = NULL;
hModule = GetModuleHandle(szModuleName);
if (!hModule)
{
retur
- 上一篇:废品回收网站的设计与开发开题报告
- 下一篇:连连看游戏的设计思路文档
评论
共有 条评论