FormatVolume (Compact 2013)

3/26/2014

This function formats a volume.

Syntax

DWORD FormatVolume(
  HANDLE hVolume,
  PDISK_INFO pdi,
  PFORMAT_OPTIONS pfo,
  PFN_PROGRESS pfnProgress,
  PFN_PROGRESS pfnMessage
);

Parameters

  • hVolume
    [in] Handle to disk or partition. Call the CreateFile function to obtain a handle to the volume.
  • pdi
    [in] Not used.
  • pfo
    [in] Pointer to a FORMAT_OPTIONS structure. The following tables shows possible values.

    Member

    Description

    dwClusSize

    Desired cluster size in bytes, which must be a power of 2.

    dwFatVersion

    FAT Version, either 12, 16, or 32.

    dwNumFats

    Number of FATs to create.

    dwRootEntries

    Desired number of root directory entries.

    fFullFormat

    Set to TRUE to request a full format.

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

Return Value

ERROR_SUCCESS indicates success. ERROR_GEN_FAILURE indicates failure.

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

formatdisk.h

Library

Fatutil.dll

See Also

Reference

FAT Utility Library Functions
CreateFile
FORMAT_OPTIONS

Other Resources

DeviceIoControl
DISK_INFO