XXX_IOControl

This function sends a command to a device.

Syntax

BOOL XXX_IOControl(
DWORD hOpenContext DWORD dwCode PBYTE pBufIn DWORD dwLenIn PBYTE pBufOut DWORD dwLenOut PDWORD pdwActualOut );

Parameters

hOpenContext
Handle to the open context of the device. The XXX_Open function creates and returns this identifier.
dwCode
Specifies a value indicating the I/O control operation to perform. These codes are device-specific and are usually exposed to programmers by means of a header file.
pBufIn
Pointer to the buffer containing data to be transferred to the device.
dwLenIn
Specifies the number of bytes of data in the buffer specified for pBufIn.
pBufOut
Pointer to the buffer used to transfer the output data from the device.
dwLenOut
Specifies the maximum number of bytes in the buffer specified by pBufOut.
pdwActualOut
Pointer to the DWORD buffer that this function uses to return the actual number of bytes received from the device.

Return Values

TRUE indicates success. FALSE indicates failure.

Remarks

An application uses the DeviceIOControl function to specify an operation to be performed. The operating system, in turn, invokes this function. The dwCode parameter contains the input or output operation to be performed. I/O control codes usually are specific to each device driver and typically are exposed to programmers by means of a header file.

If the Ioctl registry key is defined for your device driver, the Device Manager calls this function directly after it calls the XXX_Init function. It uses the value stored in the registry for the dwCode parameter and NULL for the pBufIn and pBufOut parameters. Your device might use this option to load other modules that require the installation of the basic device driver.