Information Technology Reference
In-Depth Information
// Get the LBA of the cluster's first sector.
sector = Cluster2Sector (dsk, ccls);
// If it's the root directory (cluster 0), be sure that curEntry's sector isn't
// at or beyond the start of the volume's data area.
// (curEntry's sector = the cluster's initial sector (sector) +
// the number of the sector in the cluster containing curEntry (offset2))
if (ccls == 0 && (sector + offset2) >= dsk->data)
{
dir = ((DIRENTRY)NULL);
}
else
{
// The sector is in a valid location
// (either the root-directory area or the volume's data area).
// Read the data in the sector containing curEntry.
// sector = the cluster's first sector.
// offset2 = the number of the sector within the cluster.
if ( SectorRead( sector + offset2, dsk->buffer) != sdcValid)
dir = ((DIRENTRY)NULL);
else
{
// The sector read was successful.
// Get the requested entry.
if (ForceRead)
// The directory entry is in the DISK structure's buffer member.
// ((*curEntry) % DIRENTRIES_PER_SECTOR) =
// the number of the entry within the sector.
dir = (DIRENTRY)((DIRENTRY)dsk -> buffer)
+ ((*curEntry) % DIRENTRIES_PER_SECTOR);
Search WWH ::




Custom Search