CallNamedPipeA function (winbase.h)
Connects to a message-type pipe (and waits if an instance of the pipe is not available), writes to and reads from the pipe, and then closes the pipe.
BOOL CallNamedPipeA( [in] LPCSTR lpNamedPipeName, [in] LPVOID lpInBuffer, [in] DWORD nInBufferSize, [out] LPVOID lpOutBuffer, [in] DWORD nOutBufferSize, [out] LPDWORD lpBytesRead, [in] DWORD nTimeOut );
The pipe name.
The data to be written to the pipe.
The size of the write buffer, in bytes.
A pointer to the buffer that receives the data read from the pipe.
The size of the read buffer, in bytes.
A pointer to a variable that receives the number of bytes read from the pipe.
The number of milliseconds to wait for the named pipe to be available. In addition to numeric values, the following special values can be specified.
||Does not wait for the named pipe. If the named pipe is not available, the function returns an error.|
||Uses the default time-out specified in a call to the CreateNamedPipe function.|
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the message written to the pipe by the server process is longer than nOutBufferSize, CallNamedPipe returns FALSE, and GetLastError returns ERROR_MORE_DATA. The remainder of the message is discarded, because CallNamedPipe closes the handle to the pipe before returning.
Calling CallNamedPipe is equivalent to calling the CreateFile (or WaitNamedPipe, if CreateFile cannot open the pipe immediately), TransactNamedPipe, and CloseHandle functions. CreateFile is called with an access flag of GENERIC_READ | GENERIC_WRITE, and an inherit handle flag of FALSE.
CallNamedPipe fails if the pipe is a byte-type pipe.
Windows 10, version 1709: Pipes are only supported within an app-container; ie, from one UWP process to another UWP process that's part of the same app. Also, named pipes must use the syntax
\\.\pipe\LOCAL\ for the pipe name.
For an example, see Transactions on Named Pipes.
|Minimum supported client||Windows 2000 Professional [desktop apps | UWP apps]|
|Minimum supported server||Windows 2000 Server [desktop apps | UWP apps]|
|Header||winbase.h (include Windows.h)|