how does procexp close a mutex held by another process?

后端 未结 2 393
广开言路
广开言路 2021-01-03 08:03

I am trying to close a mutex that is being held by a process on Windows using Win32 functions. This can be done using procexp but I need to do it programmatically without us

2条回答
  •  一个人的身影
    2021-01-03 08:41

    Use NtQuerySystemInformation() to retrieve an array of open handles, loop through the array until you find the desired mutex handle in the target process, then close it using DuplicateHandle() by specifying the DUPLICATE_CLOSE_SOURCE flag.

    The following article explains it in more detail:

    HOWTO: Enumerate handles

提交回复
热议问题