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