views:

797

answers:

3

Hi,

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,

Nic


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  A: 

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 ;-)

Nic

Nicolas
A: 

Hello, I'm dealing with a very similar problem and I would really appreciate a little more elaboration on this subject, since I'm totally new to boost::interprocess and couldn't found any use examples of managed_windows_shared_memory in the web. Thanks.

Edit: I'm working under windows vista.

joey_721
http://www.boost.org/doc/libs/1_40_0/doc/html/interprocess.html and the examples included with the boost distribution itself cover almost everything you could need.
Stuart
+1  A: 

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.

Liveck