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.

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