代码:
#include <windows.h>
#include <iostream>
#include <imagehlp.h>
int main() {
HANDLE process = GetCurrentProcess();
if (GetLastError()) {
printf("GetCurrentProcess failed: %d\n", GetLastError());
return 1;
}
if (!SymInitialize(process, NULL, TRUE)) {
printf("SymInitialize failed: %d\n", GetLastError());
return 1;
} else if (GetLastError()) {
printf("SymInitialize returned true but failed nonetheless: %d\n", GetLastError());
return 1;
}
}
它返回:SymInitialize returned true but failed nonetheless: 2
错误 2 表示“系统找不到指定的文件”。什么文件,我不能在这里把它放在任何上下文中。我从文档中了解到,如果此函数成功 GetLastError必须为零。