我在当前登陆用户下OpenFileMapping,然后有另一个登陆用户身份运行的进程用OpenFileMapping
打开同样的MappingFileNam,但OpenFileMapping却打不开。提示访问拒绝,各位大大有什么办法解决吗?
背景:需要在多用户多进程环境下共享内存通讯。

解决方案 »

  1.   

    主要是因为权限模式的问题。请参考这篇文章:http://www.microsoft.com/msj/0398/service2.aspx
      

  2.   

    There are several ways to resolve this problem. The easiest method is applying a NULL DACL to the object, if securing the object isn't a concern. As I stated earlier, a NULL DACL gives every user and group full access to the object. (Knowledge Base article Q106387 will help you out here.) If access control to the object is a concern, the best method is to create an ACE granting the specific access control for the trustee. This new ACE would be applied to the DACL for the securable object. One last method would be to modify the default DACL for the process's access token. With this method, you can still pass NULL for the security attributes parameter and let the system create the DACL for you. The only difference is that you are controlling the DACL that will be created for your objects. This means you won't have to keep passing in your customized SECURITY_ATTRIBUTES to every object you create.
      

  3.   

    参考: http://support.microsoft.com/kb/106387/EN-US/