ScanVolume (Compact 2013)

3/26/2014

This function scans a volume for errors in the file allocation table (FAT) and directories, and for lost clusters.

Syntax

BOOL ScanVolume(
  HANDLE hVolume,
  PDISK_INFO pdi,
  PSCAN_OPTIONS pso,
  PFN_PROGRESS pfnProgress,
  PFN_MESSAGE pfnMessage
);

Parameters

  • hVolume
    [in] Handle to disk or partition. Call the CreateFile function to obtain a handle to the volume.
  • pdi
    [in] Pointer to a DISK_INFO structure. Can be obtained through a DeviceIoControl call to the appropriate drive with the condition code DISK_IOCTL_GETINFO.
  • pso
    [in] Pointer to a SCAN_OPTIONS structure. The following table shows possible values.

    Member

    Description

    dwFatToUse

    Indicates which FAT to use for scanning (one-based indexing).

    fVerifyFix

    Set to TRUE to prompt the user to perform a fix.

  • pfnProgress
    [in] Callback function indicating progress.
  • pfnMessage
    [in] Callback function used to display a message to user.

Return Value

TRUE indicates success. FALSE indicates failure. Typical reasons for failure would be running out of memory or an error writing to disk. This function does not fail if errors are detected on the disk.

Remarks

For best results, use the correct type of handle. For example, if the store to be scanned is partitioned, use a handle to the partition. If the store is not partitioned, use a disk handle.

Requirements

Header

scandisk.h

Library

Fatutil.dll

See Also

Reference

FAT Utility Library Functions
CreateFile
SCAN_OPTIONS

Other Resources

DeviceIoControl
DISK_INFO