IOCTL_READ_REGISTERS IOCTL

Reads from USB device registers, using the control pipe.

Major Code

IRP_MJ_DEVICE_CONTROL

Input Buffer

Pointer to an IO_BLOCK structure.

Input Buffer Length

Size of the input buffer.

Output Buffer

Pointer to a buffer to receive register contents.

Output Buffer Length

Size of the output buffer. The value must match the contents of the uLength member of the IO_BLOCK structure.

Status Block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful. Otherwise, Status to the appropriate error condition as a NTSTATUS code.

Remarks

DeviceIoControl Parameters

When the DeviceloControl function is called with the IOCTL_READ_REGISTERS I/O control code, the caller must specify the address of an IO_BLOCK structure as the function's lpInBuffer parameter.

Using the IO_BLOCK contents, the kernel-mode driver creates a URB that contains a _URB_CONTROL_VENDOR_OR_CLASS_REQUEST structure.

The following table indicates the values assigned to _URB_CONTROL_VENDOR_OR_CLASS_REQUEST structure members.

Structure Member Value Assigned
TransferFlags 1
TransferBufferLength pIoBlock->uLength
TransferBuffer DeviceIoControl's lpOutBuffer argument.
TransferBufferMDL NULL
RequestTypeReservedBits 0xC0
Request (pIoBlock->uLength > 1) ? 0x04 : 0x0C
Value (SHORT)pIoBlock->uOffset
Index pIoBlock->uIndex

For more information, see Accessing Kernel-Mode Drivers for Still Image Devices.

Requirements

   
Header usbscan.h (include Usbscan.h)