Leaked source code of windows server 2003
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.

330 lines
8.1 KiB

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