Share via


DefragVolumeEx

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This function defragments files on a volume and removes any free space.

Syntax

DWORD DefragVolumeEx(
  HANDLE hVolume,
  PDEFRAG_PARAMS pdp
);

Parameters

  • hVolume
    [in] Handle to a disk or partition. Call the CreateFile function to obtain a handle to the volume.
  • pdp
    [in, out] Pointer to a DEFRAG_PARAMS structure used to pass in parameters and receive results of the scan.

Return Value

ERROR_SUCCESS indicates success. Other error codes indicate the reason for 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 defragdisk.h
Library Fatutil.dll
Windows Embedded CE Windows CE .NET 4.2 and later

See Also

Reference

FAT Utility Library Functions
CreateFile
DEFRAG_PARAMS

Other Resources

DeviceIoControl