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.

276 lines
9.0 KiB

  1. ;***
  2. ;msdos.inc - MS-DOS definitions for C runtime
  3. ;
  4. ; Copyright (c) 1987-2001, Microsoft Corporation. All rights reserved.
  5. ;
  6. ;Purpose:
  7. ; This file contains the MS-DOS definitions (DOS function request
  8. ; numbers, flags, etc) used by the C runtime.
  9. ;
  10. ;Revision History:
  11. ; 10-22-87 JCR Removed "PROTMODE_ONLY" comments
  12. ; 02-19-88 SKS STACKSLOP is 256 for DOS, 512 for OS/2
  13. ; 06-02-89 JCR Added 386 OS/2 allocmem/setmem flag definitions
  14. ; 06-07-89 JCR Bumped STACKSLOP to 1024 for 386 OS/2
  15. ; 10-18-89 JCR Changed _NEWREGION to match change in OS2 mem APIs
  16. ; 11-02-89 JCR Added DOS32QUERYSYSINFO offset definitions
  17. ; 11-10-89 JCR Added OBJ_TILE bit to _NEWREGION memory request
  18. ; 06-06-90 SBM Added DOSOPEN flags, names match doscalls.h, added
  19. ; tentative new DOS32QUERYFHSTATE flags
  20. ; 12-10-90 GJF Updated values of new flags introduced above.
  21. ;
  22. ;*******************************************************************************
  23. ;_NFILE equ 20 ; maximum # files per process
  24. ifdef OS2
  25. ifdef I386
  26. STACKSLOP equ 1024 ; stack slop for 386 OS/2 system call overhead
  27. else
  28. STACKSLOP equ 512 ; stack slop for 286 OS/2 system call overhead
  29. endif
  30. else
  31. STACKSLOP equ 256 ; stack slop for DOS interrupt overhead
  32. endif
  33. ; __osfile flag values for DOS file handles
  34. FOPEN equ 01H ; file handle open
  35. FEOFLAG equ 02H ; end of file has been encountered
  36. FCRLF equ 04H ; CR-LF across read buffer (in text mode)
  37. FPIPE equ 08H ; file handle refers to a pipe
  38. FRDONLY equ 10H ; file handle associated with read only file
  39. FAPPEND equ 20H ; file handle opened O_APPEND
  40. FDEV equ 40H ; file handle refers to device
  41. FTEXT equ 80H ; file handle is in text mode
  42. callos MACRO func
  43. ifnb <func>
  44. mov ah,DOS_&func
  45. endif
  46. int DOS
  47. ENDM
  48. DOS equ 21H ; MS-DOS interrupt
  49. DOS_exit equ 00000H ; exit offset (PSP:0000)
  50. DOS_maxpara equ 00002H ; maximum paragraph (PSP:0002)
  51. DOS_envp equ 0002cH ; environment address (PSP:002c)
  52. DOS_cmdline equ 00080H ; command line offset (PSP:0080)
  53. DOS_kill equ 00H ; terminate
  54. DOS_echoread equ 01H ; read keyboard and echo
  55. DOS_display equ 02H ; display character
  56. DOS_auxinput equ 03H ; auxiliary input
  57. DOS_auxoutput equ 04H ; auxiliary output
  58. DOS_print equ 05H ; print character
  59. DOS_conio equ 06H ; direct console i/o
  60. DOS_coninput equ 07H ; direct console input
  61. DOS_readkbd equ 08H ; read keyboard
  62. DOS_message equ 09H ; display string
  63. DOS_bufkbdin equ 0aH ; buffered keyboard input
  64. DOS_kbdstatus equ 0bH ; check keyboard status
  65. DOS_flshread equ 0cH ; flush buffer and read keyboard
  66. DOS_diskreset equ 0dH ; disk reset
  67. DOS_selectdisk equ 0eH ; select default disk
  68. DOS_fcbopen equ 0fH ; open file with fcb
  69. DOS_fcbclose equ 10H ; close file with fcb
  70. DOS_fcbfirst equ 11H ; search for first entry with fcb
  71. DOS_fcbnext equ 12H ; search for next entry with fcb
  72. DOS_fcbdelete equ 13H ; delete file with fcb
  73. DOS_fcbsread equ 14H ; sequential read with fcb
  74. DOS_fcbswrite equ 15H ; sequential write with fcb
  75. DOS_fcbcreate equ 16H ; create file with fcb
  76. DOS_fcbrename equ 17H ; rename file with fcb
  77. DOS_currentd equ 19H ; current default disk
  78. DOS_setDMA equ 1aH ; set DMA
  79. DOS_fcbrread equ 21H ; random read with fcb
  80. DOS_fcbrwrite equ 22H ; random write with fcb
  81. DOS_fcbsize equ 23H ; file size with fcb
  82. DOS_fcbsetrec equ 24H ; set relative record with fcb
  83. DOS_setvector equ 25H ; set interrupt vector
  84. DOS_fcbbread equ 27H ; random block read with fcb
  85. DOS_fcbbwrite equ 28H ; random block write with fcb
  86. DOS_fcbparse equ 29H ; parse file name with fcb
  87. DOS_getdate equ 2aH ; get date
  88. DOS_setdate equ 2bH ; set date
  89. DOS_gettime equ 2cH ; get time
  90. DOS_settime equ 2dH ; set time
  91. DOS_verify equ 2eH ; set/reset verify flag
  92. DOS_getDMA equ 2fH ; get DMA
  93. DOS_version equ 30H ; get version number
  94. DOS_keep equ 31H ; keep process
  95. DOS_cntlc equ 33H ; Cntl-C check
  96. DOS_getvector equ 35H ; get interrupt vector
  97. DOS_getdskspc equ 36H ; get disk free space
  98. DOS_country equ 38H ; get country dependent info
  99. DOS_mkdir equ 39H ; make subdirectory
  100. DOS_rmdir equ 3aH ; remove subdirectory
  101. DOS_chdir equ 3bH ; change subdirectory
  102. DOS_create equ 3cH ; create pathname
  103. DOS_open equ 3dH ; open pathname
  104. DOS_close equ 3eH ; close file handle
  105. DOS_read equ 3fH ; read from file handle
  106. DOS_write equ 40H ; write from file handle
  107. DOS_delete equ 41H ; delete pathname
  108. DOS_lseek equ 42H ; move file pointer
  109. DOS_filemode equ 43H ; get/set attributes of pathname
  110. DOS_ioctl equ 44H ; ioctl for devices
  111. DOS_dup equ 45H ; duplicate file handle
  112. DOS_forcedup equ 46H ; force duplicate file handle
  113. DOS_curdir equ 47H ; get current directory
  114. DOS_allocmem equ 48H ; allocate memory block
  115. DOS_freemem equ 49H ; free memory block
  116. DOS_setmem equ 4aH ; set size of memory block
  117. DOS_exec equ 4bH ; load and execute program
  118. DOS_terminate equ 4cH ; terminate process with errorcode
  119. DOS_wait equ 4dH ; get child process return code
  120. DOS_findfirst equ 4eH ; find first file match
  121. DOS_findnext equ 4fH ; find next file match
  122. DOS_getverify equ 54H ; return current verify flag
  123. DOS_rename equ 56H ; rename pathname
  124. DOS_filedate equ 57H ; get/set file handle date/time
  125. DOS_createnew equ 5BH ; create new file
  126. DOS_locking equ 5CH ; file record locking/unlocking
  127. DOS_sleep equ 89H ; delay process execution
  128. ; DOS error codes
  129. doserr MACRO num,name,text
  130. name equ num
  131. ENDM
  132. doserr 1, E_ifunc, <invalid function code>
  133. doserr 2, E_nofile, <file not found>
  134. doserr 3, E_nopath, <path not found>
  135. doserr 4, E_toomany, <too many open files>
  136. doserr 5, E_access, <access denied>
  137. doserr 6, E_ihandle, <invalid handle>
  138. doserr 7, E_arena, <arena trashed>
  139. doserr 8, E_nomem, <not enough memory>
  140. doserr 9, E_iblock, <invalid block>
  141. doserr 10, E_badenv, <bad environment>
  142. doserr 11, E_badfmt, <bad format>
  143. doserr 12, E_iaccess, <invalid access code>
  144. doserr 13, E_idata, <invalid data>
  145. doserr 14, E_unknown, <??? unknown error ???>
  146. doserr 15, E_idrive, <invalid drive>
  147. doserr 16, E_curdir, <current directory>
  148. doserr 17, E_difdev, <not same device>
  149. doserr 18, E_nomore, <no more files>
  150. doserr 19, E_maxerr2, <unknown error - Version 2.0>
  151. ; the following errors can occur only in DOS 3.0
  152. doserr 32, E_sharerr, <sharing violation>
  153. doserr 33, E_lockerr, <locking violation>
  154. doserr 34, E_maxerr3, <unknown error - Version 3.0>
  155. ; DOS file attributes
  156. A_ro equ 01H ; read-only file
  157. A_h equ 02H ; hidden
  158. A_s equ 04H ; system
  159. A_v equ 08H ; volume ID
  160. A_d equ 10H ; directory
  161. A_a equ 20H ; archive
  162. A_mod equ A_ro+A_h+A_s+A_a ; modifiable attributes
  163. ; OS/2 file attributes, names match doscalls.h
  164. FILE_NORMAL equ 00h
  165. FILE_READONLY equ 01h
  166. FILE_HIDDEN equ 02h
  167. FILE_SYSTEM equ 04h
  168. FILE_DIRECTORY equ 10h
  169. FILE_ARCHIVED equ 20h
  170. ; OS/2 file creation bits
  171. F_CREATFLAG equ 10h
  172. F_OPENFLAG equ 01h
  173. F_TRUNCFLAG equ 02h
  174. ; OS/2 file creation bits, names match doscalls.h
  175. FILE_OPEN equ 01h
  176. FILE_TRUNCATE equ 02h
  177. FILE_CREATE equ 10h
  178. ; OS/2 DOS32OPEN/DOS32SETFHSTATE flags
  179. OPEN_ACCESS_READONLY equ 0000h
  180. OPEN_ACCESS_WRITEONLY equ 0001h
  181. OPEN_ACCESS_READWRITE equ 0002h
  182. OPEN_SHARE_DENYREADWRITE equ 0010h
  183. OPEN_SHARE_DENYWRITE equ 0020h
  184. OPEN_SHARE_DENYREAD equ 0030h
  185. OPEN_SHARE_DENYNONE equ 0040h
  186. OPEN_FLAGS_NOINHERIT equ 0080h
  187. OPEN_FLAGS_FAIL_ON_ERROR equ 2000h
  188. OPEN_FLAGS_WRITE_THROUGH equ 4000h
  189. OPEN_FLAGS_DASD equ 8000h
  190. ; new DOS32QUERYFHSTATE flags from DCR 'Add full 32-bit support for
  191. ; runtime libraries.' NAMES TENTATIVE AND SUBJECT TO CHANGE. STAY AWAY.
  192. OPEN_FLAGS_CONSOLE equ 00080000h
  193. OPEN_FLAGS_RAWMODE equ 00100000h
  194. OPEN_FLAGS_EOF equ 00200000h
  195. ; OS/2 device mask
  196. IS_DEV equ 1
  197. IS_PIPE equ 2
  198. ifdef I386
  199. ;
  200. ; OS/2 System Call Flags (from bse32dos.h)
  201. ;
  202. ; Access protection
  203. PAG_READ equ 00000001h ; read access
  204. PAG_WRITE equ 00000002h ; write access
  205. PAG_EXECUTE equ 00000004h ; execute access
  206. PAG_GUARD equ 00000008h ; guard protection
  207. ; Commit
  208. PAG_COMMIT equ 00000010h ; commit storage
  209. PAG_DECOMMIT equ 00000020h ; decommit storage
  210. ; Allocation attributes
  211. OBJ_TILE equ 00000040h ; tile object
  212. OBJ_PROTECTED equ 00000080h ; protect object
  213. OBJ_GETTABLE equ 00000100h ; gettable by other processes
  214. OBJ_GIVEABLE equ 00000200h ; giveable to other processes
  215. ; Standard memory values for C lib (heap and mthread code)
  216. _NEWREGION equ (PAG_READ OR PAG_WRITE OR OBJ_TILE)
  217. _COMMIT equ (PAG_COMMIT OR PAG_READ OR PAG_WRITE)
  218. _DECOMMIT equ (PAG_DECOMMIT)
  219. ; Indices for DOS32QUERYSYSINFO system call (from bsedos.h)
  220. _QSV_MAX_PATH_LENGTH EQU 1
  221. _QSV_MAX_TEXT_SESSIONS EQU 2
  222. _QSV_MAX_PM_SESSIONS EQU 3
  223. _QSV_MAX_VDM_SESSIONS EQU 4
  224. _QSV_BOOT_DRIVE EQU 5 ; 1=A, 2=B, etc.
  225. _QSV_DYN_PRI_VARIATION EQU 6 ; 0=Absolute, 1=Dynamic
  226. _QSV_MAX_WAIT EQU 7 ; seconds
  227. _QSV_MIN_SLICE EQU 8 ; milli seconds
  228. _QSV_MAX_SLICE EQU 9 ; milli seconds
  229. _QSV_PAGE_SIZE EQU 10
  230. _QSV_VERSION_MAJOR EQU 11
  231. _QSV_VERSION_MINOR EQU 12
  232. _QSV_VERSION_REVISION EQU 13 ; Revision letter
  233. endif
  234. ; end of msdos.inc
  235. ;-----------------------------------------------------------------------