home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c040 / 6.ddi / INCLUDE / DOS.H$ / DOS.bin
Encoding:
Text File  |  1989-11-08  |  5.2 KB  |  210 lines

  1. /***
  2. *dos.h - definitions for MS-DOS interface routines
  3. *
  4. *    Copyright (c) 1985-1990, 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 _REGS_DEFINED
  16.  
  17. /* word registers */
  18.  
  19. struct WORDREGS {
  20.     unsigned int ax;
  21.     unsigned int bx;
  22.     unsigned int cx;
  23.     unsigned int dx;
  24.     unsigned int si;
  25.     unsigned int di;
  26.     unsigned int cflag;
  27.     };
  28.  
  29.  
  30. /* byte registers */
  31.  
  32. struct BYTEREGS {
  33.     unsigned char al, ah;
  34.     unsigned char bl, bh;
  35.     unsigned char cl, ch;
  36.     unsigned char dl, dh;
  37.     };
  38.  
  39.  
  40. /* general purpose registers union -
  41.  *  overlays the corresponding word and byte registers.
  42.  */
  43.  
  44. union REGS {
  45.     struct WORDREGS x;
  46.     struct BYTEREGS h;
  47.     };
  48.  
  49.  
  50. /* segment registers */
  51.  
  52. struct SREGS {
  53.     unsigned int es;
  54.     unsigned int cs;
  55.     unsigned int ss;
  56.     unsigned int ds;
  57.     };
  58.  
  59. #define _REGS_DEFINED
  60.  
  61. #endif
  62.  
  63.  
  64. /* dosexterror structure */
  65.  
  66. #ifndef _DOSERROR_DEFINED
  67.  
  68. struct DOSERROR {
  69.     int exterror;
  70.     char class;
  71.     char action;
  72.     char locus;
  73.     };
  74.  
  75. #define _DOSERROR_DEFINED
  76.  
  77. #endif
  78.  
  79.  
  80. /* _dos_findfirst structure */
  81.  
  82. #ifndef _FIND_T_DEFINED
  83.  
  84. struct find_t {
  85.     char reserved[21];
  86.     char attrib;
  87.     unsigned wr_time;
  88.     unsigned wr_date;
  89.     long size;
  90.     char name[13];
  91.     };
  92.  
  93. #define _FIND_T_DEFINED
  94.  
  95. #endif
  96.  
  97.  
  98. /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
  99.  
  100. #ifndef _DATETIME_T_DEFINED
  101.  
  102. struct dosdate_t {
  103.     unsigned char day;        /* 1-31 */
  104.     unsigned char month;        /* 1-12 */
  105.     unsigned int year;        /* 1980-2099 */
  106.     unsigned char dayofweek;    /* 0-6, 0=Sunday */
  107.     };
  108.  
  109. struct dostime_t {
  110.     unsigned char hour;    /* 0-23 */
  111.     unsigned char minute;    /* 0-59 */
  112.     unsigned char second;    /* 0-59 */
  113.     unsigned char hsecond;    /* 0-99 */
  114.     };
  115.  
  116. #define _DATETIME_T_DEFINED
  117.  
  118. #endif
  119.  
  120.  
  121. /* _dos_getdiskfree structure */
  122.  
  123. #ifndef _DISKFREE_T_DEFINED
  124.  
  125. struct diskfree_t {
  126.     unsigned total_clusters;
  127.     unsigned avail_clusters;
  128.     unsigned sectors_per_cluster;
  129.     unsigned bytes_per_sector;
  130.     };
  131.  
  132. #define _DISKFREE_T_DEFINED
  133.  
  134. #endif
  135.  
  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 C "far" pointers into their segment and offset components
  156.  */
  157.  
  158. #define FP_SEG(fp) (*((unsigned _far *)&(fp)+1))
  159. #define FP_OFF(fp) (*((unsigned _far *)&(fp)))
  160.  
  161.  
  162. /* external variable declarations */
  163.  
  164. extern unsigned int _near _cdecl _osversion;
  165.  
  166.  
  167. /* function prototypes */
  168.  
  169. #ifndef _MT
  170. int _cdecl bdos(int, unsigned int, unsigned int);
  171. void _cdecl _chain_intr(void (_cdecl _interrupt _far *)());
  172. void _cdecl _disable(void);
  173. unsigned _cdecl _dos_allocmem(unsigned, unsigned *);
  174. unsigned _cdecl _dos_close(int);
  175. unsigned _cdecl _dos_creat(const char *, unsigned, int *);
  176. unsigned _cdecl _dos_creatnew(const char *, unsigned, int *);
  177. unsigned _cdecl _dos_findfirst(const char *, unsigned, struct find_t *);
  178. unsigned _cdecl _dos_findnext(struct find_t *);
  179. unsigned _cdecl _dos_freemem(unsigned);
  180. void _cdecl _dos_getdate(struct dosdate_t *);
  181. void _cdecl _dos_getdrive(unsigned *);
  182. unsigned _cdecl _dos_getdiskfree(unsigned, struct diskfree_t *);
  183. unsigned _cdecl _dos_getfileattr(const char *, unsigned *);
  184. unsigned _cdecl _dos_getftime(int, unsigned *, unsigned *);
  185. void _cdecl _dos_gettime(struct dostime_t *);
  186. void (_cdecl _interrupt _far * _cdecl _dos_getvect(unsigned))();
  187. void _cdecl _dos_keep(unsigned, unsigned);
  188. unsigned _cdecl _dos_open(const char *, unsigned, int *);
  189. unsigned _cdecl _dos_read(int, void _far *, unsigned, unsigned *);
  190. unsigned _cdecl _dos_setblock(unsigned, unsigned, unsigned *);
  191. unsigned _cdecl _dos_setdate(struct dosdate_t *);
  192. void _cdecl _dos_setdrive(unsigned, unsigned *);
  193. unsigned _cdecl _dos_setfileattr(const char *, unsigned);
  194. unsigned _cdecl _dos_setftime(int, unsigned, unsigned);
  195. unsigned _cdecl _dos_settime(struct dostime_t *);
  196. void _cdecl _dos_setvect(unsigned, void (_cdecl _interrupt _far *)());
  197. unsigned _cdecl _dos_write(int, const void _far *, unsigned, unsigned *);
  198. int _cdecl dosexterr(struct DOSERROR *);
  199. void _cdecl _enable(void);
  200. void _cdecl _harderr(void (_far *)());
  201. void _cdecl _hardresume(int);
  202. void _cdecl _hardretn(int);
  203. int _cdecl intdos(union REGS *, union REGS *);
  204. int _cdecl intdosx(union REGS *, union REGS *, struct SREGS *);
  205. int _cdecl int86(int, union REGS *, union REGS *);
  206. int _cdecl int86x(int, union REGS *, union REGS *, struct SREGS *);
  207. #endif /* _MT */
  208.  
  209. void _cdecl segread(struct SREGS *);
  210.