Reputation: 18429
Is it possible to open or query a named mutex, using OpenMutex, by its full path qualification? For example:
HANDLE hHandleMutex = OpenMutex(READ_CONTROL, FALSE,
"\\Sessions\\1\\BaseNamedObjects\\SmartScreen_AppRepSettings_Mutex");
However, the function returns NULL and fails with error 161 (ERROR_BAD_PATHNAME
: The specified path is invalid). Yes, the documentation says well about \\Global
and \\Local
prefixes and doesn't state anything about these full object names. However, MSDN doesn't state everything!
I am aware that we can query the same using NtQuerySystemInformation
, NtQueryObject
undocumented APIs. But that involves opening process, duplicating the token etc. I can very well use these APIs, but wanted a simple solution.
Let's assume that process is running as a SYSTEM account, so error 5 (access denied) won't be a problem. If that's the problem, I can handle it.
Upvotes: 0
Views: 1809
Reputation: 613262
You are using the wrong path. It should be:
"Session\\1\\SmartScreen_AppRepSettings_Mutex"
The documentation says that the Session\
prefix is "reserved for system" use. Caveat emptor.
Upvotes: 3