Harding
October 30th, 2007, 14:26
First of all I have been searching and searching and talking to people but none seems to know. I have read (and posted) on: http://www.nynaeve.net/?p=129
But I'm duping my question here if anyone knows (I'm really not keen on the idea of reimplementing Wow64GetThreadContext()).
Scenario: I am coding a custom debugger and it works fine under x86. I move the files to my x64 computer (Windows XP x64) and it fails on GetThreadContext() with a ACCESS_DENIED error.
I have read http://msdn2.microsoft.com/en-us/library/ms679362.aspx (MSDN for GetThreadContext()) and I do have THREAD_QUERY_INFORMATION (actually as you will se in the code snippet I open the thread with THREAD_ALL_ACCESS | THREAD_QUERY_INFORMATION to be on the safe side.)
Wow64GetThreadContext() does only exist in Vista so I can't use that one.
Here is a part of the code that gets called when I hit a INT3:
Do anyone have any idea on how to get this one working under x64?
But I'm duping my question here if anyone knows (I'm really not keen on the idea of reimplementing Wow64GetThreadContext()).
Scenario: I am coding a custom debugger and it works fine under x86. I move the files to my x64 computer (Windows XP x64) and it fails on GetThreadContext() with a ACCESS_DENIED error.
I have read http://msdn2.microsoft.com/en-us/library/ms679362.aspx (MSDN for GetThreadContext()) and I do have THREAD_QUERY_INFORMATION (actually as you will se in the code snippet I open the thread with THREAD_ALL_ACCESS | THREAD_QUERY_INFORMATION to be on the safe side.)
Wow64GetThreadContext() does only exist in Vista so I can't use that one.
Here is a part of the code that gets called when I hit a INT3:
Code:
hThreadHandle = OpenThread(THREAD_ALL_ACCESS | THREAD_QUERY_INFORMATION, FALSE, debugEvent.dwThreadId);
processContext.ContextFlags = CONTEXT_ALL;
DWORD lastError = GetThreadContext(hThreadHandle, &processContext);
processContext.Eip = (DWORD)debugEvent.u.Exception.ExceptionRecord.ExceptionAddress;
SetThreadContext(hThreadHandle, &processContext);
CloseHandle(hThreadHandle);
WriteProcessMemory(processInfo.hProcess, (LPVOID)(Iter->breakAtAddress), &(Iter->byteBefore), 1, NULL);
Do anyone have any idea on how to get this one working under x64?