boost::interprocess between Windows service and user application

I'm using boost::interprocess to communicates between two applications. When the two applications are launch by the same user, it works great.

When one of the application is a service, it fails.

I found that the shared media is in fact a file that is created in the "TMP" directory. So it fails because each application is creating his own file in his own "TMP" directory.

Maybe I'm not using it the good way for my particular purpose.

Does anybody having a clue of how to solve my problem?

Thanks a lot,


EDIT: I tried using "managed_mapped_file". My problem is that the win32 implementation is calling "CreateFileMapping" without specifying a name for the object. In my special case, I think I need to specify something like "Global\MyMappedFile" so that both the application and the service can view the mapped file.

2 Answers

  1. Kevin- Reply


    Here is something that works :

    • I'm using "boost::interprocess::managed_windows_shared_memory"
    • The name of my section is "Global\MySharedMemory"
    • I have to handle the case where the application is started and the service not. This is because even if my application can have read/write access to the shared memory, it can't create it. Only the service can. (In fact, the application can if and only if the user running it has a special privilege SeCreateGlobalPrivilege)

    Maybe somebody can find a better way ;-)


  2. Lance- Reply


    it's something about the Window Stations and ACL. you need to modify the source to make it work between windows service and user application. in vista and win7, services run at winsta0, but applications at winsta1. so you need to give a LPSECURITY_ATTRIBUTES with the right DACL.

Leave a Reply

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

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>