RE: EnumProcessModules error - FOLLOWUP

I asked:

What does ERROR_PARTIAL_COPY mean as an error return from
EnumProcessModules()?

No answers so…

Reminds me of the story about the guy who goes to the Doc and says “Doc, it
really hurts when I do this” to which the Doc replies “Well, don’t do that.”

This seems to do the trick… I turn on a bunch of priviledges before trying
it though. (That code is left over from the EnumProcessModules mess. Not
sure if I still need it.)

HANDLE hProcessSnap;
PROCESSENTRY32 pe32;

//
// Take a snapshot of all processes in the system.
//
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
if (hProcessSnap == INVALID_HANDLE_VALUE ) {
TRACE0 (“*** Can not get snapshot\n” );
return;
}

//
// Set the size of the structure before using it.
//
pe32.dwSize = sizeof( PROCESSENTRY32 );

//
// Retrieve information about the first process and exit if
unsuccessful
//
if (!Process32First( hProcessSnap, &pe32)) {
TRACE0( “Process32First” ); // Show cause of failure
CloseHandle( hProcessSnap ); // Must clean up the
snapshot object!
return;
}

//
// Walk the snapshot of processes
//
do {
AddProcessClass (pe32.szExeFile, pe32.th32ProcessID,
LockHeld);
}
while (Process32Next( hProcessSnap, &pe32));

CloseHandle (hProcessSnap);

It seems to work on both 32 and 64-bit systems (with the app compiled on
32-bit only). Now all I have to do is figure out what the ‘32’ means in
CreateToolhelp32Snapshot(). Is there a 64?

Regards,
Mickey.