Kernel Object Namespace and Vista

Just a quick development note:

According to Kernel Object Namespaces objects can have one of three predefined prefixes -- 'Local\', 'Global\', or 'Session\'. For Win2K/XP I've always used the 'Local\' prefix, which works fine. My primary use is with a Mutex to determine that a single instance of an application is running (like here). I also use the Mutex from a system service to discover if a GUI application is available for messaging. When trying to run the some code on Vista I found that the 'Local\' namespace does not work when Mutex.OpenExisting() is called from a the system service which is owned by a different user (from the same user, it works fine). So it appears that the 'Local\' prefix in Vista has a different behavior for the client session namespace than it does in Win2K/XP.

I searched around for a solution, but was unable to find a definitive answer. I did find a post about the Private Object Namespace which alludes to Vista kernel changes, but that's all. Here's what I determined empirically:

[TABLE=2]

The NO entries in the table mean that the namespace did not work. So, it appears that in order to support all three Windows versions I'd have to use the 'Global\' namespace. This is not a good solution. Unless I find another way, I'll have to determine the OS version and select the appropriate namespace at runtime ('Session\' for Vista, 'Local\' for Win2K/XP).

This entry was posted in .NET, GUI, Vista. Bookmark the permalink.

3 Responses to Kernel Object Namespace and Vista

  1. Pingback: Bob on Medical Device Software » Blog Archive » More on using a Named Mutex in Vista

  2. Neha says:

    Did not work for me on Windows 7 … Any other suggestions?

Leave a Reply

Your email address will not be published. Required fields are marked *