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.

258 lines
10 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. ; SCCSID = @(#)comequ.asm 1.1 85/05/14
  7. ; SCCSID = @(#)comequ.asm 1.1 85/05/14
  8. ;*************************************
  9. ; COMMAND EQUs which are not switch dependant
  10. include curdir.inc ; to get DIRSTRLEN
  11. ; Note dossym.inc must already have been included!
  12. EMGDEBUG = FALSE
  13. SYM EQU ">"
  14. ifdef JAPAN
  15. LINESPERPAGE EQU 24
  16. else ; if Not JAPAN
  17. LINESPERPAGE EQU 25 ;AC000; default lines per page
  18. endif
  19. NORMPERLIN EQU 1
  20. WIDEPERLIN EQU 5
  21. COMBUFLEN EQU 128 ; Length of commmand buffer
  22. EXECPATHLEN EQU 273 ; MAX_PATH+13 (expanded for ntvdm)
  23. BatLen EQU 32 ; buffer for batch files
  24. YES_ECHO EQU 1 ; echo line
  25. NO_ECHO EQU 0 ; don't echo line
  26. No_Echo_Char EQU "@" ; don't echo line if this is first char
  27. call_in_progress EQU 1 ; indicate we're in the CALL command
  28. length_call EQU 4 ; length of CALL
  29. max_nest EQU 10 ; max # levels of batch nesting allowed
  30. fail_allowed EQU 00001000b ; critical error
  31. retry_allowed EQU 00010000b ; critical error
  32. Ignore_allowed EQU 00100000b ; critical error
  33. nullcommand EQU 1 ; no command on command line
  34. end_of_line EQU -1 ;AN000; end of line return from parser
  35. end_of_line_out EQU 0 ;AN000; end of line for output
  36. end_of_line_in EQU 0dh ;AN000; end of line for input
  37. result_number EQU 1 ;AN000; number returned from parser
  38. result_string EQU 3 ;AN000; string returned from parser
  39. result_filespec EQU 5 ;AN000; filespec returned from parser
  40. result_drive EQU 6 ;AN000; drive returned from parser
  41. result_date EQU 7 ;AN000; date returned from parser
  42. result_time EQU 8 ;AN000; time returned from parser
  43. result_no_error EQU 0 ;AN000; no error returned from parser
  44. no_cont_flag EQU 0 ;AN000; no control flags for message
  45. util_msg_class EQU -1 ;AN000; message class for utility
  46. ext_msg_class EQU 1 ;AN000; message class for extended error
  47. parse_msg_class EQU 2 ;AN000; message class for parse error
  48. crit_msg_class EQU 3 ;AN000; message class for critical error
  49. ext_crlf_class EQU 081h ;AN054; message class for extended error with no CRLF
  50. colon_char EQU ":" ;AN000; colon character
  51. crt_ioctl_ln EQU 14 ;AN000; default length of data for display ioctl
  52. text_mode EQU 1 ;AN000; text mode return from ioctl
  53. get_generic EQU 07Fh ;AN000; generic ioctl - get device info
  54. set_crit_dev EQU 0100H ;AN000; device attribute for critical error on I/0
  55. mult_ansi EQU 01Ah ;AC064; multiplex for ansi.sys
  56. mult_shell_get EQU 01902h ;AC065; multiplex for Shell - get next command
  57. mult_shell_brk EQU 01903h ;AN000; multiplex for Shell - ^C batch check
  58. shell_action equ 0ffh ;AN000; SHELL - return for taking SHELL specific action
  59. bat_not_open EQU -1 ;AN000; batch handle will be set to this if not open
  60. bat_open_handle EQU 19 ;AN000; handle will be in this position in JFN table
  61. Ptr_seg_pos equ 7 ;AN000; Offset from start of message block for subst segment
  62. Ptr_off_pos equ 5 ;AN000; Offset from start of message block for subst offset
  63. Parm_off_pos equ word ptr 2 ;AN000; Offset from start of subst list for subst offset
  64. parm_block_size equ 11 ;AN000; size of message subst block
  65. blank equ " " ;AN000; blank character
  66. no_subst equ 0 ;AN000; no substitutions for messages
  67. one_subst equ 1 ;AN000; one substitution for messages
  68. no_handle_out equ -1 ;AN000; use function 1 thru 12 for message retriever
  69. res_subst equ 2 ;AN000; offset from start of message definition to number of subst
  70. read_open_mode equ 0000000000000000b ;AN024; extended open mode for read
  71. deny_write equ 0000000000100000b ; deny write sharing mode ;M031
  72. deny_none equ 0000000001000000b ; deny none sharing mode ;Myyy
  73. read_open_flag equ 0000000100000001b ;AN000; extended open flags for read
  74. write_open_mode equ 0000000000000001b ;AN024; extended open mode for read
  75. write_open_flag equ 0000000100000001b ;AN000; extended open flags for read
  76. creat_open_flag equ 0000000100010010b ;AN000; extended open flags for read
  77. capital_A equ 'A' ;AC000;
  78. vbar equ '|' ;AC000;
  79. labracket equ '<' ;AC000;
  80. rabracket equ '>' ;AC000;
  81. dollar equ '$' ;AC000;
  82. lparen equ '(' ;AC000;
  83. rparen equ ')' ;AC000;
  84. nullrparen equ 29h ;AC000;
  85. in_word equ 4e49h ;AC000; 'NI' ('IN' backwards)
  86. do_word equ 4f44h ;AC000; 'OD' ('DO' backwards)
  87. star equ '*' ;AC000;
  88. plus_chr equ '+' ;AC000;
  89. small_a equ 'a' ;AC000;
  90. small_z equ 'z' ;AC000;
  91. dot_chr equ '.' ;AC000;
  92. tab_chr equ 9 ;AN032;
  93. equal_chr equ '=' ;AN032;
  94. semicolon equ ';' ;AN049;
  95. dot_qmark equ 2e3fh ;AC000; '.?'
  96. dot_colon equ 2e3ah ;AC000; '.:'
  97. capital_n equ 0 ;AC000; result from Y/N call if N entered
  98. capital_y equ 1 ;AC000; result from Y/N call if Y entered
  99. AppendInstall equ 0B700H ;AN020; append install check
  100. AppendDOS equ 0B702H ;AN020; append DOS version check
  101. AppendGetState equ 0B706H ;AN020; append get current state
  102. AppendSetState equ 0B707H ;AN020; append set current state
  103. AppendTruename equ 0B711H ;AN042; Get file's real location for Batch
  104. search_attr equ attr_read_only+attr_hidden+attr_directory ;AC042;
  105. ;*************************************
  106. ;* PARSE ERROR MESSAGES
  107. ;*************************************
  108. MoreArgs_Ptr equ 1 ;AN000;"Too many parameters" message number
  109. LessArgs_Ptr equ 2 ;AN000;"Required parameter missing" message number
  110. BadSwt_Ptr equ 3 ;AN000;"Invalid switch" message number
  111. BadParm_Ptr equ 10 ;AN000;"Invalid parameter" message number
  112. ;*************************************
  113. ;* EQUATES FOR MESSAGE RETRIEVER
  114. ;*************************************
  115. GET_EXTENDED_MSG EQU 0 ;AN000; get extended message address
  116. SET_EXTENDED_MSG EQU 1 ;AN000; set extended message address
  117. GET_PARSE_MSG EQU 2 ;AN000; get parse message address
  118. SET_PARSE_MSG EQU 3 ;AN000; set parse message address
  119. GET_CRITICAL_MSG EQU 4 ;AN000; get critical message address
  120. SET_CRITICAL_MSG EQU 5 ;AN000; set critical message address
  121. MESSAGE_2F EQU 46 ;AN000; minor code for message retriever
  122. ;*********************************
  123. ;* EQUATES FOR INT 10H
  124. ;*********************************
  125. VIDEO_IO_INT EQU 10H ;AN000; equate for int 10h
  126. SET_VIDEO_MODE EQU 0 ;AN000; set video mode
  127. SET_CURSOR_POSITION EQU 2 ;AN000; set new cursor position
  128. SCROLL_VIDEO_PAGE EQU 6 ;AN000; scroll active page up
  129. VIDEO_ATTRIBUTE EQU 7 ;AN000; attribute to be used on blank line
  130. SET_COLOR_PALETTE EQU 11 ;AN000; set color for video
  131. GET_VIDEO_STATE EQU 15 ;AN000; get current video state
  132. VIDEO_ALPHA EQU 3 ;AN000; alpha video is 3 or below
  133. VIDEO_BW EQU 7 ;AN000; mode for 80X25 black & white
  134. AltPipeChr equ "|" ; alternate pipe character
  135. FCB EQU 5CH
  136. VARSTRUC STRUC
  137. ISDIR DB ?
  138. SIZ DB ?
  139. TTAIL DW ?
  140. INFO DB ?
  141. BUF DB DIRSTRLEN + 20 DUP (?)
  142. VARSTRUC ENDS
  143. ;
  144. ; Flags for internal command parsing
  145. ;
  146. fCheckDrive equ 00000001b ; validate drive letter
  147. fSwitchAllowed equ 00000010b ; switches allowed
  148. fLimitHelp equ 00000100b ; /? must appear alone
  149. ;
  150. ; Test switches
  151. ;
  152. fParse EQU 0001h ; display results of parseline
  153. ;
  154. ; Batch segment structure
  155. ;
  156. ; BYTE type of segment
  157. ; BYTE echo state of parent on entry to batch file
  158. ; WORD segment of last batch file
  159. ; WORD segment for FOR command
  160. ; BYTE FOR flag state on entry to batch file
  161. ; DWORD offset for next line
  162. ; 10 WORD pointers to parameters. -1 is empty parameter
  163. ; ASCIZ file name (with . and ..)
  164. ; BYTES CR-terminated parameters
  165. ; BYTE 0 flag to indicate end of parameters
  166. ;
  167. BatchType equ 0
  168. BatchSegment struc
  169. BatType DB BatchType ; signature
  170. Batechoflag DB 0 ; G state of echo
  171. BatchEOF DB 0 ;records if EOF reached on file
  172. Batlast DW 0 ; G segment of last batch file
  173. Batforptr DW 0 ; G segment for FOR command
  174. Batforflag DB 0 ; G state of FOR
  175. BatSeek DD ? ; lseek position of next char
  176. BatParm DW 10 dup (?) ; pointers to parameters
  177. BatFile DB ? ; beginning of batch file name
  178. BatchSegment ends
  179. ANULL equ 0 ; terminates an argv string
  180. ARGMAX equ 64 ; max args on a command line
  181. ARGBLEN equ 2*128 ; 1char each plus term NUL
  182. tplen equ 64 ; max size of one argument
  183. arg_cnt_error equ 1 ; number of args > MAXARG
  184. arg_buf_ovflow equ 2 ; overflowed argbuffer
  185. argv_ele STRUC ; elements in the argv array
  186. argpointer DW (?) ; pointer to the argstring
  187. argflags DB (?) ; cparse flags for this argstring
  188. argstartel DW (?) ; the result of cparse's [STARTEL]
  189. arglen DW (?) ; cparse's char count + one (for null)
  190. argsw_word DW (?) ; any switches after this? what kinds?
  191. arg_ocomptr DW (?) ; pointer into original command string
  192. argv_ele ENDS
  193. arg_unit STRUC
  194. argv DB (ARGMAX * SIZE argv_ele) DUP (?)
  195. argvcnt DW (?) ; number of arguments
  196. argswinfo DW (?) ; Switch information for entire line
  197. argbuf DW ARGBLEN DUP (?) ; storage for argv strings
  198. argforcombuf db COMBUFLEN DUP (?) ; Original for loop command string
  199. arg_unit ENDS
  200. parseflags RECORD special_delim:1, unused:4, path_sep:1, wildcard:1, sw_flag:1
  201. SwitchQues EQU 20h
  202. SwitchV EQU 10h
  203. SwitchB EQU 08h
  204. SwitchA EQU 04h
  205. SwitchP EQU 02h
  206. SwitchW EQU 01h
  207. fSwitch EQU 8000h
  208. fBadSwitch EQU 4000h
  209. SwitchDir EQU SwitchP + SwitchW + fSwitch
  210. SwitchCopy EQU SwitchV + SwitchA + SwitchB + fSwitch
  211. break <Trap: Get the attention of MSDOS>
  212. ; TRAP snares the operating system for a service call
  213. ; AX, as well as any other registers MS-DOS takes a fancy to, will be crunched.
  214. trap MACRO dos_function,dos_info
  215. ifnb <dos_info>
  216. mov AX, (dos_function SHL 8) + dos_info
  217. else
  218. mov AX, (dos_function SHL 8)
  219. endif
  220. int 21h
  221. ENDM
  222. ;
  223. ; Equates for initialization
  224. ;
  225. initInit equ 01h ; initialization in progress
  226. initSpecial equ 02h ; in initialization time/date routine
  227. initCtrlC equ 04h ; already in ^C handler
  228. ;M052 BETA3WARN equ 1 ; Yank anything related to this EQU
  229. ; out before we ship
  230.