An application can use DosQueryMutexSem to determine the current owner of a mutex semaphore and to obtain a count of the number of requests on it. If the mutex semaphore is not owned, the request count is 0.
Any thread in the process that created a mutex semaphore can obtain information about the semaphore by calling DosQueryMutexSem. Threads in other processes can also call DosQueryMutexSem, but they must first gain access to the semaphore by calling DosOpenMutexSem.
If the mutex semaphore exists and is owned, DosQueryMutexSem returns the process and thread identifications of the owner, as well as the request count for the semaphore. The request count is the number of DosRequestMutexSem calls minus the number of DosReleaseMutexSem calls that have been made for the semaphore by the owning thread.
If DosQueryMutexSem returns a request count of 0, the mutex semaphore is unowned.
If the owning process ended without calling DosCloseMutexSem, then ERROR_SEM_OWNER_DIED is returned, and the output parameters contain information about the ended owning process.