Share via


IOCTL_DISK_SCAN_VOLUME (Compact 2013)

3/26/2014

This I/O control message scans a disk volume for errors. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,           // handle to the device
    DWORD dwIoControlCode,    // use IOCTL_DISK_SCAN_VOLUME
    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_SCAN_VOLUME for this operation.
  • lpInBuffer
    [in] Set to NULL.
  • nInBufferSize
    [in] Set to zero
  • lpOutBuffer
    [out] Set to NULL.
  • nOutBufferSize
    [out] Set to zero
  • lpBytesReturned
    [out] DWORD pointer to receive the size of data returned in nOutBufferSize.
  • lpOverlapped
    [in] Ignored, set to NULL.

Return Values

Returns TRUE if successful, else FALSE.

Remarks

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

Remarks

To scan a volume

  1. Open a handle to the volume.

    The name of the volume to open has the format \FolderName\Vol:, where FolderName is the FAT file system name for the root directory of the mounted volume.

  2. Call DeviceIoControl with the volume handle and this I/O control.

    This following code example shows this procedure.

    hVolume = CreateFile(TEXT("\Storage Card\Vol:"), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
    DeviceIoControl(hVolume, IOCTL_DISK_SCAN_VOLUME, NULL, 0, NULL, 0, lpBytesReturned, NULL);
    

Requirements

Header

diskio.h

See Also

Reference

FAT File System I/O Controls

Other Resources

DeviceIoControl