![]() |
| Home |
|
|
Function RTFFormatFunction RTFFormat formats a logical drive with a FAT-12. FAT-16, or FAT-32 file system:
int RTFFormat(const char * DriveName,
UINT MinSectorsPerCluster,
RTFFormatCallback Progress,
DWORD Flags);
ParametersDriveNameMust be a logical drive file name in the form "\\.\X:", where "X" is replaced with the drive letter of the logical drive to be formatted. MinSectorsPerClusterSpecifies the minimum number of sectors per cluster RTFFormat should set up. This parameter should be 0 to use a default cluster size, 1 to always use the smallest possible cluster size, or any other power of two. Cluster sizes up to 64 sectors are compatible with other operating systems, 128 is compatible with Windows NT/2000/XP/Vista/7. RTFiles-32 supports cluster sizes up to 32768 sectors (extended cluster sizes), but such volumes cannot be mounted by any other OS. If the specified cluster size is too small, RTFiles-32 will automatically adjust it. This may become necessary on FAT-12 or FAT-16 drives to avoid exceeding the maximum supported number of clusters. For most applications, the default cluster size is recommended (set MinSectorsPerCluster to 0). ProgressA callback to supply progress information:
typedef void (__cdecl * RTFFormatCallback)(const char * DeviceName,
int Action,
DWORD Total,
DWORD Completed);
It will be called periodically by RTFFormat. Parameter Action can have one of the following values:
Total indicates how many sectors must be processed. Completed indicates how many sectors have been processed successfully. The Progress parameter for RTFFormat is optional and may be set to NULL. FlagsControls various options about how to format the drive. It can have any combination of the following flags:
If none of the RTF_FMT_FAT_... flags is specified, RTFFormat will select a FAT type automatically. Drives with less than 16M size will be formatted as FAT-12 and drives with less than 512M will be formatted as FAT-16. Larger drives are formatted as FAT-32. return valueIf the function succeeds, the return value is the FAT type set up (RTF_FAT12, RTF_FAT16, or RTF_FAT32). If it fails, the return value is a negative error code. Demo programs RTFCmd and PartDemo use this function. Please note that some combinations of MinSectorsPerCluster and Flags can prevent RTFFormat from setting up a valid file system. For example, a FAT-16 drive must have at least 4085 clusters. However, if a drive has only 10000 sectors, MinSectorsPerCluster is set to 4, and flag RTF_FMT_FAT_16 is specified, RTFFormat will return error RTF_INVALID_FILE_SYSTEM. RTFFormat does not perform a surface scan on the volume. Only if writing to any system portion of the drive fails, the function returns the respective error code.
|