Share via


PD_DeviceIoControl (Windows CE 5.0)

Send Feedback

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

DWORD PD_DeviceIoControl(DWORD dwPartitionId, DWORD dwCode, PBYTE pInBuf, DWORD nInBufSize, PBYTE pOutBuf, DWORD nOutBufSize, PDWORD pBytesReturned);

Parameters

  • dwPartitionId
    [in] Handle to the device that is to perform the operation. Call the CreateFile function to obtain a device handle.

  • dwCode
    [in] Specifies 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 writer of a custom device driver can define IOCTLs with the CTL_CODE macro. These control codes can then be advertised, and an application can use these control codes with DeviceIoControl to perform the driver-specific functions.

  • pInBuf
    [in] Long pointer to a buffer that contains the data required to perform the operation.

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

  • nInBufSize
    [in] Size, in bytes, of the buffer pointed to by lpInBuffer.

  • pOutBuf
    [out] Long pointer to a buffer that receives the operation's output data.

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

  • nOutBufSize
    [in] Size, in bytes, of the buffer pointed to by lpOutBuffer.

  • pBytesReturned
    [out] Long pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.

    The lpBytesReturned parameter cannot be NULL. Even when an operation produces no output data, and lpOutBuffer can be NULL, the DeviceIoControl function makes use of the variable pointed to by lpBytesReturned. After such an operation, the value of the variable is without meaning.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

When passed parameters such as DISK_IOCTL_GETINFO, the DeviceIoControl function does not change the dwBytesReturned parameter. This is because the IOCTL_GETINFO command interface returns the information to the input buffer specified with the lpOutBuffer parameter. DeviceIoControl sets dwBytesReturned only when the control code writes into the output buffer. Many other DISK_IOCTL_GET* command codes return this information in the input buffer, as well.

Microsoft® Windows® CE will add zeros to a file name that contains less than 4 hex digits. For example, Windows CE would rename the Microsoft Windows NT® file foo34.tmp as foo0034.tmp.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Partdrv.h.

See Also

CreateFile | DeviceIoControl

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.