0

I can't find any documentation about this. I'm enumerating process handles in another process.

I check the value of SYSTEM_HANDLE::ObjectTypeNumber and apparently it's different between versions of Windows. I found this piece of code in a project on GitHub

// For XP & 2K3 : HANDLE_TYPE_PROCESS = 0x5
// For Vista & Longhorn : HANDLE_TYPE_PROCESS = 0x6
// Windows 8: HANDLE_TYPE_PROCESS = 0x7
#define HANDLE_TYPE_PROCESS 7

Strangely, it skips Windows 7. I've been checking various kernel related books (such as Windows Internals) and wasn't able to find the correct value for Windows 7. I don't own a Windows 7 machine to test on either.

Therefore, my code looks like this at the moment:

BYTE HANDLE_TYPE_PROCESS;
if(IsWindows8OrGreater()) HANDLE_TYPE_PROCESS = 7;
else if(IsWindowsVistaOrGreater()) HANDLE_TYPE_PROCESS = 6;
else HANDLE_TYPE_PROCESS = 5;

What's the object type number for process handles in Windows 7?

4

0 に答える 0