DeviceIoControl

DeviceIoControl sends a control code directly to a specified device driver, causing the corresponding device to perform the specified operation.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,
    DWORD IoControlCode,
    LPVOID lpInBuffer,
    DWORD nInBufferSize,
    LPVOID lpOutBuffer,
    DWORD nOutBufferSize,
    LPDWORD lpBytesReturned,
    LPOVERLAPPED lpOverlapped
);

Parameters

hDevice

A handle to the device that is to perform the operation. Call CreateFile to obtain a device handle.

IoControlCode

The control code for the operation. This value identifies the specific operation to be performed and the type of device on which the operation is to be performed. The following values are defined:

For more detailed information on each control code, see its topic in the Microsoft documentation. In particular, each topic provides details on the usage of the lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, and lpBytesReturned parameters.

lpInBuffer

A pointer to a buffer that contains the data required to perform the operation.

This parameter can be NULL if the IoControlCode parameter specifies an operation that does not require input data.

nInBufferSize

The size, in bytes, of the buffer pointed to by lpInBuffer.

lpOutBuffer

A pointer to a buffer that receives the operation's output data.

This parameter can be NULL if the IoControlCode parameter specifies an operation that does not produce output data.

nOutBufferSize

The size, in bytes, of the buffer pointed to by lpOutBuffer.

lpBytesReturned

A pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.

lpOverlapped

Ignored. This parameter should be set to NULL.

Return Values

TRUE if the function succeeds, FALSE if the function fails

To get extended error information, call GetLastError.

Requirements

Library Rtx_Rtss.lib

See Also:

CreateFile

IntervalZero.com | Support | Give Feedback