home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c045 / 2.ddi / INCLUDE / DOS.H$ / DOS.bin
Encoding:
Text File  |  1992-01-01  |  7.9 KB  |  340 lines

  1. /***
  2. *dos.h - definitions for MS-DOS interface routines
  3. *
  4. *    Copyright (c) 1985-1991, 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 _INC_DOS
  15.  
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19.  
  20. #if (_MSC_VER <= 600)
  21. #define __cdecl     _cdecl
  22. #define __far       _far
  23. #define __interrupt _interrupt
  24. #define __near      _near
  25. #endif
  26.  
  27. #ifndef _REGS_DEFINED
  28.  
  29. /* word registers */
  30.  
  31. struct _WORDREGS {
  32.     unsigned int ax;
  33.     unsigned int bx;
  34.     unsigned int cx;
  35.     unsigned int dx;
  36.     unsigned int si;
  37.     unsigned int di;
  38.     unsigned int cflag;
  39.     };
  40.  
  41. /* byte registers */
  42.  
  43. struct _BYTEREGS {
  44.     unsigned char al, ah;
  45.     unsigned char bl, bh;
  46.     unsigned char cl, ch;
  47.     unsigned char dl, dh;
  48.     };
  49.  
  50. /* general purpose registers union -
  51.  *  overlays the corresponding word and byte registers.
  52.  */
  53.  
  54. union _REGS {
  55.     struct _WORDREGS x;
  56.     struct _BYTEREGS h;
  57.     };
  58.  
  59. /* segment registers */
  60.  
  61. struct _SREGS {
  62.     unsigned int es;
  63.     unsigned int cs;
  64.     unsigned int ss;
  65.     unsigned int ds;
  66.     };
  67.  
  68. #ifndef __STDC__
  69. /* Non-ANSI names for compatibility */
  70.  
  71. struct WORDREGS {
  72.     unsigned int ax;
  73.     unsigned int bx;
  74.     unsigned int cx;
  75.     unsigned int dx;
  76.     unsigned int si;
  77.     unsigned int di;
  78.     unsigned int cflag;
  79.     };
  80.  
  81. struct BYTEREGS {
  82.     unsigned char al, ah;
  83.     unsigned char bl, bh;
  84.     unsigned char cl, ch;
  85.     unsigned char dl, dh;
  86.     };
  87.  
  88. union REGS {
  89.     struct WORDREGS x;
  90.     struct BYTEREGS h;
  91.     };
  92.  
  93. struct SREGS {
  94.     unsigned int es;
  95.     unsigned int cs;
  96.     unsigned int ss;
  97.     unsigned int ds;
  98.     };
  99.  
  100. #endif    /* __STDC__ */
  101.  
  102. #define _REGS_DEFINED
  103. #endif /* _REGS_DEFINED */
  104.  
  105.  
  106. /* dosexterror structure */
  107.  
  108. #ifndef _DOSERROR_DEFINED
  109. #pragma pack(2)
  110.  
  111. struct _DOSERROR {
  112.     int exterror;
  113.     char errclass;
  114.     char action;
  115.     char locus;
  116.     };
  117.  
  118. #if ((!defined(__STDC__)) && (!defined(__cplusplus)))
  119. /* Non-ANSI name for compatibility */
  120. struct DOSERROR {
  121.     int exterror;
  122.     char class;
  123.     char action;
  124.     char locus;
  125.     };
  126. #endif
  127.  
  128. #pragma pack()
  129. #define _DOSERROR_DEFINED
  130. #endif
  131.  
  132.  
  133. /* _dos_findfirst structure */
  134.  
  135. #ifndef _FIND_T_DEFINED
  136. #pragma pack(2)
  137.  
  138. struct _find_t {
  139.     char reserved[21];
  140.     char attrib;
  141.     unsigned wr_time;
  142.     unsigned wr_date;
  143.     long size;
  144.     char name[13];
  145.     };
  146.  
  147. #ifndef __STDC__
  148. /* Non-ANSI name for compatibility */
  149. struct find_t {
  150.     char reserved[21];
  151.     char attrib;
  152.     unsigned wr_time;
  153.     unsigned wr_date;
  154.     long size;
  155.     char name[13];
  156.     };
  157. #endif
  158.  
  159. #pragma pack()
  160. #define _FIND_T_DEFINED
  161. #endif
  162.  
  163.  
  164. /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
  165.  
  166. #ifndef _DATETIME_T_DEFINED
  167. #pragma pack(2)
  168.  
  169. struct _dosdate_t {
  170.     unsigned char day;        /* 1-31 */
  171.     unsigned char month;        /* 1-12 */
  172.     unsigned int year;        /* 1980-2099 */
  173.     unsigned char dayofweek;    /* 0-6, 0=Sunday */
  174.     };
  175.  
  176. struct _dostime_t {
  177.     unsigned char hour;    /* 0-23 */
  178.     unsigned char minute;    /* 0-59 */
  179.     unsigned char second;    /* 0-59 */
  180.     unsigned char hsecond;    /* 0-99 */
  181.     };
  182.  
  183. #ifndef __STDC__
  184. /* Non-ANSI names for compatibility */
  185. struct dosdate_t {
  186.     unsigned char day;        /* 1-31 */
  187.     unsigned char month;        /* 1-12 */
  188.     unsigned int year;        /* 1980-2099 */
  189.     unsigned char dayofweek;    /* 0-6, 0=Sunday */
  190.     };
  191.  
  192. struct dostime_t {
  193.     unsigned char hour;    /* 0-23 */
  194.     unsigned char minute;    /* 0-59 */
  195.     unsigned char second;    /* 0-59 */
  196.     unsigned char hsecond;    /* 0-99 */
  197.     };
  198. #endif
  199.  
  200. #pragma pack()
  201. #define _DATETIME_T_DEFINED
  202. #endif
  203.  
  204.  
  205. /* _dos_getdiskfree structure */
  206.  
  207. #ifndef _DISKFREE_T_DEFINED
  208.  
  209. struct _diskfree_t {
  210.     unsigned total_clusters;
  211.     unsigned avail_clusters;
  212.     unsigned sectors_per_cluster;
  213.     unsigned bytes_per_sector;
  214.     };
  215.  
  216. #ifndef __STDC__
  217. /* Non-ANSI name for compatibility */
  218. #define diskfree_t _diskfree_t
  219. #endif
  220.  
  221. #define _DISKFREE_T_DEFINED
  222. #endif
  223.  
  224.  
  225. /* manifest constants for _hardresume result parameter */
  226.  
  227. #define _HARDERR_IGNORE     0    /* Ignore the error */
  228. #define _HARDERR_RETRY        1    /* Retry the operation */
  229. #define _HARDERR_ABORT        2    /* Abort program issuing Interrupt 23h */
  230. #define _HARDERR_FAIL        3    /* Fail the system call in progress */
  231.                     /* _HARDERR_FAIL is not supported on DOS 2.x */
  232.  
  233. /* File attribute constants */
  234.  
  235. #define _A_NORMAL    0x00    /* Normal file - No read/write restrictions */
  236. #define _A_RDONLY    0x01    /* Read only file */
  237. #define _A_HIDDEN    0x02    /* Hidden file */
  238. #define _A_SYSTEM    0x04    /* System file */
  239. #define _A_VOLID    0x08    /* Volume ID file */
  240. #define _A_SUBDIR    0x10    /* Subdirectory */
  241. #define _A_ARCH     0x20    /* Archive file */
  242.  
  243. /* macros to break C "far" pointers into their segment and offset components
  244.  */
  245.  
  246. #define _FP_SEG(fp) (*((unsigned __far *)&(fp)+1))
  247. #define _FP_OFF(fp) (*((unsigned __far *)&(fp)))
  248.  
  249.  
  250. /* external variable declarations */
  251.  
  252. extern unsigned int __near __cdecl _osversion;
  253.  
  254.  
  255. /* function prototypes */
  256.  
  257. #ifndef _MT
  258. int __cdecl _bdos(int, unsigned int, unsigned int);
  259. #ifndef _WINDOWS
  260. void __cdecl _chain_intr(void (__cdecl __interrupt __far *)());
  261. #endif
  262. void __cdecl _disable(void);
  263. #ifndef _WINDOWS
  264. unsigned __cdecl _dos_allocmem(unsigned, unsigned *);
  265. #endif
  266. unsigned __cdecl _dos_close(int);
  267. unsigned __cdecl _dos_commit(int);
  268. unsigned __cdecl _dos_creat(const char *, unsigned, int *);
  269. unsigned __cdecl _dos_creatnew(const char *, unsigned, int *);
  270. unsigned __cdecl _dos_findfirst(const char *, unsigned, struct _find_t *);
  271. unsigned __cdecl _dos_findnext(struct _find_t *);
  272. #ifndef _WINDOWS
  273. unsigned __cdecl _dos_freemem(unsigned);
  274. #endif
  275. void __cdecl _dos_getdate(struct _dosdate_t *);
  276. void __cdecl _dos_getdrive(unsigned *);
  277. unsigned __cdecl _dos_getdiskfree(unsigned, struct _diskfree_t *);
  278. unsigned __cdecl _dos_getfileattr(const char *, unsigned *);
  279. unsigned __cdecl _dos_getftime(int, unsigned *, unsigned *);
  280. void __cdecl _dos_gettime(struct _dostime_t *);
  281. void (__cdecl __interrupt __far * __cdecl _dos_getvect(unsigned))();
  282. #ifndef _WINDOWS
  283. void __cdecl _dos_keep(unsigned, unsigned);
  284. #endif
  285. unsigned __cdecl _dos_open(const char *, unsigned, int *);
  286. unsigned __cdecl _dos_read(int, void __far *, unsigned, unsigned *);
  287. #ifndef _WINDOWS
  288. unsigned __cdecl _dos_setblock(unsigned, unsigned, unsigned *);
  289. #endif
  290. unsigned __cdecl _dos_setdate(struct _dosdate_t *);
  291. void __cdecl _dos_setdrive(unsigned, unsigned *);
  292. unsigned __cdecl _dos_setfileattr(const char *, unsigned);
  293. unsigned __cdecl _dos_setftime(int, unsigned, unsigned);
  294. unsigned __cdecl _dos_settime(struct _dostime_t *);
  295. #ifndef _WINDOWS
  296. void __cdecl _dos_setvect(unsigned, void (__cdecl __interrupt __far *)());
  297. #endif
  298. unsigned __cdecl _dos_write(int, const void __far *, unsigned, unsigned *);
  299. int __cdecl _dosexterr(struct _DOSERROR *);
  300. void __cdecl _enable(void);
  301. #ifndef _WINDOWS
  302. void __cdecl _harderr(void (__far __cdecl *)());
  303. void __cdecl _hardresume(int);
  304. void __cdecl _hardretn(int);
  305. #endif
  306. int __cdecl _intdos(union _REGS *, union _REGS *);
  307. int __cdecl _intdosx(union _REGS *, union _REGS *, struct _SREGS *);
  308. int __cdecl _int86(int, union _REGS *, union _REGS *);
  309. int __cdecl _int86x(int, union _REGS *, union _REGS *, struct _SREGS *);
  310. #endif /* _MT */
  311.  
  312. void __cdecl _segread(struct _SREGS *);
  313.  
  314. #ifndef __STDC__
  315. /* Non-ANSI names for compatibility */
  316.  
  317. #define FP_SEG       _FP_SEG
  318. #define FP_OFF       _FP_OFF
  319.  
  320. #ifndef _MT
  321. int __cdecl bdos(int, unsigned int, unsigned int);
  322. int __cdecl intdos(union REGS *, union REGS *);
  323. int __cdecl intdosx(union REGS *, union REGS *, struct SREGS *);
  324. int __cdecl int86(int, union REGS *, union REGS *);
  325. int __cdecl int86x(int, union REGS *, union REGS *, struct SREGS *);
  326. #ifndef __cplusplus
  327. int __cdecl dosexterr(struct DOSERROR *);
  328. #endif
  329. #endif
  330. void __cdecl segread(struct SREGS *);
  331.  
  332. #endif    /* __STDC__ */
  333.  
  334. #ifdef __cplusplus
  335. }
  336. #endif
  337.  
  338. #define _INC_DOS
  339. #endif    /* _INC_DOS */
  340.