I have a library that uses a named mutex to protect access to shared configuration data in the registry.
This library is now used both in a "normal" desktop application, and a Shell Preview extension handler. I observe the following behavior:
I provide a nullptr
security descriptor to CreateMutex
.
How do I initialize a security descriptor that allows sharing the mutex between PrevHost.exe and a desktop application running under the current user?
The documentation says that if CreateMutex
succeeds then the mutex is created with all access privileges. But if the mutex is already created with reduced privileges then CreateMutex
cannot expand on them, and so it fails. This is my interpretation, but I could be wrong.
The solution in any case is to follow up with OpenMutex
.