I have a set of Win32 applications that share information using a shared memory segment created with CreateFileMapping()
and MapViewOfFile()
. One of the applications is a system service; the remainder are started by the logged-in user. On Windows XP, there was no problem. We named our segments “Global\Something” and all was well.
The additional security in Vista (and assumedly Windows 7) appears to prevent this architecture from working. Normal users are not allowed to create (Win32 error 5) objects in the global namespace. The MSDN indicates that if the account has the “create global” privilege then all should be well, but this does not seem to be the case in practice.
Also, Vista’s “integrity” features appear to prevent the “low integrity” user processes from accessing the “high integrity” service-created shared memory object. It looks like I should be able to fix this via some magical SetSecurityDescriptorSacl()
incantation, but I’m having difficulty learning to speak sacl.
So the question is: What is the proper way of using a shared memory segment between services and normal user processes?
To preempt the easy answer of “just turn off UAC”, we’re in a fairly locked-down environment and that is not a possibility.
Edit: Both the service and the user process need read/write access to the segment.