Boost :: interprocess between a Windows service and a user application

I am using boost :: interprocess to communicate between two applications. When two applications are launched by the same user, it works great.

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

I found that the shared media is actually a file created in the "TMP" directory. Therefore, it fails because each application creates its own file in its own "TMP" directory.

Perhaps I am not using this method for my specific purpose.

Does anyone know how to solve my problem?

Thank you very much,

Nick


EDIT : I tried using "managed_mapped_file". My problem is that the win32 implementation calls "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 associated file.

+4
source share
2 answers

Here's what works:

  • I use "boost :: interprocess :: managed_windows_shared_memory"
  • My section name is "Global \ MySharedMemory"
  • I need to handle the case when the application is running, but the service is not. This is due to the fact that even if my application can have read / write access to shared memory, it cannot create it. Only a service can. (In fact, an application can if and only if the user executing it has the SeCreateGlobalPrivilege special privilege)

Maybe someone can find a better way :-)

Nick

+4
source

it's something about Window Stations and ACLs. you need to change the source to work between the windows service and the user application. in Vista and Win7, services run on winsta0, but applications run on winsta1. therefore you need to provide LPSECURITY_ATTRIBUTES with the correct DACL.

+1
source

All Articles