Get the name of all the pens in the current process

I need to list all open descriptors in the current process. Since I could not find any function, such as "EnumHandles", I was thinking of creating a loop from 0 to 1000. The question is, how can I get the name of each descriptor? I am using C ++ and the OS is Win7 32-bit EDIT: Pen, I need the name Mutex. Comparing the name of the mutex, I want to get the descriptor identifier. I seem to have found a solution using OpenMutex, but I don’t know what to pass with the third parameter,

+6
source share
1 answer

I believe you need to use NTDLL.DLL. As far as I know, this is that all process monitoring tools, pens and other system information should be used at the end, under Windows. I used it in a small Win32 tool, but I never had to list handles.

Check here to get a good idea about this library and related to your question. http://forum.sysinternals.com/howto-enumerate-handles_topic18892.html

Also the GetObjectName function in the first post http://forum.sysinternals.com/enumerate-opened-files_topic3577.html

Accessing such information on Windows may seem very difficult and looks frightening because Microsoft does not want to support it, but you will see that when the “simple” API does not give you what you need, you will have to dig to NTDLL. This is what tools like ProcessExplorer are used at the end. It's not that difficult: load the DLL, get the right function pointers to populate the structures that you declare yourself with what you find on the network.

+5
source

Source: https://habr.com/ru/post/905021/


All Articles