2
您好,我正试图获取系统上64位进程的线程上下文。我试过用正确的函数同时使用32位和64位解决方案。但我总是以错误'0x57',无效的参数结束。来自64位代码的简短示例。无法从Windows 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位进程上正常工作。我将不胜感激任何帮助或建议。提前致谢!
哪个功能失败? – hmjd 2012-07-09 13:32:35
所以你尝试'Wow64GetThreadContext()'? – alk 2012-07-09 13:42:00
对不起,我没有澄清,WoW64GetThreadContext失败,错误'错误'0x57',无效参数'。 GetThreadContext也是如此。 – 2012-07-09 14:13:31