BOOL FindClusterInFAT(RDWRHandle handle, CLUSTER tofind, CLUSTER* result) { struct Pipe pipe, *ppipe=&pipe; CLUSTER cluster; pipe.tofind = tofind; pipe.sector = 0; pipe.found = FALSE; if (!LinearTraverseFat(handle, ClusterInFATFinder, (void**) &ppipe)) return FALSE; if (!pipe.found) { *result = 0; return TRUE; } if (!pipe.sector) /* This should never happen */ { *result = 0; return FALSE; } cluster = DataSectorToCluster(handle, pipe.sector); if (!cluster) return FALSE; *result = cluster; return TRUE; }
RETVAL MakeFatLabelsValid(RDWRHandle handle) { struct Pipe pipe, *ppipe = &pipe; pipe.invalidfound = FALSE; pipe.fixit = TRUE; if (!LinearTraverseFat(handle, ValidityChecker, (void**) &ppipe)) return ERROR; return SUCCESS; }
RETVAL CheckFatLabelValidity(RDWRHandle handle) { struct Pipe pipe, *ppipe = &pipe; pipe.invalidfound = FALSE; pipe.fixit = FALSE; if (!LinearTraverseFat(handle, ValidityChecker, (void**) &ppipe)) return ERROR; return (pipe.invalidfound) ? FAILED : SUCCESS; }