开发者

Getting Access Denied While Accessing the Named Pipe from Another System

I have a Named Pipe and It Works Fine While I access开发者_开发问答 it using a Client which runs on My System

The Client tries to open the File using following code:

LPTSTR lpszPipename = TEXT("\\\\smyServerName\\pipe\\iPipe01"); 

      hPipe = CreateFile( 
         lpszPipename,   // pipe name 
         GENERIC_READ |  // read and write access 
         GENERIC_WRITE, 
         0,              // no sharing 
         NULL,           // default security attributes
         OPEN_EXISTING,  // opens existing pipe 
         0,              // default attributes 
         NULL);     


      if (hPipe != INVALID_HANDLE_VALUE) 
         break; 

      // Exit if an error other than ERROR_PIPE_BUSY occurs. 

      if (GetLastError() != ERROR_PIPE_BUSY) 
      {
         _tprintf( TEXT("Could not open pipe. GLE=%d\n"), GetLastError() ); 
         return -1;
      }

While Creating the Named Pipe I have used

lpszPipename = TEXT("\\\\.\\pipe\\iPipe01"); 

Instead of myServerName I have used .(Dot). I get GLE 5 (Access denied) while I run the client from another system.


First things first - check your permissions and firewall. Almost always, when something works locally but not on the network, it's permissions.

(Had this problem more times than I can count!)


AFAIR there was a change of security of anonymous access to named pipes in Windows Vista.
When you want to open it (with write access) from the anonymous account, you may have to change the pipe's security attributes as described here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜