Source code of Windows XP (NT5)
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.

337 lines
8.0 KiB

  1. page ,132
  2. if 0
  3. /*++
  4. Copyright (c) 1991 Microsoft Corporation
  5. Module Name:
  6. mailslot.asm
  7. Abstract:
  8. This module contains the resident code part of the stub redir TSR for NT
  9. VDM net support. The routines contained herein are the mailslot API stubs:
  10. DosDeleteMailslot
  11. DosMailslotInfo
  12. DosMakeMailslot
  13. DosPeekMailslot
  14. DosReadMailslot
  15. DosWriteMailslot
  16. Author:
  17. Richard L Firth (rfirth) 05-Sep-1991
  18. Environment:
  19. Dos mode only
  20. Revision History:
  21. 05-Sep-1991 rfirth
  22. Created
  23. --*/
  24. endif
  25. .xlist ; don't list these include files
  26. .xcref ; turn off cross-reference listing
  27. include dosmac.inc ; Break macro etc (for following include files only)
  28. include dossym.inc ; User_<Reg> defines
  29. include mult.inc ; MultNET
  30. include error.inc ; DOS errors - ERROR_INVALID_FUNCTION
  31. include syscall.inc ; DOS system call numbers
  32. include rdrint2f.inc ; redirector Int 2f numbers
  33. include segorder.inc ; segments
  34. include enumapis.inc ; dispatch codes
  35. include debugmac.inc ; DbgPrint macro
  36. include localmac.inc ; DbgPrint macro
  37. include rdrsvc.inc ; BOP and SVC macros/dispatch codes
  38. include sf.inc ; SFT definitions/structure
  39. .cref ; switch cross-reference back on
  40. .list ; switch listing back on
  41. subttl ; kill subtitling started in include file
  42. .286 ; all code in this module 286 compatible
  43. ResidentCodeStart
  44. assume cs:ResidentCode
  45. assume ds:nothing
  46. ; *** DosDeleteMailslot
  47. ; *
  48. ; * Delete a local mailslot. We must also pass in the current PDB. A
  49. ; * Dos process can only delete mailslots which it has previously
  50. ; * created. We pass the PDB in ax, since it only contains a dispatch
  51. ; * vector
  52. ; *
  53. ; * Function = 5F4Eh
  54. ; *
  55. ; * ENTRY BX = Mailslot handle
  56. ; *
  57. ; * EXIT CF = 1
  58. ; * AX = Error code
  59. ; *
  60. ; * CF = 0
  61. ; * ES:DI = Mailslot buffer address
  62. ; * DX = Mailslot selector
  63. ; *
  64. ; * RETURNS
  65. ; *
  66. ; * USES ax, dx, di, ds, es, flags
  67. ; *
  68. ; * ASSUMES nothing
  69. ; *
  70. ; ***
  71. public DosDeleteMailslot
  72. DosDeleteMailslot proc near
  73. push bx
  74. mov ah,51h
  75. int 21h ; get current PDB
  76. mov ax,bx ; ax := current PDB
  77. pop bx ; bx := mailslot handle
  78. SVC SVC_RDRDELETEMAILSLOT
  79. jc @f
  80. ;
  81. ; success - copy returned info in registers to copy of caller's registers in
  82. ; DOS segment
  83. ;
  84. DosCallBack GET_USER_STACK
  85. mov [si].User_Dx,dx
  86. mov [si].User_Es,es
  87. mov [si].User_Di,di
  88. clc
  89. @@: ret
  90. DosDeleteMailslot endp
  91. ; *** DosMailslotInfo
  92. ; *
  93. ; * Retrieves local mailslot info
  94. ; *
  95. ; * Function = 5F4Fh
  96. ; *
  97. ; * ENTRY BX = Mailslot handle
  98. ; *
  99. ; * EXIT CF = 1
  100. ; * AX = Error code
  101. ; *
  102. ; * CF = 0
  103. ; * AX = Message size
  104. ; * BX = Mailslot size
  105. ; * CX = Next size
  106. ; * DX = Next priority
  107. ; * SI = Message count
  108. ; *
  109. ; * USES ax, bx, cx, dx, si, ds, flags
  110. ; *
  111. ; * ASSUMES nothing
  112. ; *
  113. ; ***
  114. public DosMailslotInfo
  115. DosMailslotInfo proc near
  116. SVC SVC_RDRGETMAILSLOTINFO
  117. jc @f
  118. push si ; push returned values on stack
  119. push dx
  120. push cx
  121. push bx
  122. push ax
  123. DosCallBack GET_USER_STACK ; get caller register frame
  124. pop [si].User_Ax ; set caller's registers to returned values
  125. pop [si].User_Bx
  126. pop [si].User_Cx
  127. pop [si].User_Dx
  128. pop [si].User_Si
  129. clc
  130. @@: ret
  131. DosMailslotInfo endp
  132. ; *** DosMakeMailslot
  133. ; *
  134. ; * Creates a local mailslot. We need to pass in the current PDB as a
  135. ; * process identifier (see DosDeleteMailslot). We use ax since this only
  136. ; * contains a dispatch vector
  137. ; *
  138. ; * Function = 5F4Dh
  139. ; *
  140. ; * ENTRY DS:SI = ASCIZ Name of mailslot to create
  141. ; * BX = Message size (hint)
  142. ; * CX = Mailslot size (hint)
  143. ; * DX = Mailslot selector (for WIN 3 protect mode)
  144. ; * ES:DI = User's data buffer
  145. ; *
  146. ; * EXIT CF = 1
  147. ; * AX = Error code
  148. ; *
  149. ; * CF = 0
  150. ; * AX = Mailslot handle
  151. ; *
  152. ; * USES ax, flags
  153. ; *
  154. ; * ASSUMES nothing
  155. ; *
  156. ; ***
  157. public DosMakeMailslot
  158. DosMakeMailslot proc near
  159. push bx
  160. mov ah,51h
  161. int 21h ; get current PDB
  162. mov ax,bx ; ax := current PDB
  163. pop bx ; bx := mailslot size
  164. if 0
  165. if DEBUG
  166. DbgPrintString "DosMakeMailslot: ax="
  167. DbgPrintHexWord ax
  168. DbgPrintString <13,10," Message size (bx) =">, NO_BANNER
  169. DbgPrintHexWord bx
  170. DbgPrintString <13,10," Mailslot size (cx) =">, NO_BANNER
  171. DbgPrintHexWord cx
  172. DbgPrintString <13,10," Mailslot selector (dx) =">, NO_BANNER
  173. DbgPrintHexWord dx
  174. DbgPrintString <13,10," User buffer (es:di) =">, NO_BANNER
  175. DbgPrintHexWord es
  176. DbgPrintString ":", NO_BANNER
  177. DbgPrintHexWord di
  178. DbgPrintString <13,10>,NO_BANNER
  179. endif
  180. endif
  181. SVC SVC_RDRMAKEMAILSLOT
  182. ret
  183. DosMakeMailslot endp
  184. ; *** DosPeekMailslot
  185. ; *
  186. ; * Reads a message from a mailslot non-destructively
  187. ; *
  188. ; * Function = 5F51h
  189. ; *
  190. ; * ENTRY BX = Mailslot handle
  191. ; * ES:DI = Buffer address
  192. ; *
  193. ; * EXIT CF = 1
  194. ; * AX = Error code
  195. ; *
  196. ; * CF = 0
  197. ; * AX = Bytes read
  198. ; * CX = Next size
  199. ; * DX = Next priority
  200. ; *
  201. ; * USES ax, cx, dx, si, ds, flags
  202. ; *
  203. ; * ASSUMES nothing
  204. ; *
  205. ; ***
  206. public DosPeekMailslot
  207. DosPeekMailslot proc near
  208. SVC SVC_RDRPEEKMAILSLOT
  209. jmp short common_peek_read ; jump to common read/peek processing
  210. DosPeekMailslot endp
  211. ; *** DosReadMailslot
  212. ; *
  213. ; * Reads the next message from a mailslot
  214. ; *
  215. ; * Function = 5F50h
  216. ; *
  217. ; * ENTRY BX = Mailslot handle
  218. ; * ES:DI = Buffer address
  219. ; * DX:CX = Timeout (mSec)
  220. ; *
  221. ; * EXIT CF = 1
  222. ; * AX = Error code
  223. ; *
  224. ; * CF = 0
  225. ; * AX = Bytes read
  226. ; * CX = NextSize
  227. ; * DX = NextPriorty
  228. ; *
  229. ; * USES ax, cx, dx, si, ds, flags
  230. ; *
  231. ; * ASSUMES nothing
  232. ; *
  233. ; ***
  234. public DosReadMailslot
  235. DosReadMailslot proc near
  236. SVC SVC_RDRREADMAILSLOT
  237. ;
  238. ; common read/peek mailslot code - if error return else copy following values
  239. ; returned in registers to caller's registers in DOS stack segment
  240. ;
  241. common_peek_read:
  242. jc @f ; error - return
  243. push dx
  244. push cx
  245. push ax
  246. DosCallBack GET_USER_STACK
  247. pop [si].User_Ax ; # bytes read
  248. pop [si].User_Cx ; byte size of next message
  249. pop [si].User_Dx ; priority of next message
  250. clc ; indicate success
  251. @@: ret
  252. DosReadMailslot endp
  253. ; *** DosWriteMailslot
  254. ; *
  255. ; * Writes a message to a mailslot. The mailslot is identified by a
  256. ; * symbolic name (even if its local)
  257. ; *
  258. ; * Function = 5F52h
  259. ; *
  260. ; * ENTRY DS:SI = Destination mailslot name
  261. ; * ES:DI = Pointer to DosWriteMailslotStruct:
  262. ; * DWORD Timeout
  263. ; * char far* Buffer
  264. ; * CX = Number of bytes in buffer
  265. ; * DX = Message priority
  266. ; * BX = Message class
  267. ; *
  268. ; * EXIT CF = 1
  269. ; * AX = Error code
  270. ; *
  271. ; * CF = 0
  272. ; * No error
  273. ; *
  274. ; * USES ax, flags
  275. ; *
  276. ; * ASSUMES nothing
  277. ; *
  278. ; ***
  279. public DosWriteMailslot
  280. DosWriteMailslot proc near
  281. SVC SVC_RDRWRITEMAILSLOT
  282. ret
  283. DosWriteMailslot endp
  284. ResidentCodeEnd
  285. end
  286.