Changeset 758


Ignore:
Timestamp:
Jan 24, 2013, 2:25:43 AM (13 years ago)
Author:
Alex Taylor
Message:

Auto-port numbers now generated in base 10 instead of base 4.
Implemented SplPdQuery/SplPdSet entrypoints, which are required for programs to create/configure ports.
Added sample program which demonstrates this (smbport.c). Added BLDLEVEL signature (uses MAKEDESC.CMD).

Location:
branches/smbpdr-1.0
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/smbpdr-1.0/build.cmd

    r422 r758  
    55del smb.o
    66del smb.pdr
     7cmd /c makedesc -D"Samba client port driver for SMB printing" -N"netlabs.org" -V"#define=DRIVER_VERSION,smb.h" smb.def
    78gcc -o smb.o smb.c -c
    89RC -r smb.RC smb.RES
  • branches/smbpdr-1.0/changelog

    r422 r758  
     1Version 1.0.2 12-05-2012
     2  +Added: SplPdQuery and SplPdSet now implemented.  This allows applications to
     3          update SMB port settings through the SplPdSet entrypoint.
     4  +Added: Driver now has bldlevel string.
     5  !Fixed: Port names are now numbered normally instead of in base 4.
     6
     7
    18Version 1.0.1 05-03-2010
    29  +Added: Show return code from smbspool in error message (useful only together
  • branches/smbpdr-1.0/makefile

    r177 r758  
    1616$(BASE).DLL:                    $(BASE).OBJ \
    1717                                $(BASE).RES
     18        makedesc -D"Samba client port driver for SMB printing" -N"netlabs.org" -V"^#define=DRIVER_VERSION,smb.h" smb.def
    1819        ILINK $(LINKOPTS) @<<
    1920$(BASE)
  • branches/smbpdr-1.0/smb.c

    r422 r758  
    5959#include    <process.h>
    6060#include    "SMB.h"
     61
     62#define BIDI_SET_PORTDRV    0x00000019
     63#define BIDI_Q_PORTDRV      0x00008019
     64
    6165
    6266/* Password encryption/decryption routines from ndpsmb.c */
     
    493497        while ( (i < MAX_PORTS) && fPortExists )
    494498        {
    495                 _itoa( i, pszEndPortName, 4);
     499                _itoa( i, pszEndPortName, 10);
    496500                fPortExists = PrfQueryProfileString (HINI_SYSTEMPROFILE,
    497501                                                                                        APPNAME_PM_SPOOLER_PORT,
     
    931935
    932936}
     937#if 1
     938ULONG  APIENTRY SplPdQuery ( PSZ    pszPortName,
     939                             ULONG  ulFlags,
     940                             ULONG  ulCommand,
     941                             PVOID  pInData,
     942                             ULONG  cbInData,
     943                             PVOID  pOutData,
     944                             PULONG pcbOutData )
     945{
     946    PPORTSETTINGS pSettings;
     947    CHAR          szAppName[ STR_LEN_PORTNAME ];
     948    ULONG         rc;
     949
     950    // Generate appname for "PM_SMBx"
     951    strcpy( szAppName, APPNAME_LEAD_STR);
     952    strncat( szAppName, pszPortName, STR_LEN_PORTNAME-1 );
     953
     954    switch ( ulCommand ) {
     955
     956        case BIDI_Q_PORTDRV:
     957            // Make sure the data is valid
     958            if ( !pOutData || *pcbOutData < sizeof( PORTSETTINGS ))
     959                return( ERROR_INVALID_PARAMETER );
     960            pSettings = (PPORTSETTINGS) pOutData;
     961
     962            PrfQueryProfileString( HINI_SYSTEMPROFILE, szAppName,
     963                                   KEY_INITIALIZATION, NULL,
     964                                   pSettings->szPortData, STR_LEN_PORTDESC );
     965            *pcbOutData = sizeof( PORTSETTINGS );
     966            rc = NO_ERROR;
     967            break;
     968
     969        default:
     970            rc = ERROR_NOT_SUPPORTED;
     971            //rc = NO_ERROR;
     972            break;
     973    }
     974
     975   return ( rc );
     976}
     977ULONG  APIENTRY SplPdSet   ( PSZ    pszPortName,
     978                             ULONG  ulFlags,
     979                             ULONG  ulCommand,
     980                             PVOID  pInData,
     981                             ULONG  cbInData )
     982{
     983    PPORTSETTINGS pSettings;
     984    CHAR          szIniStr[ STR_LEN_PORTDESC ] = {0};
     985    CHAR          szAppName[ STR_LEN_PORTNAME ];
     986    PSZ           token;
     987    ULONG         rc;
     988
     989    // Generate appname for "PM_CUPSx"
     990    strcpy( szAppName, APPNAME_LEAD_STR);
     991    strncat( szAppName, pszPortName, STR_LEN_PORTNAME-1 );
     992
     993    switch ( ulCommand ) {
     994
     995        case BIDI_SET_PORTDRV:
     996            // Validate the data
     997            if ( !pInData || cbInData < sizeof( PORTSETTINGS ))
     998                return( ERROR_INVALID_PARAMETER );
     999            pSettings = (PPORTSETTINGS) pInData;
     1000            // Update the INITIALIZATION string
     1001            PrfWriteProfileString( HINI_SYSTEMPROFILE, szAppName,
     1002                                   KEY_INITIALIZATION, pSettings->szPortData );
     1003            PrfWriteProfileString( HINI_SYSTEMPROFILE, APPNAME_PM_SPOOLER_PORT,
     1004                                   pszPortName, pSettings->szPortData );
     1005            // Update the DESCRIPTION string
     1006            if (( token = lprtok( pSettings->szPortData, "#")) != NULL ) {
     1007                strncpy( szIniStr, token, STR_LEN_PORTDESC-1 );
     1008                if (( token = lprtok( NULL, "#")) != NULL ) {
     1009                    if ( token[ strlen(token) - 1 ] == ';')
     1010                        token[ strlen(token) - 1 ] = '\0';
     1011                    strncat( szIniStr, ":", STR_LEN_PORTDESC-1 );
     1012                    strncat( szIniStr, token, STR_LEN_PORTDESC-1 );
     1013                }
     1014            }
     1015            PrfWriteProfileString( HINI_SYSTEMPROFILE,
     1016                                   szAppName, KEY_DESCRIPTION, szIniStr );
     1017            rc = NO_ERROR;
     1018            break;
     1019
     1020        default:
     1021            //rc = ERROR_NOT_SUPPORTED;
     1022            rc = NO_ERROR;
     1023            break;
     1024    }
     1025    return ( rc );
     1026
     1027}
     1028#else
    9331029ULONG  APIENTRY SplPdQuery ( PSZ    pszDeviceName,
    9341030                                                        ULONG  ulFlags,
     
    9511047        return NO_ERROR;
    9521048}
     1049#endif
    9531050ULONG  APIENTRY SplPdNewPage ( HFILE  hFile, ULONG ulPageNumber )
    9541051{
  • branches/smbpdr-1.0/smb.def

    r175 r758  
    11LIBRARY SMB INITINSTANCE TERMINSTANCE
    2 DESCRIPTION 'SMB Port Driver'
     2DESCRIPTION '@#netlabs.org:1.02#@##1## 5 Dec 2012 15:31:07      sigel::::::@@Samba client port driver for SMB printing'
    33PROTMODE
    44DATA MULTIPLE NONSHARED LOADONCALL
    55CODE LOADONCALL
    66EXPORTS
    7    SPLPDENUMPORT      = SplPdEnumPort         @501
    8    SPLPDINSTALLPORT   = SplPdInstallPort      @502
    9    SPLPDGETPORTICON   = SplPdGetPortIcon      @503
    10    SPLPDQUERYPORT     = SplPdQueryPort        @504
    11    SPLPDSETPORT       = SplPdSetPort          @505
    12    SPLPDREMOVEPORT    = SplPdRemovePort       @506
    13    SPLPDOPEN          = SplPdOpen             @508
    14    SPLPDWRITE         = SplPdWrite            @509
    15    SPLPDABORTDOC      = SplPdAbortDoc         @510
    16    SPLPDNEWPAGE       = SplPdNewPage          @511
    17    SPLPDCLOSE         = SplPdClose            @512
    18    SPLPDQUERY         = SplPdQuery            @513
    19    SPLPDSET           = SplPdSet              @514
     7SPLPDENUMPORT      = SplPdEnumPort         @501
     8SPLPDINSTALLPORT   = SplPdInstallPort      @502
     9SPLPDGETPORTICON   = SplPdGetPortIcon      @503
     10SPLPDQUERYPORT     = SplPdQueryPort        @504
     11SPLPDSETPORT       = SplPdSetPort          @505
     12SPLPDREMOVEPORT    = SplPdRemovePort       @506
     13SPLPDOPEN          = SplPdOpen             @508
     14SPLPDWRITE         = SplPdWrite            @509
     15SPLPDABORTDOC      = SplPdAbortDoc         @510
     16SPLPDNEWPAGE       = SplPdNewPage          @511
     17SPLPDCLOSE         = SplPdClose            @512
     18SPLPDQUERY         = SplPdQuery            @513
     19SPLPDSET           = SplPdSet              @514
    2020
  • branches/smbpdr-1.0/smb.h

    r177 r758  
     1#define DRIVER_VERSION               "1.02"
    12#define PATH_SMB_PDR                 "?:\\OS2\\DLL\\SMB.PDR"
    23#define SMB_DLL                      "SMB.PDR"
     
    184185   ULONG    lfModified;
    185186} LPRDATA, *PLPRDATA;
     187
     188/* Port-specific data format used by PrtSet/SplPdSet */
     189typedef struct _PORTSETTINGS {
     190    CHAR  szPortData[ STR_LEN_PORTDESC ];
     191} PORTSETTINGS, *PPORTSETTINGS;
     192
    186193#define ID_IP                       201
    187194#define ID_SMBQUEUE                 202
Note: See TracChangeset for help on using the changeset viewer.