DeviceIoControl (Windows CE 5.0)
This function sends an IOCTL directly to a specified device driver, causing the corresponding device to perform the specified operation.
BOOL DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped );
- [in] Handle to the device that is to perform the operation. To obtain a device handle, call the CreateFile function.
- [in] IOCTL for the operation. This value identifies the specific operation to perform and the type of device on which to perform the operation. There are no specific values defined for the dwIoControlCode parameter. However, you can define custom IOCTL_XXX IOCTLs with the CTL_CODE macro. You can then advertise these IOCTLs and an application can use these IOCTLs with DeviceIoControl to perform the driver-specific functions.
- [in] Long pointer to a buffer that contains the data required to perform the operation. Set to NULL if the dwIoControlCode parameter specifies an operation that does not require input data.
- [in] Size, in bytes, of the buffer pointed to by lpInBuffer.
- [out] Long pointer to a buffer that receives the output data for the operation. Set to NULL if the dwIoControlCode parameter specifies an operation that does not produce output data.
- [out] Size, in bytes, of the buffer pointed to by lpOutBuffer.
- [out] Long pointer to a variable that receives the size, in bytes, of the data stored in lpOutBuffer. The DeviceIoControl function may unnecessarily use this parameter. For example, if an operation does not produce data for lpOutBuffer and lpOutBuffer is NULL, the value of lpBytesReturned is meaningless.
- [in] Ignored; set to NULL.
Nonzero indicates success. Zero indicates failure. To obtain extended error information, call the GetLastError function.
For some IOCTLs, such as many of the IOCTL_DISK_* IOCTLs, the DeviceIoControl function does not change the lpBytesReturned parameter. These IOCTLs return any information to the input buffer specified by lpInBuffer. DeviceIoControl only sets lpBytesReturned when the IOCTL writes to lpOutBuffer.
OS Versions: Windows CE 1.0 and later.
Link Library: Coredll.lib.
Send Feedback on this topic to the authors