Information Technology Reference
In-Depth Information
// (The first sector is sector 0.)
offset2 = offset2 % (dsk -> SecPerClus);
if (ForceRead || (*curEntry & 0xf) == 0)
{
// ForceRead is true OR the entry is the first one in a sector ((*curEntry & 0xf) == 0).
// If either Condition 1 or Condition 2 below is true,
// don't assume that ccls is the cluster to begin looking in for the entry to read.
// Instead, read the entry's cluster number from the FAT:
// Condition 1: ForceRead is true.
// Condition 2: the entry IS in a cluster's first sector (offset2 = 0)
// AND the entry ISN'T in the directory's first cluster (*curEntry > 16).
if ((offset2 == 0 && (*curEntry) > DIRENTRIES_PER_SECTOR) || ForceRead)
{
if (cluster == 0)
{
// It's the root directory. The current cluster = 0.
ccls = 0;
}
else
{
// It's not the root directory.
if (ForceRead)
// Get the number of curEntry's cluster within its directory:
// (curEntry / directory entries per cluster)
// directory entries per cluster =
// ((directory entries / sector) * (sectors / cluster))
numofclus =
((word)(*curEntry) /
(word)(((word)DIRENTRIES_PER_SECTOR)
* (word)dsk -> SecPerClus));
Search WWH ::




Custom Search