【发布时间】:2017-05-28 04:26:48
【问题描述】:
问题与this 相同,但是该解决方案对我不起作用。
根据DebugActiveProcessStop 函数文档,支持的最低客户端是Windows XP。我使用的是 Windows 7。
// #ifdef _WIN32_WINNT
// #undef _WIN32_WINNT
// #endif
#define NTDDI_VERSION 0x05010000
// #define _WIN32_WINNT 0x0502
#include <iostream>
#include <windows.h>
using namespace std;
class CppDBG
{
...
public:
BOOL detach (void);
...
};
...
BOOL CppDBG :: detach (void)
{
if (DebugActiveProcessStop(pid)) {
cout << "[+] Finished debugging. Exiting...";
return true;
}
else {
cout << "[-] Error" << endl;
return false;
}
}
int main()
{
CppDBG dbg;
...
dbg.detach();
return 0;
}
【问题讨论】:
-
I am using Windows 7- 那又怎样?无论您在哪个系统上编译代码,都是绝对的。仅重要的是您使用的 sdk 版本(并且完全在使用)。如果您使用 sdk - 只需搜索声明DebugActiveProcessStop的位置,它是否在条件块 (#if) 中并符合此条件