How to enum another process modules in Windows XP

2019-08-17 03:48发布

问题:

I already asked how to enum 32bit process modules from a 64bit process here. And the answer was EnumProcessModulesEx. All works fine on Windows 7 x64, but what about Windows XP x64? It seems that this api is supported on Vista and up. So what's the way to do it there?

回答1:

CreateToolHelp32Snapshot will do it.



回答2:

Probably something like this. Wrote it in notepad so might be wrong. But you get the idea.

HANDLE        hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
MODULEENTRY32 me32      = {0};

me32.dwSize = sizeof(MODULEENTRY32);
Module32First( hSnapshot, &me32 );

do {
  ...
} while( Module32Next( hSnapshot, &me32 ) );

CloseHandle( hSnapshot );