This is a follow-up to the Kernel Object Namespace and Vista post. Those previous findings were made using an administrative user in Vista. When I tried creating a 'Session\AppName' Mutex as a non-administrative user though, the application hung!
Just to be clear, here is how (simplified) I'm creating the Mutex:
1 2 3 4 5 6 7 8 |
string MutexName = @"Session\AppName"; bool mutexWasCreated; MutexSecurity mSec = new MutexSecurity(); MutexAccessRule rule = new MutexAccessRule( new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl,AccessControlType.Allow); mSec.AddAccessRule(rule); Mutex m = new Mutex(false, mutexName, out mutexWasCreated, mSec); |
The hang occurs when the Mutex is created. By hang I mean that the process just spins its wheels sucking 50-60% of the CPU and will continue until it's killed. Based on WinDbg analysis it's either stuck in the underlaying Win32 CreateMutex()
call or CreateMutex()
is being called repeatedly. It's probably the later.
When 'Local\' or 'Global\' are used, the Mutex is created fine! As noted before, 'Local\' doesn't work for other reasons so I'm stuck using the 'Global\' namespace. Go figure?
Answered: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2150353&SiteID=1&mode=1
Pingback: Medical » Medical September 15, 2007 1:56 am