str/buffer = DeviceIoControl(Device, IoControlCode , InBuffer , OutBuffer , Overlapped )

Sends a control code to a device or file system driver


Device : PyHANDLE

Handle to a file, device, or volume

IoControlCode : int

IOControl Code to use, from winioctlcon

InBuffer : str/buffer

The input data for the operation, can be None for some operations.

OutBuffer : int/buffer

Size of the buffer to allocate for output, or a writeable buffer as returned by win32file::AllocateReadBuffer.

Overlapped=None : PyOVERLAPPED

An overlapped object for async operations. Device handle must have been opened with FILE_FLAG_OVERLAPPED.


Accepts keyword args

Return Value

If a preallocated output buffer is passed in, the returned object may be the original buffer, or a view of the buffer with only the actual size of the retrieved data.
If OutBuffer is a buffer size and the operation is synchronous (ie no Overlapped is passed in), returns a plain string containing the retrieved data. For an async operation, a new writeable buffer is returned.