Search code examples
c#windowswinapinamed-pipes

How to add security attributes for non admin rights account in creatnamedpipe method of win API


I am creating a named pipe in windows service running on local system account with security attribute as Intptr.Zero in CreateNamedPipe() method of Windows API.

The problem is that this named pipe is not accessible to the user account running the client application and calling CreateFile() method.

Now I have searched the web and found out that we can change the security attributes but I am not able to do that.


Solution

  • Finally after hell lot of googling I found out the solution to my problem. I used two more win api methods to set access to user account. the methods are as follows

    1. SetSecurityDescriptorDacl()
    2. InitializeSecurityDescriptor()

    for detailed answer you can refer to what i refered... http://www.codeproject.com/KB/threads/CodeFX_IPC.aspx?display=Print

    Thanks for your answers....