CNdisApi::DeviceIoControl

Since 3.6.1

Available since: Windows Packet Filter 3.6.2

The CNdisApi::DeviceIoControl method provides direct access to send control codes (IOCTLs) and associated input/output buffers directly to the underlying ndisrd.sys filter driver device handle.

Syntax

BOOL CNdisApi::DeviceIoControl(
    DWORD        dwService,
    void*        BuffIn,
    int          SizeIn,
    void*        BuffOut,
    int          SizeOut,
    LPDWORD      SizeRet = NULL,
    LPOVERLAPPED povlp   = NULL
) const;

Parameters

dwService
The driver IOCTL control code (defined in Common.h).

BuffIn
Pointer to the input data buffer.

SizeIn
Size in bytes of the input data buffer.

BuffOut
Pointer to the output data buffer.

SizeOut
Size in bytes of the output data buffer.

SizeRet
[optional] Pointer to a variable receiving the number of output bytes. If NULL, the method uses the instance byte-count storage. For a pending request, the count is meaningful after completion.

povlp
[optional] Pointer to an OVERLAPPED structure. If NULL, the method passes the instance’s internal OVERLAPPED structure. It does not wait for completion.

Return Value

Returns the result of the underlying Win32 DeviceIoControl call. TRUE indicates completion; FALSE can indicate failure or pending I/O. For an issued OS request, call GetLastError() immediately: ERROR_IO_PENDING means the request is pending. The method also returns FALSE without issuing a request if the instance driver handle is invalid.

Remarks

In version 3.6.2, DeviceIoControl was promoted from private to public in ndisapi.h. This allows advanced systems developers to execute custom driver operations or new driver IOCTLs directly without bypassing the class instance or duplicating driver handle management.