CreateToolhelp32Snapshot fails when enumerating a 32bit process from a 32
bit process
I am writing a basic debugger in c++. I am trying to get a list of the
loaded modules of the debugged process from the debugger process. My OS is
64bit windows 7, but both the debugger and the debuggee are compiled 32
bit (when looked at in task manager, they have *32 next to their names).
Whenever I try to call CreateToolhelpSnapshot on the debuggee from the
debugger, I get a 299 error. MSDN says that this should only happen if
querying a 64 bit process from a 32 bit on or vice versa. Both of my
processes are 32 bit as far as I can tell.
Here is my snapshot code:
HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE32, pid);
if( hModuleSnap == INVALID_HANDLE_VALUE )
{
std::cout << "CreateToolhelp32Snapshot Error: " << GetLastError() <<
std::endl;
}
No comments:
Post a Comment