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.

220 lines
5.8 KiB

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