共用方式為


2.3.46 FSCTL_PIPE_PEEK Reply

The FSCTL_PIPE_PEEK response returns data from the pipe server's output buffer in the FSCTL output buffer. The structure of that data is as follows.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

NamedPipeState

ReadDataAvailable

NumberOfMessages

MessageLength

Data (variable)

...

NamedPipeState (4 bytes): A 32-bit unsigned integer referring to the current state of the pipe. The allowed values are shown in the following table.

Pipe State

Meaning

FILE_PIPE_CONNECTED_STATE

0x00000003

The specified named pipe is in the connected state.

FILE_PIPE_CLOSING_STATE

0x00000004

The server end of the specified named pipe has been closed, but data is still available for the client to read.

ReadDataAvailable (4 bytes): A 32-bit unsigned integer that specifies the size, in bytes, of the data available to read from the pipe.

NumberOfMessages (4 bytes): A 32-bit unsigned integer that specifies the number of messages available in the pipe if the pipe has been created as a message-type pipe. Otherwise, this field is 0.

MessageLength (4 bytes): A 32-bit unsigned integer that specifies the length of the first message available in the pipe if the pipe has been created as a message-type pipe. Otherwise, this field is 0.

Data (variable): A byte buffer of data from the pipe.

This message returns a status code as specified in section 2.2. Upon success, the status code returned by the function that processes this FSCTL is STATUS_SUCCESS. The most common error codes are listed in the following table.

Error code

Meaning

STATUS_PIPE_DISCONNECTED

0xC00000B0

The specified named pipe is in the disconnected state.

STATUS_INVALID_PIPE_STATE

0xC00000AD

The data cannot be read in the current state of the specified pipe.

STATUS_PIPE_BROKEN

0xC000014B

The pipe operation has failed because the other end of the pipe has been closed.

STATUS_INVALID_USER_BUFFER

0xC00000E8

An exception was raised while accessing a user buffer.

STATUS_INSUFFICIENT_RESOURCES

0xC000009A

There were insufficient resources to complete the operation.

STATUS_INVALID_DEVICE_REQUEST

0xC0000010

The type of the handle is not a pipe.

STATUS_BUFFER_OVERFLOW

0x80000005

The data was too large for the specified buffer. This is a warning, not an error. Response contains information including available data length and data that fits into the buffer.

For more information on named pipes, see [PIPE].