您好,我正在尝试获取系统上 64 位进程的线程上下文。我尝试过使用具有正确功能的 32 位和 64 位解决方案。但我总是以错误'0x57',无效参数结束。来自 64 位代码的简短示例。
// open a handle to the thread
HANDLE hThread = OpenThread(THREAD_GET_CONTEXT | THREAD_SET_CONTEXT |
THREAD_SUSPEND_RESUME | THREAD_QUERY_INFORMATION, FALSE,
atoi(argv[1]));
if(hThread == NULL) {
printf("Error opening thread handle.. 0x%08x\n", GetLastError());
return 0;
}
// suspend the thread
if(Wow64SuspendThread(hThread ) == -1) {
printf("Error suspending thread.. 0x%08x\n", GetLastError());
CloseHandle(hThread );
return 0;
}
// get the thread context
WOW64_CONTEXT orig_ctx = {WOW64_CONTEXT_FULL };
if(GetThreadContext(hThread , &orig_ctx) == FALSE) {
printf("Error 0x%08x\n", GetLastError());
CloseHandle(hThread );
return 0;
}
我怀疑句柄是错误的,代码在 32 位进程上正常工作。我将不胜感激任何帮助或建议。提前致谢!