Freigeben über


DeviceIoControl (Windows CE 5.0)

Send Feedback

This function sends an IOCTL directly to a specified device driver, causing the corresponding device to perform the specified operation.

BOOL DeviceIoControl(HANDLEhDevice,DWORDdwIoControlCode,LPVOIDlpInBuffer,DWORDnInBufferSize,LPVOID lpOutBuffer,DWORDnOutBufferSize,LPDWORDlpBytesReturned,LPOVERLAPPEDlpOverlapped);

Parameters

  • hDevice
    [in] Handle to the device that is to perform the operation. To obtain a device handle, call the CreateFile function.
  • dwIoControlCode
    [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.
  • lpInBuffer
    [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.
  • nInBufferSize
    [in] Size, in bytes, of the buffer pointed to by lpInBuffer.
  • lpOutBuffer
    [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.
  • nOutBufferSize
    [out] Size, in bytes, of the buffer pointed to by lpOutBuffer.
  • lpBytesReturned
    [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.
  • lpOverlapped
    [in] Ignored; set to NULL.

Return Values

Nonzero indicates success. Zero indicates failure. To obtain extended error information, call the GetLastError function.

Remarks

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.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

CTL_CODE | CreateFile

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.