Share via


IOCTL_DISK_WRITE (Compact 2013)

3/26/2014

This I/O control message services FAT file system requests to write data to the block device. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to device
    DWORD dwIoControlCode,    // use IOCTL_DISK_WRITE
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned,  // number of bytes returned
    OVERLAPPED lpOverlapped   // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device.
  • dwIoControlCode
    [in] The control code for the operation. Use IOCTL_DISK_WRITE for this operation.
  • lpInBuffer
    [in] Pointer to an SG_REQ structure.
  • nInBufferSize
    [in] Set tosizeof(SG_REQ).
  • lpOutBuffer
    Not used.
  • nOutBufferSize
    Not used.
  • lpBytesReturned
    Pointer to a DWORD that receives the total number of bytes returned.
  • lpOverlapped
    [in] Set to NULL.

Return Values

When this code returns, the FAT file system expects the sr_status member of SG_REQ to be ERROR_SUCCESS if the write succeeded, or a standard error return value. Certain errors retry automatically. ERROR_BAD_UNIT retries automatically if you remove the device, and ERROR_NOT_READY retries automatically if the driver is in the process of shutting down or starting up. The block device driver should return ERROR_GEN_FAILURE for any unknown or unexpected errors, and should return ERROR_WRITE_PROTECT for attempts to write to write-protected media.

Remarks

This I/O control call into the block driver is relative to the object store; the object store is the media that the block driver exposes. This also implies that this I/O control call is relative to the MBR, but block drivers should not make assumptions on the existence of an MBR.

Requirements

Header

diskio.h

See Also

Reference

Block Driver IOCTLs
DeviceIoControl
SG_REQ