microsoft / go-winio

Win32 IO-related utilities for Go
MIT License
952 stars 182 forks source link

How to create pipe with PipeDirection as out. #180

Open mayguptMSFT opened 3 years ago

mayguptMSFT commented 3 years ago

I am trying to create a pipe client .My pipe server only allows me to connect when i connect with PipeDirection as out. like the powershell code $pipe = new-object System.IO.Pipes.NamedPipeClientStream(".","pipename",

$pipe.Connect() works

but the same thing when I try to do pipe.DialPipe(pipename, nil) it fails with access denied. in tryDialPipe we

h, err := createFile(*path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, 0, nil, syscall.OPEN_EXISTING, syscall.FILE_FLAG_OVERLAPPED|cSECURITY_SQOS_PRESENT|cSECURITY_ANONYMOUS, 0)

seems like pipe is always created with PipeDirection as InOut mode(syscall.GENERIC_READ|syscall.GENERIC_WRITE).