This site uses advanced css techniques
This is a Win32 service that sets the permissions on a central kernel mutex (the DBWinMutex object) that is used by the debugging system. Windows has what we consider a bug that prevents non-admin users from sending debugging information via the OutputDebugString() API function to a debugger. This happens under common circumstances, and has been very annoying.
After much digging and research, we nailed the problem to the DACL (Discretionary Access Control List) on the DBWinMutex object and a limitation on the behavior of CreateMutex() if the mutex already exists. We have written up a full exposition on this in a Tech Tip, and we'll defer the gory details to it.
This service, which launches at system boot time, creates the required mutex object (or opens it if already present), and then sets the DACL to allow free access to anybody. Once done, it simply sleeps until it's asked to shutdown. As long as it never exits, it retains a HANDLE to this mutex, and it allows OutputDebugString() to work correctly for everybody.
This program was build on and for Windows 2000 Professional, and a bit of research suggests that NT4 does not have the problem that warrants the use of dbmutex. Use at your own risk on other platforms.
Installation is done from the command line by putting the executable in a suitable place (C:\bin, perhaps) and running it with either the -install (so it requires a manual start at system boot) or -installauto (the service starts automatically at boot) options. The service itself is never launched during installation, but it's easy to do by hand. There's also a "remove" option.
C> CD \BIN C> dbmutex -install install service with manual start C> dbmutex -installauto install service with auto start C> net start dbmutex start the service! C> net stop dbmutex stop the service C> dbmutex -remove stop and remove the service
Installing a service requires SC_MANAGER_CREATE_SERVICE rights, which in practice means "Administrator". This is a Win32 limitation, not one of this program: we routinely request the bare minimum of rights when accessing or creating kernel objects.
Once the service is running, it should require no attention. The only thread of execution sits blocked on an Event object that fires when the service is to be shut down, so it should consume zero CPU time.
Source and a prebuilt binary are available for this service. I promise that the binary (dbmutex.exe) was built from this source, and that it attempts no shenanigans. I don't promise it has no bugs.
We do all of our development at the command line (really!), so we have no MSVC project file to offer. The compile and link instructions are found in comments near the top of the program.
Wed Dec 10 20:35:33 PST 2003 - version 1.0.1 - Initial release