Stackwalk64 是否适用于 Windows Server 2012 和 2008R2?我无法使用此代码。这里的其他人有工作吗?我用它来为另一个线程生成堆栈跟踪。
我正在使用:
myframe.AddrPC.Mode = AddrModeFlat;
myframe.AddrFrame.Mode = AddrModeFlat;
myframe.AddrStack.Mode = AddrModeFlat;
myframe.AddrPC.Offset = context.Rip;
myframe.AddrFrame.Offset = context.Rbp;
myframe.AddrStack.Offset = context.Rsp;
while(pStackWalk64(IMAGE_FILE_MACHINE_AMD64, GetCurrentProcess(), handleforanotherthread,&myframe,
&context, NULL, funcTableAccess, SymGetModuleBase64, NULL))
{
if(myframe.AddrPC.Offset == myframe.AddrReturn.Offset)
break;
}
Run Code Online (Sandbox Code Playgroud)
它失败并且返回的地址无效。