Changeset 14
- Timestamp:
- May 3, 2013, 7:18:10 PM (12 years ago)
- Location:
- rxprtutl/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified rxprtutl/trunk/notes ¶
r13 r14 18 18 To convert <number> to USHORT: ushort = REVERSE( X2C( D2X( number, 4 ))) 19 19 To convert <number> to ULONG: ulong = REVERSE( X2C( D2X( number, 8 ))) 20 21 Fixed-length string (character array) fields MUST append a 0 byte to 22 the end of the string value, and SHOULD pad the rest of the array (up 23 to the defined length) with 0 bytes as well. 20 24 21 25 … … 183 187 END 184 188 189 (At least version 1.03 of SMB.PDR is required.) 190 -
TabularUnified rxprtutl/trunk/rxprtutl.c ¶
r13 r14 132 132 "RPUPortDelete", 133 133 "RPUPortDialog", 134 "RPUPortInfo", 134 135 "RPUPortInstall", 135 136 "RPUPortQuery", … … 155 156 RexxFunctionHandler RPUPortDelete; 156 157 RexxFunctionHandler RPUPortDialog; 158 RexxFunctionHandler RPUPortInfo; 157 159 RexxFunctionHandler RPUPortInstall; 158 160 RexxFunctionHandler RPUPortQuery; … … 770 772 771 773 /* ------------------------------------------------------------------------- * 774 * RPUPortInfo * 775 * * 776 * Queries basic information about a local port. This is different from * 777 * RPUPortQuery() in that the latter returns port configuration information * 778 * from the port driver itself, whereas this function only returns what the * 779 * spooler itself knows about the port. * 780 * * 781 * REXX ARGUMENTS: * 782 * 1. The name of the port. (REQUIRED) * 783 * 2. The name of the stem in which to return the results: (REQUIRED) * 784 * (stem).!name The name of the port * 785 * (stem).!driver The name of the port driver * 786 * (stem).!converter The name of the protocol converter used * 787 * * 788 * REXX RETURN VALUE: * 789 * 1 on success, or 0 if an error occurred. * 790 * ------------------------------------------------------------------------- */ 791 ULONG APIENTRY RPUPortInfo( PSZ pszName, ULONG argc, RXSTRING argv[], PSZ pszQueue, PRXSTRING prsResult ) 792 { 793 PPRPORTINFO2 pInfo = NULL; 794 PVOID pbuf = NULL; 795 ULONG cbBuf = 0, 796 cbNeeded = 0; 797 CHAR szStem[ US_STEM_MAXZ ]; // compound variable stem name 798 PSZ pszPortName; 799 SPLERR rc; 800 801 802 // Reset the error indicator 803 WriteErrorCode( 0, NULL ); 804 805 // Validate the REXX arguments 806 if (( argc != 2 ) || 807 ( ! RXVALIDSTRING( argv[0] )) || ( ! RXVALIDSTRING( argv[1] ))) 808 return ( 40 ); 809 810 pszPortName = argv[0].strptr; 811 812 // Initialize the result stem name 813 if ( RXSTRLEN(argv[1]) > US_STEM_MAXZ ) return ( 40 ); 814 if ( argv[1].strptr[ argv[1].strlength-1 ] == '.') argv[1].strlength--; 815 strncpy( szStem, argv[1].strptr, RXSTRLEN( argv[1] )); 816 szStem[ RXSTRLEN( argv[1] ) ] = '\0'; 817 818 819 // Query the amount of available data 820 rc = SplQueryPort( NULL, pszPortName, 2L, NULL, 0L, &cbNeeded ); 821 if (( rc != ERROR_MORE_DATA ) && ( rc != NERR_BufTooSmall )) 822 { 823 WriteErrorCode( rc, "SplQueryPort"); 824 MAKERXSTRING( *prsResult, "0", 1 ); 825 return ( 0 ); 826 } 827 828 // Now get the actual data 829 pbuf = malloc( cbNeeded ); 830 if ( !pbuf ) { 831 WriteErrorCode( ERROR_NOT_ENOUGH_MEMORY, "malloc"); 832 MAKERXSTRING( *prsResult, "0", 1 ); 833 return ( 0 ); 834 } 835 cbBuf = cbNeeded; 836 rc = SplQueryPort( NULL, pszPortName, 2L, pbuf, cbBuf, &cbNeeded ); 837 if ( rc == NO_ERROR ) { 838 pInfo = (PPRPORTINFO2) pbuf; 839 WriteCompoundVariable( szStem, "!name", pInfo->pszPortName ); 840 WriteCompoundVariable( szStem, "!driver", pInfo->pszPortDriver ); 841 WriteCompoundVariable( szStem, "!converter", pInfo->pszProtocolConverter ); 842 MAKERXSTRING( *prsResult, "1", 1 ); 843 } 844 else { 845 WriteErrorCode( rc, "SplQueryPort"); 846 MAKERXSTRING( *prsResult, "0", 1 ); 847 } 848 849 free( pbuf ); 850 return ( 0 ); 851 } 852 853 854 /* ------------------------------------------------------------------------- * 772 855 * RPUPortInstall * 773 856 * * … … 1422 1505 1423 1506 pszDeviceName = argv[0].strptr; 1424 //printf("Device: \"%s\"\n", pszDeviceName );1425 1507 1426 1508 // Initialize the result stem name -
TabularUnified rxprtutl/trunk/rxprtutl.def ¶
r13 r14 1 1 LIBRARY RXPRTUTL INITINSTANCE TERMINSTANCE 2 2 DATA MULTIPLE NONSHARED 3 DESCRIPTION '@#Alex Taylor:0.2.2#@##1## 1 May 2013 18:18:54REINFORCE::::::@@REXX Printer Management Utilities'3 DESCRIPTION '@#Alex Taylor:0.2.2#@##1## 3 May 2013 12:46:17 REINFORCE::::::@@REXX Printer Management Utilities' 4 4 5 5 EXPORTS RPULoadFuncs … … 12 12 RPUPortDelete 13 13 RPUPortDialog 14 RPUPortInfo 14 15 RPUPortInstall 15 16 RPUPortQuery
Note:
See TracChangeset
for help on using the changeset viewer.