home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / lan / soss.arj / SRC / MSC-DOS.H < prev    next >
C/C++ Source or Header  |  1991-02-22  |  6KB  |  220 lines

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