Solved

cross users named pipes

Posted on 1998-11-26
4
303 Views
Last Modified: 2013-12-03
I tried running a simple-client server
program using named pipes, when different users are
running the client and the server.
I got ACCESS_DENIED error when the client used CreateFile
to connect to the pipe.
Should the server change the sercurity attributes of the
named pipe ?
I created the pipe with default security attributes.

Could you tell me exactly how to allow a client to
connect to a named pipe (a short working piece of code
will be welcomed).

thanks in advance,
Avi.
0
Comment
Question by:kavas
  • 2
4 Comments
 
LVL 2

Expert Comment

by:lortega
ID: 1416379
both users must have running windows NT, windows 95 just can't create a server side of a named pipe...
0
 

Author Comment

by:kavas
ID: 1416380
Both of my client and server are running windows NT.

0
 

Author Comment

by:kavas
ID: 1416381
Adjusted points to 150
0
 
LVL 3

Accepted Solution

by:
stefanr earned 150 total points
ID: 1416382
Create a NULL DACL, that will allow all access to the named pipe:

PSECURITY_DESCRIPTOR pSecurityDescriptor = PSECURITY_DESCRIPTOR(new BYTE[SECURITY_DESCRIPTOR_MIN_LENGTH]);

::InitializeSecurityDescriptor(pSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
::SetSecurityDescriptorDacl(pSecurityDescriptor, TRUE, NULL, FALSE);

SECURITY_ATTRIBUTES SecurityAttributes = { 0 };

SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
SecurityAttributes.lpSecurityDescriptor = pSecurityDescriptor;
SecurityAttributes.bInheritHandle = FALSE;

HANDLE hFile =
      ::CreateFile(
         sPipeName,                 // LPCTSTR lpFileName: pointer to name of the file
         dwDesiredAccess,           // DWORD dwDesiredAccess: access (read-write) mode
         dwShareMode,               // DWORD dwShareMode: share mode
         &SecurityAttributes, // LPSECURITY_ATTRIBUTES lpSecurityAttributes: pointer to security attributes
         dwCreationDisposition,     // DWORD dwCreationDisposition: how to create
         dwFlagsAndAttributes,      // DWORD dwFlagsAndAttributes: file attributes
         NULL                       // HANDLE hTemplateFile: handle to file with attributes to copy
      );

delete pSecurityDescriptor;

if (INVALID_HANDLE_VALUE == hFile)
   return FALSE;

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question