Note: When writing message pipes the application is limited to 64K messages. As well, these messages cannot span 64k boundaries due to the current design of the thunk layer in read or write routines. If the message is not written in an aligned manner, the subsequent read will not be able to handle the messages properly. If a 64k or less message is written to a pipe from an aligned buffer, the read will handle this properly.
The requested number of bytes might not be read. If the value returned in pcbActual is zero, the process tried to read from the end of the file.
A value of zero for cbRead is not considered an error. In such a case, the system treats the request as a null operation.
The file pointer is moved to the desired position by reading data, writing data, or issuing DosSetFilePtr.
If you issue DosOpen with the Direct Open flag set to 1 in the fsOpenFlags parameter, you have direct access to an entire disk or diskette volume, independent of the file system. You must lock the logical volume before accessing it, and you must unlock the logical volume when you are finished accessing it. Issue DosDevIOCtl for Category 8, DSK_LOCKDRIVE to lock the logical volume, and for Category 8, DSK_UNLOCKDRIVE to unlock the logical volume. While the logical volume is locked, no other process can access it.
Named Pipe Considerations
A named pipe is read as one of the following:
A byte pipe must be in byte-read mode to be read; an error is returned if it is in message-read mode. All currently available data, up to the size requested, is returned.
A message pipe can be read in either message-read mode or byte-read mode. When the message pipe is in message-read mode, a read operation that is larger than the next available message returns only that message. pcbActual is set to indicate the size of the message returned.
A read operation that is smaller than the next available message returns with the number of bytes requested and an ERROR_MORE_DATA return code. When the reading of a message is resumed after ERROR_MORE_DATA is returned, a read operation always blocks until the next piece (or the rest) of the message can be transferred. DosPeekNPipe can be issued to determine how many bytes are left in the message.
A message pipe in byte-read mode is read as if it were a byte stream, and DosRead skips over message headers. This is like reading a byte pipe in byte-read mode.
When blocking mode is set for a named pipe, a read operation blocks until data is available. In this case, the read operation never returns with pcbActual equal to zero, except when the pipe is closed. When the mode is set to message-read, messages are always read in their entirety, except when the message is bigger than the size of the read operation.
pcbActual can equal zero in nonblocking mode, but only when no data is available at the time of the read operation.
If you attempt a read of a named pipe when the other end of the pipe is closed while the read is pending, DosRead returns:
Unnamed Pipe Considerations
Threads writing to and reading from the same unnamed pipe are not synchronized. It is possible for the pipe reader to obtain partial contents of a write request if the pipe becomes full during the write request.