問題與this相同,但是,該解決方案對我無效。`DebugActiveProcessStop'未申報(首次使用此功能)
根據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;
}
'我正在使用Windows 7' - 那又怎樣?絕對不管你在哪個系統上編譯你的代碼。只有你使用哪個* sdk *版本纔是重要的(並且完全可以使用)。如果您使用* sdk * - 只需搜索「DebugActiveProcessStop」聲明的位置,是否在條件塊(*#if *)中,並且符合此條件 – RbMm