home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / ENDCAP.ASM < prev    next >
Assembly Source File  |  1991-08-17  |  6KB  |  157 lines

  1. ; File......: ENDCAP.ASM
  2. ; Author....: James R. Zack
  3. ; CIS ID....: 75410,1567
  4. ; Date......: $Date:   17 Aug 1991 15:27:42  $
  5. ; Revision..: $Revision:   1.3  $
  6. ; Log File..: $Logfile:   E:/nanfor/src/endcap.asv  $
  7. ;
  8. ; This is an original work by James R. Zack and is placed in the
  9. ; public domain.
  10. ;
  11. ; Modification history:
  12. ; ---------------------
  13. ;
  14. ; $Log:   E:/nanfor/src/endcap.asv  $
  15. ;  
  16. ;     Rev 1.3   17 Aug 1991 15:27:42   GLENN
  17. ;  Don Caton fixed some spelling errors in the doc
  18. ;  
  19. ;     Rev 1.2   15 Aug 1991 23:06:44   GLENN
  20. ;  Forest Belt proofread/edited/cleaned up doc
  21. ;  
  22. ;     Rev 1.1   14 Jun 1991 19:54:26   GLENN
  23. ;  Minor edit to file header
  24. ;  
  25. ;     Rev 1.0   01 Apr 1991 01:03:16   GLENN
  26. ;  Nanforum Toolkit
  27. ;  
  28. ;
  29.  
  30. ; File......: ENDCAP.ASM
  31. ; Author....: James R. Zack
  32. ; CIS ID....: 75410,1567
  33. ; Date......: $Date:   17 Aug 1991 15:27:42  $
  34. ; Revision..: $Revision:   1.3  $
  35. ; Log File..: $Logfile:   E:/nanfor/src/endcap.asv  $
  36. ;
  37. ; This is an original work by James R. Zack and is placed in the
  38. ; public domain.
  39. ;
  40. ; Modification history:
  41. ; ---------------------
  42. ;
  43. ; $Log$
  44. ;  
  45. ;     Rev 1.1   14 Jun 1991 19:54:26   GLENN
  46. ;  Minor edit to file header
  47. ;  
  48. ;     Rev 1.0   01 Apr 1991 01:03:16   GLENN
  49. ;  Nanforum Toolkit
  50. ;  
  51. ;
  52.  
  53. ; $DOC$
  54. ; $FUNCNAME$
  55. ;     FT_ENDCAP()
  56. ; $CATEGORY$
  57. ;     NetWare
  58. ; $ONELINER$
  59. ;     Cancel a specific NetWare print queue capture
  60. ; $SYNTAX$
  61. ;     FT_ENDCAP( [ <nLPTPortNumber> ] ) -> lResult
  62. ; $ARGUMENTS$
  63. ;     <nLPTPortNumber> is the captured LPT port to cancel.  If the
  64. ;     parameter is omitted, the default port of LPT1: is used.
  65. ; $RETURNS$
  66. ;     .T. if successful
  67. ; $DESCRIPTION$
  68. ;    This routine is used to close a specific capture on the specified LPT
  69. ;    port.  When this command is issued, the LPT port is no longer redirected
  70. ;    to the print queue, and any information waiting in queue to be printed
  71. ;    will be printed.
  72. ;
  73. ;    This routine was designed and written for Advanced NetWare 286 v 2.1 or
  74. ;    NetWare 386 v 3.0 or better.  It has been tested on Advanced NetWare 286
  75. ;    v 2.15 rev A & C and NetWare 386 v 3.0.
  76. ;
  77. ;    This source code was written for Microsoft Macro Assembler v 5.1.  It
  78. ;    should work with any assembler with minor modifications.
  79. ; $EXAMPLES$
  80. ;    (in DOS)
  81. ;    F:>CAPTURE S=ServerName Q=PrintQueueName T=0 L=2
  82. ;    Device LPT2: re-routed to queue PrintQueueName on server ServerName.
  83. ;    F:>CAPTURE S=ServerName Q=PrintQueueName T=0 L=1
  84. ;    Device LPT1: re-routed to queue PrintQueueName on server ServerName.
  85. ;
  86. ;    (in your Clipper application)
  87. ;    FT_ENDCAP(2) // Closes LPT2: capture, and flushes print buffer
  88. ;    ...
  89. ;    ...
  90. ;    FT_ENDCAP()  // Closes LPT1: (default) capture, and flushes
  91. ;                 //    print buffer
  92. ; $END$
  93.  
  94. PUBLIC   FT_ENDCAP                   ; DECLARE ROUTINE PUBLIC
  95. EXTRN    __RET:FAR                   ; DECLARE EXTERNALS: THESE ARE FOUND
  96. EXTRN    __PARNI:FAR                 ;                          IN EXTEND
  97. EXTRN    __RETL:FAR                  ;                          LIBRARY.
  98. EXTRN    __PARINFO:FAR               ;
  99.  
  100. _NANFOR SEGMENT 'CODE'               ; CODE SEGMENT
  101.           ASSUME  CS:_NANFOR         ; POINT SEGMENT REGS TO RIGHT PLACE
  102. FT_ENDCAP PROC    FAR                ; DECLARE ROUTINE FAR
  103.           PUSH    BP                 ; SAVE BASE POINTER
  104.           MOV     BP,SP              ; POINT TO TOP OF STACK
  105.           PUSH    DS                 ; SAVE DATA SEGMENT
  106.           PUSH    ES                 ; SAVE EXTRA SEGMENT
  107.           PUSH    SI                 ; SAVE SOURCE INDEX
  108.           PUSH    DI                 ; SAVE DESTINATION INDEX
  109.           XOR     AX,AX              ; MAKE SURE AX IS CLEAR
  110.           PUSH    AX                 ; PUSH IT ONTO THE STACK
  111.           CALL    __PARINFO          ; GET NUMBER OF PARMS PASSED
  112.           ADD     SP,2               ; RESET STACK POINTER
  113.           CMP     AX,0               ; ANYTHING PASSED?
  114.           JLE     DEFAULT            ; NO, USE DEFAULTS, OTHERWISE, CHECK PARMS
  115.           MOV     AX,1               ; POINT TO FIRST PARM ON STACK
  116.           PUSH    AX                 ; SAVE IT
  117.           CALL    __PARINFO          ; SEE WHAT TYPE OF PARM WAS PASSED
  118.           ADD     SP,2               ; RESTORE THE STACK
  119.           CMP     AX,2               ; WAS IT A NUMERIC?
  120.           JNE     DEFAULT            ; NO, USE DEFAULTS
  121.           MOV     AX,1               ; POINT TO FIRST PARM ON STACK
  122.           PUSH    AX                 ; SAVE IT
  123.           CALL    __PARNI            ; GET PARM
  124.           ADD     SP,2               ; RESET STACK
  125.           MOV     DH,AL              ; PUT PORT NUMBER INTO DH
  126.           CMP     DH,00              ; IS THIS A VALID PORT NUMBER
  127.           JLE     DEFAULT            ; NO, USE DEFAULT PRINTER
  128.           CMP     DH,03H             ; IS IT HIGHER THAN LPT3?
  129.           JG      DEFAULT            ; YES, USE DEFAULTS
  130.           JMP     CANCEL             ; OTHERWISE, CANCEL QUEUE
  131. DEFAULT:  MOV     DH,00              ; STORE LPT1: AS THE DEFAULT PRINTER
  132. CANCEL:   MOV     AH,0DFH            ; NetWare API INT 21H, FUNCTION DFH
  133.           MOV     DL,06H             ; SUBFUNCTION 06H - CANCEL SPECIFIC CAPTURE
  134.           DEC     DH                 ; SUBTRACT 1 FROM PORT NUMBER
  135.           INT     21H                ; CALL API FUNCTION
  136.           CMP     AL,00              ; CHECK FOR SUCCESSFUL RETURN
  137.           JE      RET_OK             ; YES, IT WAS SUCCESSFUL
  138.           XOR     AX,AX              ; OTHERWISE, BLANK OUT AX (False)
  139.           jmp     JUMPOUT            ; Goto clean up and return
  140. RET_OK:   mov     ax,01h             ; Return a true
  141. JUMPOUT:  push    ax                 ; push reg onto stack
  142.           call    __RETL             ; pass it back to clipper
  143.           add     sp,2               ; Reset stack
  144.           pop     di                 ; Restore environment
  145.           pop     si
  146.           pop     es
  147.           pop     ds
  148.           pop     bp
  149.           call    __RET              ; Get outta here and back to clipper
  150.           ret                        ; Pass control back to clipper
  151. FT_ENDCAP ENDP
  152.  
  153. _NanFor   ENDS
  154.  
  155.           END
  156.  
  157.