Platform SDK: Win32 API

SetDPB_GetSetActFATandMirr (FAT32)

Allows the active FAT and FAT mirror properties of a FAT32 drive to be read and changed. This call is invalid on FAT12 and FAT16 drives.

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

Parameters

SetDPB_Value1
The SetDPB_Value1 member in the SPDPFormatStruc structure determines the SET behavior. If the SetDPB_Value1 member is set to 0xFFFFFFFF, then no changes are made and the ActiveFat and FAT mirror property are returned to SetDPB_Value2.

The low four bits of this value are the zero-based ActiveFAT number. If the ActiveFAT number is greater than or equal to the number of FATs on the drive, the call will fail.

Bit 0x00000080 is the "Disable FAT Mirror" bit. If any bits other than 0x80 and the low four bits are set, the call will fail.

If the FAT Mirror is enabled (bit 0x80 clear) and the ActiveFAT value specified in SetDPB_Value1 is not zero, the call will fail.

SetDPB_Value2
Used as a return value for the previous ActiveFAT and FAT mirror properties. Bits 0 through 3 indicate the active FAT number, bit 7 indicates the mirror state, and all other bits are reserved. If SetDPB_Value1 is 0xFFFFFFFF, the previous state is also the current state.
Bit 7 Description
Set Enable FAT Mirroring
Clear Disable FAT Mirroring

Return Values

If the function is unsuccessful, the function sets the carry flag and returns ERROR_GEN_FAILURE (error code 31) to AX. Receiving ERROR_GEN_FAILURE as the return value indicates that a disk error occurred during the attempt to write. In this case, the DPB mirror property is changed, but not properly written to disk. If the function fails, it is recommended that the caller re-write the value returned to SetDBP_Value2 to attempt to undo the change.

Remarks

The BPB(s) and boot sector(s) of the drive are also written. This is because the ActiveFAT and FAT mirror properties are also stored in the BPB.

If the FAT Mirror is being enabled (that is, bit 0x80 is set in the current state, and bit 0x80 is clear in SetDPB_Value1.) this call will copy the active FAT sectors to all of the other FATs. This process can be very slow.

Note that the device driver may also contain these values as part of its current device parameters. This call will have no effect on the FAT Mirror properties held by the device driver. As a result, it is recommended to immediately follow the set form of the call with a SetDeviceParameters Generic IOCTL call to set the current BPB that the BuildBPB routine of the device returns.

Next Free DPB variable is reset to 2, and the Free Count DPB is reset to 0xFFFFFFFF.

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)