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.

501 lines
9.4 KiB

  1. ;
  2. ; WINNET.ASM
  3. ;
  4. ; Access to WINNET calls via user
  5. ;
  6. ;
  7. memS=1
  8. ?WIN=1
  9. ?PLM=1
  10. .xlist
  11. include cmacros.inc
  12. .list
  13. WN_SUCCESS equ 0
  14. WN_NOT_SUPPORTED equ 1 ; returned if no function exported
  15. ;
  16. ; Network information structure, containing the
  17. ; list of driver entrypoints
  18. ;
  19. netinfo struc
  20. lpfnOpenJob dd ? ; @1
  21. lpfnCloseJob dd ? ; @2
  22. lpfnAbortJob dd ? ; @3
  23. lpfnHoldJob dd ? ; @4
  24. lpfnReleaseJob dd ? ; @5
  25. lpfnCancelJob dd ? ; @6
  26. lpfnSetJobCopies dd ? ; @7
  27. lpfnWatchQueue dd ? ; @8
  28. lpfnUnwatchQueue dd ? ; @9
  29. lpfnLockQueueData dd ? ; @10
  30. lpfnUnlockQueueData dd ? ; @11
  31. lpfnGetConnection dd ? ; @12
  32. lpfnGetCaps dd ? ; @13
  33. lpfnDeviceMode dd ? ; @14
  34. lpfnBrowseDialog dd ? ; @15
  35. lpfnGetUser dd ? ; @16
  36. lpfnAddConnection dd ? ; @17
  37. lpfnCancelConnection dd ? ; @18
  38. lpfnGetError dd ? ; @19
  39. lpfnGetErrorText dd ? ; @20
  40. lpfnEnable dd ? ; @21
  41. lpfnDisable dd ? ; @22
  42. lpfnRestoreConnection dd ? ; @23
  43. lpfnWriteJob dd ? ; @24
  44. lpfnConnectDialog dd ? ; @25
  45. lpfnDisconnectDialog dd ? ; @26
  46. lpfnConnectionDialog dd ? ; @27
  47. lpfnViewQueueDialog dd ? ; @28
  48. lpfnPropertyDialog dd ? ; @29
  49. lpfnGetDirectoryType dd ? ; @30
  50. lpfnDirectoryNotify dd ? ; @31
  51. lpfnGetPropertyText dd ? ; @32
  52. netinfo ends
  53. createSeg _%SEGNAME,cd,word,public,CODE
  54. sBegin data
  55. pNetInfo dw 0 ; near pointer to network information
  56. public pNetInfo
  57. hWinnetDriver dw 0 ; handle to driver module
  58. public hWinnetDriver
  59. sEnd data
  60. sBegin cd
  61. assumes cs,cd
  62. assumes es,data
  63. ;-----------------------
  64. ; NetCall
  65. ;
  66. ; Move the offset of the function pointer in the net info structure, and
  67. ; call the function which does the bulk of the work (near call). If the
  68. ; call runs into an error, it will return, otherwise, it will not return,
  69. ; it will pop the return address and jump to the net driver. No prologue
  70. ; or epilogue needs to be generated. If CallNetDriver returns, though,
  71. ; we need to pop the parameters off the stack. In cMacros, the size of
  72. ; these parameters is stored in the ?po variable.
  73. ;
  74. ; ?po gets set to zero in order to avoid a WHOLE LOT of "possible invalid
  75. ; use of nogen" warning messages.
  76. ;
  77. ; Realize that this is, after all, a hack, the purpose of which is to
  78. ; reduce code.
  79. ;
  80. NetCall macro lpfn
  81. __pop = ?po
  82. ?po = 0
  83. &cBegin <nogen>
  84. mov bx,lpfn
  85. call CallNetDriver
  86. ret __pop
  87. &cEnd <nogen>
  88. endm
  89. ;--------------------------------------------------------------------------
  90. ; CallNetDriver
  91. ;
  92. ; This function does all the work. For each entry point there is a small
  93. ; piece of code which loads the offset of the function pointer in the net
  94. ; info structure into SI and calls this function. This function verifies
  95. ; that the net driver is loaded and calls the appropriate function
  96. ;
  97. LabelFP <PUBLIC, FarCallNetDriver>
  98. CallNetDriver proc near
  99. mov ax,_DATA
  100. mov es,ax
  101. cmp es:pNetInfo,0 ; net driver loaded?
  102. jz cnd_error ; return error code
  103. add bx,es:pNetInfo ; add the base of the table
  104. cmp word ptr es:[bx+2],0 ; is there a segment there?
  105. jz cnd_error ; NULL, return error code
  106. pop ax ; remove near return address
  107. jmp dword ptr es:[bx] ; jump into net driver
  108. cnd_error:
  109. mov ax,WN_NOT_SUPPORTED ; return error code
  110. ret ; return to entry point code
  111. CallNetDriver endp
  112. ;--------------
  113. ; WNetGetCaps
  114. ;
  115. ; This function returns a bitfield of supported functions rather than an
  116. ; error code, so we return 0 (no functions supported) instead of an error
  117. ; code if there is no driver GetCaps function to call. Also, hack to get
  118. ; handle for index -1.
  119. ;
  120. cProc WNetGetCaps2, <FAR,PUBLIC>
  121. parmW nIndex
  122. cBegin <nogen>
  123. mov bx,lpfnGetCaps
  124. call CallNetDriver
  125. xor ax,ax
  126. ret ?po
  127. cEnd <nogen>
  128. if 0
  129. ; this is now in C (net.c)
  130. assumes ds,data
  131. cProc IWNetGetCaps, <FAR,PUBLIC, NODATA>
  132. parmW nIndex
  133. cBegin
  134. cmp nIndex, 0FFFFh
  135. jz gc_gethandle
  136. cCall WNetGetCaps2, <nIndex>
  137. jmp short gc_exit
  138. gc_gethandle:
  139. mov ax, _DATA
  140. mov es, ax
  141. assumes es, DATA
  142. mov ax, es:hWinnetDriver
  143. assumes es, NOTHING
  144. gc_exit:
  145. cEnd
  146. assumes ds,nothing
  147. endif
  148. ;--------------
  149. ; IWNetGetUser
  150. ;
  151. cProc IWNetGetUser, <FAR,PUBLIC, NODATA>
  152. parmD szUser
  153. parmD lpBufferSize
  154. NetCall lpfnGetUser
  155. ;--------------------
  156. ; IWNetAddConnection
  157. ;
  158. cProc IWNetAddConnection , <FAR, PUBLIC, NODATA>
  159. parmD szNetPath
  160. parmD szPassword
  161. parmD szLocalName
  162. NetCall lpfnAddConnection
  163. ;-----------------------
  164. ; IWNetCancelConnection
  165. ;
  166. cProc IWNetCancelConnection , <FAR, PUBLIC, NODATA>
  167. parmD szName
  168. parmW fForce
  169. NetCall lpfnCancelConnection
  170. ;---------------------
  171. ; IWNetGetConnection
  172. ;
  173. cProc IWNetGetConnection , <FAR, PUBLIC, NODATA>
  174. parmD lpszLocalName
  175. parmD lpszRemoteName
  176. parmD lpcbBuffer
  177. NetCall lpfnGetConnection
  178. ;--------------------
  179. ; IWNetOpenJob
  180. ;
  181. cProc IWNetOpenJob , <FAR, PUBLIC, NODATA>
  182. parmD szQueue
  183. parmD szJobTitle
  184. parmW nCopies
  185. parmD lpfh
  186. NetCall lpfnOpenJob
  187. ;--------------------
  188. ; IWNetCloseJob
  189. ;
  190. cProc IWNetCloseJob , <FAR, PUBLIC, NODATA>
  191. parmW fh
  192. parmD lpidJob
  193. parmD szQueue
  194. NetCall lpfnCloseJob
  195. ;-----------------
  196. ; IWNetHoldJob
  197. ;
  198. cProc IWNetHoldJob , <FAR, PUBLIC, NODATA>
  199. parmD szQueue
  200. parmW idJob
  201. NetCall lpfnHoldJob
  202. ;--------------------
  203. ; IWNetReleaseJob
  204. ;
  205. cProc IWNetReleaseJob , <FAR, PUBLIC, NODATA>
  206. parmD szQueue
  207. parmW idJob
  208. NetCall lpfnReleaseJob
  209. ;---------------------
  210. ; IWNetCancelJob
  211. ;
  212. cProc IWNetCancelJob , <FAR, PUBLIC, NODATA>
  213. parmD szQueue
  214. parmW idJob
  215. NetCall lpfnCancelJob
  216. ;--------------------
  217. ; IWNetSetJobCopies
  218. ;
  219. cProc IWNetSetJobCopies , <FAR, PUBLIC, NODATA>
  220. parmD szQueue
  221. parmW idJob
  222. parmW nCopies
  223. NetCall lpfnSetJobCopies
  224. ;--------------------
  225. ; IWNetDeviceMode
  226. ;
  227. cProc IWNetDeviceMode , <FAR, PUBLIC, NODATA>
  228. parmW hwnd
  229. NetCall lpfnDeviceMode
  230. ;--------------------
  231. ; IWNetBrowseDialog
  232. ;
  233. cProc IWNetBrowseDialog , <FAR, PUBLIC, NODATA>
  234. parmW hwnd
  235. parmW nFunction
  236. parmD szPath
  237. parmD lpnSize
  238. NetCall lpfnBrowseDialog
  239. ;--------------------
  240. ; IWNetWatchQueue
  241. ;
  242. cProc IWNetWatchQueue , <FAR, PUBLIC, NODATA>
  243. parmW hwnd
  244. parmD szLocal
  245. parmD szUsername
  246. parmW wIndex
  247. NetCall lpfnWatchQueue
  248. ;--------------------
  249. ; IWNetUnwatchQueue
  250. ;
  251. cProc IWNetUnwatchQueue , <FAR,PUBLIC, NODATA>
  252. parmD szQueue
  253. NetCall lpfnUnwatchQueue
  254. ;---------------------
  255. ; IWNetLockQueueData
  256. ;
  257. cProc IWNetLockQueueData , <FAR, PUBLIC, NODATA>
  258. parmD szQueue
  259. parmD szUsername
  260. parmD lplpQueue
  261. NetCall lpfnLockQueueData
  262. ;------------------------
  263. ; IWNetUnlockQueueData
  264. ;
  265. cProc IWNetUnlockQueueData , <FAR, PUBLIC, NODATA>
  266. parmD szQueue
  267. NetCall lpfnUnlockQueueData
  268. ;------------------------
  269. ; IWNetGetError
  270. ;
  271. cProc IWNetGetError , <FAR, PUBLIC, NODATA>
  272. parmD lpnError
  273. NetCall lpfnGetError
  274. ;------------------------
  275. ; IWNetGetErrorText
  276. ;
  277. cProc IWNetGetErrorText , <FAR, PUBLIC, NODATA>
  278. parmW nError
  279. parmD lpBuffer
  280. parmD lpnSize
  281. NetCall lpfnGetErrorText
  282. ;----------------------
  283. ; IWNetAbortJob
  284. ;
  285. cProc IWNetAbortJob , <FAR, PUBLIC, NODATA>
  286. parmD lpszQueue
  287. parmW fh
  288. NetCall lpfnAbortJob
  289. ;-----------------------
  290. ; WNetEnable
  291. ;
  292. cProc WNetEnable, <FAR, PUBLIC, EXPORTED>
  293. NetCall lpfnEnable
  294. ;------------------------
  295. ; WNetDisable
  296. ;
  297. cProc WNetDisable, <FAR, PUBLIC, EXPORTED>
  298. NetCall lpfnDisable
  299. ;-----------------------
  300. ; WNetWriteJob
  301. ;
  302. cProc WNetWriteJob , <FAR, PUBLIC, EXPORTED>
  303. parmW hJob
  304. parmD lpData
  305. parmD lpcb
  306. NetCall lpfnWriteJob
  307. ;-----------------------
  308. ; WNetConnectDialog
  309. ;
  310. cProc WNetConnectDialog, <FAR, PUBLIC, EXPORTED>
  311. parmW hwnd
  312. parmW iType
  313. NetCall lpfnConnectDialog
  314. ;-----------------------
  315. ; WNetDisconnectDialog
  316. ;
  317. cProc WNetDisconnectDialog, <FAR, PUBLIC, EXPORTED>
  318. parmW hwnd
  319. parmW iType
  320. NetCall lpfnDisconnectDialog
  321. ;-------------------------
  322. ; WNetConnectionDialog
  323. ;
  324. cProc WNetConnectionDialog, <FAR, PUBLIC, EXPORTED>
  325. parmW hwnd
  326. parmW iType
  327. NetCall lpfnConnectionDialog
  328. ;---------------------------
  329. ; WNetViewQueueDialog
  330. ;
  331. cProc WNetViewQueueDialog, <FAR, PUBLIC, EXPORTED>
  332. parmW hwnd
  333. parmD lpdev
  334. NetCall lpfnViewQueueDialog
  335. ;--------------------------
  336. ; WNetGetPropertyText
  337. ;
  338. cProc WNetGetPropertyText, <FAR, PUBLIC, EXPORTED>
  339. parmW iDlg
  340. parmD lpName
  341. parmW cb
  342. NetCall lpfnGetPropertyText
  343. ;--------------------------
  344. ; WNetPropertyDialog
  345. ;
  346. cProc WNetPropertyDialog, <FAR, PUBLIC, EXPORTED>
  347. parmW hwnd
  348. parmW iDlg
  349. parmD lpfile
  350. NetCall lpfnPropertyDialog
  351. ;---------------------------
  352. ; WNetGetDirectoryType
  353. ;
  354. cProc WNetGetDirectoryType, <FAR, PUBLIC, EXPORTED>
  355. parmD lpdir
  356. parmD lptype
  357. NetCall lpfnGetDirectoryType
  358. ;--------------------------
  359. ; WNetDirectoryNotify
  360. ;
  361. cProc WNetDirectoryNotify, <FAR, PUBLIC, EXPORTED>
  362. parmW hwnd
  363. parmD lpdir
  364. parmW wOper
  365. NetCall lpfnDirectoryNotify
  366. sEnd cd
  367. end