Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

210 lines
5.1 KiB

  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. #ifndef _REGS_DEFINED
  14. /* word registers */
  15. struct WORDREGS {
  16. unsigned int ax;
  17. unsigned int bx;
  18. unsigned int cx;
  19. unsigned int dx;
  20. unsigned int si;
  21. unsigned int di;
  22. unsigned int cflag;
  23. };
  24. /* byte registers */
  25. struct BYTEREGS {
  26. unsigned char al, ah;
  27. unsigned char bl, bh;
  28. unsigned char cl, ch;
  29. unsigned char dl, dh;
  30. };
  31. /* general purpose registers union -
  32. * overlays the corresponding word and byte registers.
  33. */
  34. union REGS {
  35. struct WORDREGS x;
  36. struct BYTEREGS h;
  37. };
  38. /* segment registers */
  39. struct SREGS {
  40. unsigned int es;
  41. unsigned int cs;
  42. unsigned int ss;
  43. unsigned int ds;
  44. };
  45. #define _REGS_DEFINED
  46. #endif
  47. // BUGBUG
  48. // Glock dont like the use of the keyword class, remove temporarily
  49. //
  50. //#ifndef _DOSERROR_DEFINED
  51. //
  52. //struct DOSERROR {
  53. // int exterror;
  54. // char class;
  55. // char action;
  56. // char locus;
  57. // };
  58. //
  59. //#define _DOSERROR_DEFINED
  60. //
  61. //
  62. // #endif
  63. /* _dos_findfirst structure */
  64. #ifndef _FIND_T_DEFINED
  65. struct find_t {
  66. char reserved[21];
  67. char attrib;
  68. unsigned wr_time;
  69. unsigned wr_date;
  70. long size;
  71. char name[13];
  72. };
  73. #define _FIND_T_DEFINED
  74. #endif
  75. /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
  76. #ifndef _DATETIME_T_DEFINED
  77. struct dosdate_t {
  78. unsigned char day; /* 1-31 */
  79. unsigned char month; /* 1-12 */
  80. unsigned int year; /* 1980-2099 */
  81. unsigned char dayofweek; /* 0-6, 0=Sunday */
  82. };
  83. struct dostime_t {
  84. unsigned char hour; /* 0-23 */
  85. unsigned char minute; /* 0-59 */
  86. unsigned char second; /* 0-59 */
  87. unsigned char hsecond; /* 0-99 */
  88. };
  89. #define _DATETIME_T_DEFINED
  90. #endif
  91. /* _dos_getdiskfree structure */
  92. #ifndef _DISKFREE_T_DEFINED
  93. struct diskfree_t {
  94. unsigned total_clusters;
  95. unsigned avail_clusters;
  96. unsigned sectors_per_cluster;
  97. unsigned bytes_per_sector;
  98. };
  99. #define _DISKFREE_T_DEFINED
  100. #endif
  101. /* manifest constants for _hardresume result parameter */
  102. #define _HARDERR_IGNORE 0 /* Ignore the error */
  103. #define _HARDERR_RETRY 1 /* Retry the operation */
  104. #define _HARDERR_ABORT 2 /* Abort program issuing Interrupt 23h */
  105. #define _HARDERR_FAIL 3 /* Fail the system call in progress */
  106. /* _HARDERR_FAIL is not supported on DOS 2.x */
  107. /* File attribute constants */
  108. #define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
  109. #define _A_RDONLY 0x01 /* Read only file */
  110. #define _A_HIDDEN 0x02 /* Hidden file */
  111. #define _A_SYSTEM 0x04 /* System file */
  112. #define _A_VOLID 0x08 /* Volume ID file */
  113. #define _A_SUBDIR 0x10 /* Subdirectory */
  114. #define _A_ARCH 0x20 /* Archive file */
  115. /* macros to break C "far" pointers into their segment and offset components
  116. */
  117. #define FP_SEG(fp) (*((unsigned _far *)&(fp)+1))
  118. #define FP_OFF(fp) (*((unsigned _far *)&(fp)))
  119. /* external variable declarations */
  120. extern unsigned int _near _cdecl _osversion;
  121. /* function prototypes */
  122. #ifndef _MT
  123. int _cdecl bdos(int, unsigned int, unsigned int);
  124. void _cdecl _chain_intr(void (_cdecl _interrupt _far *)());
  125. void _cdecl _disable(void);
  126. unsigned _cdecl _dos_allocmem(unsigned, unsigned *);
  127. unsigned _cdecl _dos_close(int);
  128. unsigned _cdecl _dos_creat(const char *, unsigned, int *);
  129. unsigned _cdecl _dos_creatnew(const char *, unsigned, int *);
  130. unsigned _cdecl _dos_findfirst(const char *, unsigned, struct find_t *);
  131. unsigned _cdecl _dos_findnext(struct find_t *);
  132. unsigned _cdecl _dos_freemem(unsigned);
  133. void _cdecl _dos_getdate(struct dosdate_t *);
  134. void _cdecl _dos_getdrive(unsigned *);
  135. unsigned _cdecl _dos_getdiskfree(unsigned, struct diskfree_t *);
  136. unsigned _cdecl _dos_getfileattr(const char *, unsigned *);
  137. unsigned _cdecl _dos_getftime(int, unsigned *, unsigned *);
  138. void _cdecl _dos_gettime(struct dostime_t *);
  139. void (_cdecl _interrupt _far * _cdecl _dos_getvect(unsigned))();
  140. void _cdecl _dos_keep(unsigned, unsigned);
  141. unsigned _cdecl _dos_open(const char *, unsigned, int *);
  142. unsigned _cdecl _dos_read(int, void _far *, unsigned, unsigned *);
  143. unsigned _cdecl _dos_setblock(unsigned, unsigned, unsigned *);
  144. unsigned _cdecl _dos_setdate(struct dosdate_t *);
  145. void _cdecl _dos_setdrive(unsigned, unsigned *);
  146. unsigned _cdecl _dos_setfileattr(const char *, unsigned);
  147. unsigned _cdecl _dos_setftime(int, unsigned, unsigned);
  148. unsigned _cdecl _dos_settime(struct dostime_t *);
  149. void _cdecl _dos_setvect(unsigned, void (_cdecl _interrupt _far *)());
  150. unsigned _cdecl _dos_write(int, const void _far *, unsigned, unsigned *);
  151. int _cdecl dosexterr(struct DOSERROR *);
  152. void _cdecl _enable(void);
  153. void _cdecl _harderr(void (_far *)());
  154. void _cdecl _hardresume(int);
  155. void _cdecl _hardretn(int);
  156. int _cdecl intdos(union REGS *, union REGS *);
  157. int _cdecl intdosx(union REGS *, union REGS *, struct SREGS *);
  158. int _cdecl int86(int, union REGS *, union REGS *);
  159. int _cdecl int86x(int, union REGS *, union REGS *, struct SREGS *);
  160. #endif /* _MT */
  161. void _cdecl segread(struct SREGS *);