home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / Quick C 2.0 / INCLUDE / DOS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-05  |  5.4 KB  |  212 lines

  1. /***
  2. *dos.h - definitions for MS-DOS interface routines
  3. *
  4. *    Copyright (c) 1985-1989, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *    Defines the structs and unions used for the direct DOS interface
  8. *    routines; includes macros to access the segment and offset
  9. *    values of far pointers, so that they may be used by the routines; and
  10. *    provides function prototypes for direct DOS interface functions.
  11. *
  12. ****/
  13.  
  14.  
  15. #ifndef NO_EXT_KEYS    /* extensions enabled */
  16.     #define _CDECL    cdecl
  17.     #define _NEAR    near
  18. #else /* extensions not enabled */
  19.     #define _CDECL
  20.     #define _NEAR
  21. #endif /* NO_EXT_KEYS */
  22.  
  23. #ifndef _REGS_DEFINED
  24.  
  25. /* word registers */
  26.  
  27. struct WORDREGS {
  28.     unsigned int ax;
  29.     unsigned int bx;
  30.     unsigned int cx;
  31.     unsigned int dx;
  32.     unsigned int si;
  33.     unsigned int di;
  34.     unsigned int cflag;
  35.     };
  36.  
  37. /* byte registers */
  38.  
  39. struct BYTEREGS {
  40.     unsigned char al, ah;
  41.     unsigned char bl, bh;
  42.     unsigned char cl, ch;
  43.     unsigned char dl, dh;
  44.     };
  45.  
  46. /* general purpose registers union -
  47.  *  overlays the corresponding word and byte registers.
  48.  */
  49.  
  50. union REGS {
  51.     struct WORDREGS x;
  52.     struct BYTEREGS h;
  53.     };
  54.  
  55. /* segment registers */
  56.  
  57. struct SREGS {
  58.     unsigned int es;
  59.     unsigned int cs;
  60.     unsigned int ss;
  61.     unsigned int ds;
  62.     };
  63.  
  64. #define _REGS_DEFINED
  65.  
  66. #endif
  67.  
  68. /* dosexterror structure */
  69.  
  70. #ifndef    _DOSERROR_DEFINED
  71.  
  72. struct DOSERROR {
  73.     int exterror;
  74.     char class;
  75.     char action;
  76.     char locus;
  77.     };
  78.  
  79. #define    _DOSERROR_DEFINED
  80.  
  81. #endif
  82.  
  83. /* _dos_findfirst structure */
  84.  
  85. #ifndef    _FIND_T_DEFINED
  86.  
  87. struct find_t {
  88.     char reserved[21];
  89.     char attrib;
  90.     unsigned wr_time;
  91.     unsigned wr_date;
  92.     long size;
  93.     char name[13];
  94.     };
  95.  
  96. #define    _FIND_T_DEFINED
  97.  
  98. #endif
  99.  
  100. /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
  101.  
  102. #ifndef _DATETIME_T_DEFINED
  103.  
  104. struct dosdate_t {
  105.     unsigned char day;        /* 1-31 */
  106.     unsigned char month;        /* 1-12 */
  107.     unsigned int year;        /* 1980-2099 */
  108.     unsigned char dayofweek;    /* 0-6, 0=Sunday */
  109.     };
  110.  
  111. struct dostime_t {
  112.     unsigned char hour;     /* 0-23 */
  113.     unsigned char minute;    /* 0-59 */
  114.     unsigned char second;    /* 0-59 */
  115.     unsigned char hsecond;    /* 0-99 */
  116.     };
  117.  
  118. #define _DATETIME_T_DEFINED
  119.  
  120. #endif
  121.  
  122. /* _dos_getdiskfree structure */
  123.  
  124. #ifndef _DISKFREE_T_DEFINED
  125.  
  126. struct diskfree_t {
  127.     unsigned total_clusters;
  128.     unsigned avail_clusters;
  129.     unsigned sectors_per_cluster;
  130.     unsigned bytes_per_sector;
  131.     };
  132.  
  133. #define _DISKFREE_T_DEFINED
  134.  
  135. #endif
  136.  
  137. /* manifest constants for _hardresume result parameter */
  138.  
  139. #define _HARDERR_IGNORE        0    /* Ignore the error */
  140. #define _HARDERR_RETRY        1    /* Retry the operation */
  141. #define _HARDERR_ABORT        2    /* Abort program issuing Interrupt 23h */
  142. #define _HARDERR_FAIL        3    /* Fail the system call in progress */
  143.                     /* _HARDERR_FAIL is not supported on DOS 2.x */
  144.  
  145. /* File attribute constants */
  146.  
  147. #define    _A_NORMAL        0x00    /* Normal file - No read/write restrictions */
  148. #define    _A_RDONLY        0x01    /* Read only file */
  149. #define    _A_HIDDEN        0x02    /* Hidden file */
  150. #define    _A_SYSTEM        0x04    /* System file */
  151. #define    _A_VOLID        0x08    /* Volume ID file */
  152. #define    _A_SUBDIR        0x10    /* Subdirectory */
  153. #define    _A_ARCH            0x20    /* Archive file */
  154.  
  155. /* macros to break MS C "far" pointers into their segment and offset
  156.  * components
  157.  */
  158.  
  159. #define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
  160. #define FP_OFF(fp) (*((unsigned *)&(fp)))
  161.  
  162.  
  163. /* external variable declarations */
  164.  
  165. extern unsigned int _NEAR _CDECL _osversion;
  166.  
  167.  
  168. /* function prototypes */
  169.  
  170. int _CDECL bdos(int, unsigned int, unsigned int);
  171. void _CDECL _disable(void);
  172. unsigned _CDECL _dos_allocmem(unsigned, unsigned *);
  173. unsigned _CDECL _dos_close(int);
  174. unsigned _CDECL _dos_creat(char *, unsigned, int *);
  175. unsigned _CDECL _dos_creatnew(char *, unsigned, int *);
  176. unsigned _CDECL _dos_findfirst(char *, unsigned, struct find_t *);
  177. unsigned _CDECL _dos_findnext(struct find_t *);
  178. unsigned _CDECL _dos_freemem(unsigned);
  179. void _CDECL _dos_getdate(struct dosdate_t *);
  180. void _CDECL _dos_getdrive(unsigned *);
  181. unsigned _CDECL _dos_getdiskfree(unsigned, struct diskfree_t *);
  182. unsigned _CDECL _dos_getfileattr(char *, unsigned *);
  183. unsigned _CDECL _dos_getftime(int, unsigned *, unsigned *);
  184. void _CDECL _dos_gettime(struct dostime_t *);
  185. void _CDECL _dos_keep(unsigned, unsigned);
  186. unsigned _CDECL _dos_open(char *, unsigned, int *);
  187. unsigned _CDECL _dos_setblock(unsigned, unsigned, unsigned *);
  188. unsigned _CDECL _dos_setdate(struct dosdate_t *);
  189. void _CDECL _dos_setdrive(unsigned, unsigned *);
  190. unsigned _CDECL _dos_setfileattr(char *, unsigned);
  191. unsigned _CDECL _dos_setftime(int, unsigned, unsigned);
  192. unsigned _CDECL _dos_settime(struct dostime_t *);
  193. int _CDECL dosexterr(struct DOSERROR *);
  194. void _CDECL _enable(void);
  195. void _CDECL _hardresume(int);
  196. void _CDECL _hardretn(int);
  197. int _CDECL intdos(union REGS *, union REGS *);
  198. int _CDECL intdosx(union REGS *, union REGS *, struct SREGS *);
  199. int _CDECL int86(int, union REGS *, union REGS *);
  200. int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);
  201.  
  202. #ifndef NO_EXT_KEYS    /* extensions enabled */
  203. void _CDECL _chain_intr(void (_CDECL interrupt far *)());
  204. void (_CDECL interrupt far * _CDECL _dos_getvect(unsigned))();
  205. unsigned _CDECL _dos_read(int, void far *, unsigned, unsigned *);
  206. void _CDECL _dos_setvect(unsigned, void (_CDECL interrupt far *)());
  207. unsigned _CDECL _dos_write(int, void far *, unsigned, unsigned *);
  208. void _CDECL _harderr(void (far *)());
  209. #endif /* NO_EXT_KEYS */
  210.  
  211. void _CDECL segread(struct SREGS *);
  212.