locked
windows 2008 CreateFileMapping service RRS feed

  • Question

  • i have a service in windows 2008 that creates the file mapping. It is running under local system. I also have a windows application that wants to use the same shared memory for communication. But it always open the new memory for it. no the one created by the service. I know there is some security issue. can any one help. can anyone provide a working example on windows 2008 server.
    Thursday, November 5, 2009 1:22 PM

Answers

  • Hi,

    I have already answer your other post concerning the same subject. Here is a copy of it :

    Hi,
    Are you creating your shared memory in the global namespace or in a session namespace? Your problems come certainly from the fact that, starting from Windows Server 2008 and Vista, Windows services run on Session 0 while user desktop and programs run on Session 1, Session 2, ... Thus, if you don't use the "Global\" prefix, the shared memory created by the services will only be accessible from Session 0, not from Session 1.

    The solution to your problem is this case is to add the prefix "Global\" to the name of the mapping object.

    Cheers,
    --
    Mounir IDRASSI
    IDRIX
    http://www.idrix.fr
    • Marked as answer by Mubashir Khan Tuesday, November 10, 2009 5:13 AM
    Sunday, November 8, 2009 2:46 PM

All replies

  • If your service's credential has SeCreateGlobalPrivilege right, you can pass a DACL that allows the desktop user to access when you create a global file mapping 

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Thursday, November 5, 2009 2:36 PM
  • Could you kindly provide an example on how to set the SeCreateGlobalPrivilege and how to configure the DACL. I would appreciate your help.
    Friday, November 6, 2009 4:32 AM
  • http://support.microsoft.com/kb/821546

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Friday, November 6, 2009 1:01 PM
  • Hi,

    I have already answer your other post concerning the same subject. Here is a copy of it :

    Hi,
    Are you creating your shared memory in the global namespace or in a session namespace? Your problems come certainly from the fact that, starting from Windows Server 2008 and Vista, Windows services run on Session 0 while user desktop and programs run on Session 1, Session 2, ... Thus, if you don't use the "Global\" prefix, the shared memory created by the services will only be accessible from Session 0, not from Session 1.

    The solution to your problem is this case is to add the prefix "Global\" to the name of the mapping object.

    Cheers,
    --
    Mounir IDRASSI
    IDRIX
    http://www.idrix.fr
    • Marked as answer by Mubashir Khan Tuesday, November 10, 2009 5:13 AM
    Sunday, November 8, 2009 2:46 PM