Creates an instance of a named pipe and returns a handle for subsequent pipe operations.
HANDLE CreateNamedPipe( LPCTSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, PSECURITY_ATTRIBUTES lpSecurityAttributes )
- [input]The unique pipe name. This string must have the following form:
- [input]The open mode. The function fails if dwOpenMode specifies anything other than 0 or the flags listed in the following tables.
- PIPE_ACCESS_INBOUND, PIPE_ACCESS_OUTBOUND, PIPE_ACCESS_DUPLEX
- [input]The pipe mode. The function fails if dwPipeMode specifies anything other than 0 or the flags listed in the following tables.
- One of the following type modes can be specified. The same type mode must be specified for each instance of the pipe.
- PIPE_TYPE_BYTE Data is written to the pipe as a stream of bytes. This mode cannot be used with PIPE_READMODE_MESSAGE.
- PIPE_TYPE_MESSAGE Data is written to the pipe as a stream of messages. This mode can be used with either PIPE_READMODE_MESSAGE or PIPE_READMODE_BYTE.
- One of the following read modes can be specified. Different instances of the same pipe can specify different read modes.
- PIPE_READMODE_BYTE Data is read from the pipe as a stream of bytes. This mode can be used with either PIPE_TYPE_MESSAGE or PIPE_TYPE_BYTE.
- PIPE_READMODE_MESSAGE Data is read from the pipe as a stream of messages. This mode can be only used if PIPE_TYPE_MESSAGE is also specified.
- One of the following wait modes can be specified. Different instances of the same pipe can specify different wait modes.
- PIPE_WAIT Blocking mode is enabled
- PIPE_NOWAIT Nonblocking mode is enabled. In this mode, ReadFile, WriteFile, and ConnectNamedPipe always return immediately.
- [input] The maximum number of instances that can be created for this pipe.
- [input] The number of bytes to reserve for the output buffer
- [input] The number of bytes to reserve for the input buffer.
- [input] The default time-out value, in milliseconds
- [input] A pointer to a SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new named pipe and determines whether child processes can inherit the returned handle.
If the function succeeds, the return value is a handle to the server end of a named pipe instance.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
To create an instance of a named pipe by using CreateNamedPipe, the user must have FILE_CREATE_PIPE_INSTANCE access to the named pipe object. If a new named pipe is being created, the access control list (ACL) from the security attributes parameter defines the discretionary access control for the named pipe.
All instances of a named pipe must specify the same pipe type (byte-type or message-type), pipe access (duplex, inbound, or outbound), instance count, and time-out value. If different values are used, this function fails and GetLastError returns ERROR_ACCESS_DENIED.
header to Include