; ; WINNET.ASM ; ; Access to WINNET calls via user ; ; memS=1 ?WIN=1 ?PLM=1 .xlist include cmacros.inc .list WN_SUCCESS equ 0 WN_NOT_SUPPORTED equ 1 ; returned if no function exported ; ; Network information structure, containing the ; list of driver entrypoints ; netinfo struc lpfnOpenJob dd ? ; @1 lpfnCloseJob dd ? ; @2 lpfnAbortJob dd ? ; @3 lpfnHoldJob dd ? ; @4 lpfnReleaseJob dd ? ; @5 lpfnCancelJob dd ? ; @6 lpfnSetJobCopies dd ? ; @7 lpfnWatchQueue dd ? ; @8 lpfnUnwatchQueue dd ? ; @9 lpfnLockQueueData dd ? ; @10 lpfnUnlockQueueData dd ? ; @11 lpfnGetConnection dd ? ; @12 lpfnGetCaps dd ? ; @13 lpfnDeviceMode dd ? ; @14 lpfnBrowseDialog dd ? ; @15 lpfnGetUser dd ? ; @16 lpfnAddConnection dd ? ; @17 lpfnCancelConnection dd ? ; @18 lpfnGetError dd ? ; @19 lpfnGetErrorText dd ? ; @20 lpfnEnable dd ? ; @21 lpfnDisable dd ? ; @22 lpfnRestoreConnection dd ? ; @23 lpfnWriteJob dd ? ; @24 lpfnConnectDialog dd ? ; @25 lpfnDisconnectDialog dd ? ; @26 lpfnConnectionDialog dd ? ; @27 lpfnViewQueueDialog dd ? ; @28 lpfnPropertyDialog dd ? ; @29 lpfnGetDirectoryType dd ? ; @30 lpfnDirectoryNotify dd ? ; @31 lpfnGetPropertyText dd ? ; @32 netinfo ends createSeg _%SEGNAME,cd,word,public,CODE sBegin data pNetInfo dw 0 ; near pointer to network information public pNetInfo hWinnetDriver dw 0 ; handle to driver module public hWinnetDriver sEnd data sBegin cd assumes cs,cd assumes es,data ;----------------------- ; NetCall ; ; Move the offset of the function pointer in the net info structure, and ; call the function which does the bulk of the work (near call). If the ; call runs into an error, it will return, otherwise, it will not return, ; it will pop the return address and jump to the net driver. No prologue ; or epilogue needs to be generated. If CallNetDriver returns, though, ; we need to pop the parameters off the stack. In cMacros, the size of ; these parameters is stored in the ?po variable. ; ; ?po gets set to zero in order to avoid a WHOLE LOT of "possible invalid ; use of nogen" warning messages. ; ; Realize that this is, after all, a hack, the purpose of which is to ; reduce code. ; NetCall macro lpfn __pop = ?po ?po = 0 &cBegin mov bx,lpfn call CallNetDriver ret __pop &cEnd endm ;-------------------------------------------------------------------------- ; CallNetDriver ; ; This function does all the work. For each entry point there is a small ; piece of code which loads the offset of the function pointer in the net ; info structure into SI and calls this function. This function verifies ; that the net driver is loaded and calls the appropriate function ; LabelFP CallNetDriver proc near mov ax,_DATA mov es,ax cmp es:pNetInfo,0 ; net driver loaded? jz cnd_error ; return error code add bx,es:pNetInfo ; add the base of the table cmp word ptr es:[bx+2],0 ; is there a segment there? jz cnd_error ; NULL, return error code pop ax ; remove near return address jmp dword ptr es:[bx] ; jump into net driver cnd_error: mov ax,WN_NOT_SUPPORTED ; return error code ret ; return to entry point code CallNetDriver endp ;-------------- ; WNetGetCaps ; ; This function returns a bitfield of supported functions rather than an ; error code, so we return 0 (no functions supported) instead of an error ; code if there is no driver GetCaps function to call. Also, hack to get ; handle for index -1. ; cProc WNetGetCaps2, parmW nIndex cBegin mov bx,lpfnGetCaps call CallNetDriver xor ax,ax ret ?po cEnd if 0 ; this is now in C (net.c) assumes ds,data cProc IWNetGetCaps, parmW nIndex cBegin cmp nIndex, 0FFFFh jz gc_gethandle cCall WNetGetCaps2, jmp short gc_exit gc_gethandle: mov ax, _DATA mov es, ax assumes es, DATA mov ax, es:hWinnetDriver assumes es, NOTHING gc_exit: cEnd assumes ds,nothing endif ;-------------- ; IWNetGetUser ; cProc IWNetGetUser, parmD szUser parmD lpBufferSize NetCall lpfnGetUser ;-------------------- ; IWNetAddConnection ; cProc IWNetAddConnection , parmD szNetPath parmD szPassword parmD szLocalName NetCall lpfnAddConnection ;----------------------- ; IWNetCancelConnection ; cProc IWNetCancelConnection , parmD szName parmW fForce NetCall lpfnCancelConnection ;--------------------- ; IWNetGetConnection ; cProc IWNetGetConnection , parmD lpszLocalName parmD lpszRemoteName parmD lpcbBuffer NetCall lpfnGetConnection ;-------------------- ; IWNetOpenJob ; cProc IWNetOpenJob , parmD szQueue parmD szJobTitle parmW nCopies parmD lpfh NetCall lpfnOpenJob ;-------------------- ; IWNetCloseJob ; cProc IWNetCloseJob , parmW fh parmD lpidJob parmD szQueue NetCall lpfnCloseJob ;----------------- ; IWNetHoldJob ; cProc IWNetHoldJob , parmD szQueue parmW idJob NetCall lpfnHoldJob ;-------------------- ; IWNetReleaseJob ; cProc IWNetReleaseJob , parmD szQueue parmW idJob NetCall lpfnReleaseJob ;--------------------- ; IWNetCancelJob ; cProc IWNetCancelJob , parmD szQueue parmW idJob NetCall lpfnCancelJob ;-------------------- ; IWNetSetJobCopies ; cProc IWNetSetJobCopies , parmD szQueue parmW idJob parmW nCopies NetCall lpfnSetJobCopies ;-------------------- ; IWNetDeviceMode ; cProc IWNetDeviceMode , parmW hwnd NetCall lpfnDeviceMode ;-------------------- ; IWNetBrowseDialog ; cProc IWNetBrowseDialog , parmW hwnd parmW nFunction parmD szPath parmD lpnSize NetCall lpfnBrowseDialog ;-------------------- ; IWNetWatchQueue ; cProc IWNetWatchQueue , parmW hwnd parmD szLocal parmD szUsername parmW wIndex NetCall lpfnWatchQueue ;-------------------- ; IWNetUnwatchQueue ; cProc IWNetUnwatchQueue , parmD szQueue NetCall lpfnUnwatchQueue ;--------------------- ; IWNetLockQueueData ; cProc IWNetLockQueueData , parmD szQueue parmD szUsername parmD lplpQueue NetCall lpfnLockQueueData ;------------------------ ; IWNetUnlockQueueData ; cProc IWNetUnlockQueueData , parmD szQueue NetCall lpfnUnlockQueueData ;------------------------ ; IWNetGetError ; cProc IWNetGetError , parmD lpnError NetCall lpfnGetError ;------------------------ ; IWNetGetErrorText ; cProc IWNetGetErrorText , parmW nError parmD lpBuffer parmD lpnSize NetCall lpfnGetErrorText ;---------------------- ; IWNetAbortJob ; cProc IWNetAbortJob , parmD lpszQueue parmW fh NetCall lpfnAbortJob ;----------------------- ; WNetEnable ; cProc WNetEnable, NetCall lpfnEnable ;------------------------ ; WNetDisable ; cProc WNetDisable, NetCall lpfnDisable ;----------------------- ; WNetWriteJob ; cProc WNetWriteJob , parmW hJob parmD lpData parmD lpcb NetCall lpfnWriteJob ;----------------------- ; WNetConnectDialog ; cProc WNetConnectDialog, parmW hwnd parmW iType NetCall lpfnConnectDialog ;----------------------- ; WNetDisconnectDialog ; cProc WNetDisconnectDialog, parmW hwnd parmW iType NetCall lpfnDisconnectDialog ;------------------------- ; WNetConnectionDialog ; cProc WNetConnectionDialog, parmW hwnd parmW iType NetCall lpfnConnectionDialog ;--------------------------- ; WNetViewQueueDialog ; cProc WNetViewQueueDialog, parmW hwnd parmD lpdev NetCall lpfnViewQueueDialog ;-------------------------- ; WNetGetPropertyText ; cProc WNetGetPropertyText, parmW iDlg parmD lpName parmW cb NetCall lpfnGetPropertyText ;-------------------------- ; WNetPropertyDialog ; cProc WNetPropertyDialog, parmW hwnd parmW iDlg parmD lpfile NetCall lpfnPropertyDialog ;--------------------------- ; WNetGetDirectoryType ; cProc WNetGetDirectoryType, parmD lpdir parmD lptype NetCall lpfnGetDirectoryType ;-------------------------- ; WNetDirectoryNotify ; cProc WNetDirectoryNotify, parmW hwnd parmD lpdir parmW wOper NetCall lpfnDirectoryNotify sEnd cd end