home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
archives
/
wkermit.zip
/
cdisk.h
< prev
next >
Wrap
C/C++ Source or Header
|
1985-11-11
|
4KB
|
124 lines
/* disk.h
*
* Disk System and Diskette Primitive Access Header
*
* The Greenleaf Functions - Copyright (C) 1983 Greenleaf Software
*/
typedef long dword;
#define dosint 0x21 /* DOS function interrupt */
/* Disk File Attribute bits are in the following structure */
struct DISKATTR {
word rdo : 1; /* bit 0 - Read Only attribute */
word hid : 1; /* bit 1 - Hidden attribute */
word sys : 1; /* bit 2 - System attribute */
word vll : 1; /* bit 3 - Volume Label in 1st 11 bytes */
word sbd : 1; /* bit 4 - Sub Directory bit */
word arc : 1; /* bit 5 is archive bit */
word _spares :10; /* bits 6,7, and first byte . unused */
};
/* this union allows ease of access to the attribute as a word */
union FILEATTR {
word fattr;
struct DISKATTR dattr;
};
struct EXTFCB {
byte extflag; /* extension flag: 0FF=extd fcb */
byte sysreserve[4]; /* reserved DOS 2.0 - don't use */
union FILEATTR dskattr; /* Attribute in second byte, 1st unused */
byte fdrive; /* drive code: 0=default 1=A 2=B.. */
byte fname[8]; /* filename UC left justify blank fill */
byte fext[3]; /* filename extension */
word blocknum; /* current block number, first = 0 */
word lrs; /* logical record size (bytes): 80h opn */
dword lfs; /* logical file size bytes: wd 1 = lo */
/* Create or Last Update Date */
word fcbyear : 7; /* year 0..119 (1980..2099) */
word fcbmonth: 4; /* month 1..12 */
word fcbday : 5; /* day 1..31 */
byte fcbsys[10]; /* reserved for DOS use */
byte fcbcr; /* current record number (seq i/o) */
dword fcbrec; /* random record number (rand i/o) */
};
/* Structure for FATINFO part of DISKTABLE
*/
struct FATINFO {
word fatid; /* see function 1B */
word allocunits; /* allocation units */
word sectsalloc; /* sectors per allocation unit */
word sectsize; /* sector size */
};
/* Structure for LOLEV part of DISKTABLE
*/
struct LOLEV {
int head; /* head 0..1 (0..7 for hard disk) */
int cylinder; /* 0..39 (0..1023 hard disk) */
int track; /* 0..39 ..synonym for cylinder */
int fsector; /* first sector - 1..9 (1..17 hard dsk) */
int nsectors; /* no. sectors - 1..8 (1..128 harddsk) */
int sectsdone; /* sectors actually done (return value) */
};
/* structure for lots of DOS disk access functions including members
* to handle DOS 2.0 and 1.x functions. Note that an Extended FCB is
* an integral part of this structure.
*
* The "lolev" structure part of this is used only for DOS interrupts
* 24h and 25h and for ALL "BIOS" or "LOLEV" disk functions "diskxxxx".
*
* The "fatinfo" structure part is used only for "dosfatinfo".
*/
struct DISKTABLE {
char *string; /* drive:path\filename.ext */
word handle; /* File Handle */
int drive; /* drive code: 0=A, etc. */
byte *bufoffset; /* pointer to disk buffer (offset) */
word bufseg; /* segment address of disk buffer */
/* code as 0 to use current DS */
word access; /* file access method 1..6 */
word mode; /* mode ASCII or BINARY */
struct EXTFCB dskfcb; /* FCB is used for some functions */
int rbytes; /* number of bytes to be read/written */
int abytes; /* ..bytes actually read/written */
struct LOLEV lolev; /* use for all "diskxxxx" functions only*/
word status; /* status return from all functions */
char *save; /* output string, as in fn 47h */
word dosver; /* DOS version as read by functions */
};
/* structure to use when renaming a file
*/
struct RENFILE {
byte drvcode; /* drive */
byte oldname[8]; /* DS:DX + 1..8 old filename */
byte oldext[3]; /* + 9..B old extension */
byte dontuse[5]; /* + C..10 .. do not use */
byte newname[8]; /* +11..18 .. new filename */
byte newext[3]; /* +19..1B .. new extension */
byte padddd[8]; /* pad out to regular FCB size */
};
struct FHANDLE {
unsigned xfhandle;
char xfname[13]; /* filename, ext */
};