次の方法で共有


IOCTL_DISK_FORMAT_MEDIA (Compact 2013)

3/26/2014

This I/O control message is issued by the FAT file system when a device driver reports that the disk needs a low-level format. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to device
    DWORD dwIoControlCode,    // use IOCTL_DISK_FORMAT_MEDIA
    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_ FORMAT_MEDIA for this operation.
  • lpInBuffer
    Set to NULL.
  • nInBufferSize
    Set to zero.
  • lpOutBuffer
    Not used.
  • nOutBufferSize
    Not used.
  • lpBytesReturned
    [out] Pointer to a DWORD to receive the total number of bytes returned.
  • 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

A low-level format prepares the medium. For flash devices that contain low-level data structures, the low-level format initializes the flash devices. This format is independent of the file system that resides above the device. The file system format is specific to the file system that is connected, for example, FAT file system or NTFS file system. Block device drivers indicate the format status by setting the di_flags member of the DISK_INFO structure to the DISK_INFO_FLAG_UNFORMATTED flag. The FAT file system will then query the user to determine whether the device should format before issuing the IOCTL_DISK_FORMAT_MEDIA I/O control.

Requirements

Header

diskio.h

See Also

Reference

Block Driver IOCTLs
DeviceIoControl
DISK_INFO