Platform SDK: Win32 API

SetDPB_SetAllocInfo (FAT32)

Sets the dpb_free_cnt and dpb_next_free fields in the DPB.

This sub-function is called when the SetDPB_Function member of the SDPDFormatStruc structure is set to 0.

Return Values

Clears the carry flag and sets the dpb_free_cnt and dpb_next_free fields in the DPB based upon the values in the SetDPB_Value1 and SetDPB_Value2 fields within the Set_DPB_ForFormat structure.

Remarks

The value in the SetDPB_Value1 member of the Set_DPB_ForFormat structure determines the following results.

SetDPB_Value1 setting Result within DPB
0 Does not change the dpb_free_cnt member.
0xFFFFFFFF Sets dpb_free_cnt to unknown.
(any other value) Sets dpb_free_cnt to the specified value if it is a valid cluster count for the drive,.

The free cluster count cannot be explicitly set to zero by this call. This can only be done by setting SetDPB_Value1 to 0xFFFFFFFF, which forces the free space to be re-computed. Also, setting this value improperly causes the free count value to be reported improperly by the GetDiskFreeSpace function. The settings of 0 or 0xFFFFFFFF are recommended.

SetDPB_Value2 setting Result within DPB
0 Does not change the dpb_next_free member.
0xFFFFFFFF Sets dpb_next_free to force the cluster search to begin at the beginning of the FAT.
(any other value) Sets dpb_next_free to the given value if it is a valid cluster number for the drive. This causes the search for free clusters to begin at the specified cluster.

The assembler calling sequence for all Int 21h 7304h sub-functions is almost identical. See the main listing for a sample. (Int 21h Function 7304h Set_DPBForFormat)