Information Technology Reference
In-Depth Information
typedef struct __DIRENTRY
{
char
DIR_Name[DIR_NAMESIZE];
// name
char
DIR_Extension[DIR_EXTENSION];
// extension
byte
DIR_Attr;
// attributes
byte
DIR_NTRes;
// reserved by NT
byte
DIR_CrtTimeTenth;
// time created, tenths of second portion
word
DIR_CrtTime;
// time created
word
DIR_CrtDate;
// date created
word
DIR_LstAccDate;
// last access date
word
DIR_FstClusHI;
// high word of entry's first cluster number
word
DIR_WrtTime;
// last update time
word
DIR_WrtDate;
// last update date
word
DIR_FstClusLO;
// low word of entry's first cluster number
dword
DIR_FileSize;
// file size
}_DIRENTRY;
typedef _DIRENTRY * DIRENTRY;
Reading an Entry
The Cache_File_Entry function returns a DIRENTRY structure containing
the 32 bytes of a directory entry. The function accepts a pointer to a FILE
structure (fo), a pointer to the number of the entry within its directory
(curEntry), and a value (ForceRead) that helps the code decide whether to
read a sector from the media or use the data in the passed FILE structure's
dsk -> buffer member.
If ForceRead is true, the function retrieves a sector from the storage media.
If ForceRead is false, the function reads a sector from the storage media only
if an entry is the first one in a sector. Otherwise the function uses the data in
the passed buffer. Firmware can thus call the function repeatedly to retrieve
a directory's entries in sequence while reading from the media only when
beginning a new sector. The FindEmptyEntries function in Chapter 10 uses
the ForceRead parameter in this way.
In the passed file structure, the dirclus member must contain the number of
the first cluster of the entry's directory. If ForceRead is false, the dirccls
member must contain a directory-cluster number where the code should
begin looking for the entry. To begin looking at the beginning of the direc-
tory, dirccls should equal dirclus.
Search WWH ::




Custom Search