IRP类的几个重要方法

关于IoctlCode、IoctlBuffer、BufferedReadDest、BufferedWriteSource、IoctlInputBufferSize、IoctlOutputBufferSize
**********************************************
KIrp::IoctlCode
**********************************************
ULONG& IoctlCode( EStackLocation s );

Returns the IoControlCode for an IRP whose major function is IRP_MJ_DEVICECONTROL.

Parameters
 s
Either CURRENT or NEXT. The default value is CURRENT

Returns
Returns a reference to IO_STACK_LOCATION field Parameters.DeviceIoControl.IoControlCode in either the current or next IRP stack location, depending on parameter s.

Comments
The IoControlCode specifies a particular device control operation.

**********************************************
KIrp::IoctlBuffer
**********************************************
PVOID& IoctlBuffer( void );

Accessor to the buffer for a buffered DeviceIoControl operation.

Returns
Returns a reference to field AssociatedIrp.SystemBuffer.

Comments
If the major function is IRP_MJ_DEVICE_CONTROL and the method specified by the IOCTL code is METHOD_BUFFERED, then this member returns the pointer to the buffer that contains the data to be written to the device, and/or receives data from the device.

The member returns a reference, which means it enables both read and write access to the field. Drivers far more frequently read this field, rather than write it.

The caller may be running at any IRQL.

**********************************************
KIrp::BufferedReadDest
**********************************************
PVOID& BufferedReadDest( void );

Accessor to the destination buffer for a buffered read operation.

Returns
Returns a reference to IRP field AssociatedIrp.SystemBuffer.

Comments
If the major function is IRP_MJ_READ and the targeted device does buffered I/O, then this member returns the pointer to the buffer that receives data from the device.

The member returns a reference, which means it enables both read and write access to the field. Drivers far more frequently read this field, rather than write it.

The caller may be running at any IRQL.


**********************************************
KIrp::BufferedWriteSource
**********************************************
PVOID& BufferedWriteSource( void );

Accessor to the source buffer for a buffered write operation.

Returns
Returns a reference to IRP field AssociatedIrp.SystemBuffer.

Comments
If the major function is IRP_MJ_WRITE and the targeted device does buffered I/O, then this member returns the pointer to the data to be written to the device.

The member returns a reference, which means it enables both read and write access to the field. Drivers far more frequently read this field, rather than write it.

The caller may be running at any IRQL.

**********************************************
KIrp::IoctlInputBufferSize
**********************************************
ULONG& IoctlInputBufferSize( EStackLocation s );

Returns the size of the input buffer for an IRP whose major function is IRP_MJ_DEVICECONTROL.

Parameters
 s
Either CURRENT or NEXT. The default value is CURRENT.

Returns
Returns a reference to IO_STACK_LOCATION field Parameters.DeviceIoControl.InputBufferLength in either the current or next IRP stack location, depending on parameter s.

Comments
The return value indicates the size of the data to be sent to the device. A driver sets the Information field to the number of bytes actually written.


**********************************************
KIrp::IoctlOutputBufferSize
**********************************************
ULONG& IoctlOutputBufferSize( EStackLocation s );

Returns the size of the output buffer for an IRP whose major function is IRP_MJ_DEVICECONTROL.

Parameters
 s
Either CURRENT or NEXT. The default value is CURRENT.

Returns
Returns a reference to IO_STACK_LOCATION field Parameters.DeviceIoControl.OutputBufferLength in either the current or next IRP stack location, depending on parameter s.

Comments
The return value indicates the size of the buffer to receive data from the device. A driver sets the Information field to the number of bytes actually read.

你可能感兴趣的:(IRP类的几个重要方法)