IOCTL_DISK_FLUSH_CACHE (Compact 2013)

3/26/2014

This I/O control message is issued by the FAT file system when a storage device has an associated hardware cache, and the device driver reports that the cache needs to be flushed for transfers. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to device
    DWORD dwIoControlCode,    // use IOCTL_DISK_FLUSH_CACHE
    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. You can obtain this by opening the FAT volume by its file system entry.
  • dwIoControlCode
    [in] Control code for the operation. Use IOCTL_DISK_FLUSH_CACHE for this operation.
  • lpInBuffer
    Not used.
  • nInBufferSize
    Not used.
  • lpOutBuffer
    Not used.
  • nOutBufferSize
    Not used.
  • lpBytesReturned
    Not used.
  • lpOverlapped
    Not used.

Return Values

Returns TRUE if successful; otherwise, returns FALSE.

Remarks

To get extended error information, call GetLastError. GetLastError may return other standard error messages as appropriate.

Remarks

This IOCTL is used only to flush a hardware cache.

You do not need to store the manufacturer identifier string and disk serial number. For ATA disk devices, the manufacturer identifier string and disk serial number read directly from the storage card.

Requirements

Header

diskio.h

See Also

Reference

Block Driver IOCTLs
DeviceIoControl