removed the following parameters
authorGerald Carter <jerry@samba.org>
Mon, 21 Oct 2002 20:11:12 +0000 (20:11 +0000)
committerGerald Carter <jerry@samba.org>
Mon, 21 Oct 2002 20:11:12 +0000 (20:11 +0000)
  * postscript
  * printer driver
  * printer driver location
  * printer driver file

also removed the get_a_printer_driver_9x_compatible() function

source/param/loadparm.c
source/printing/nt_printing.c
source/printing/printing.c
source/smbd/fileio.c
source/smbd/lanman.c

index 5d1ef9b91f5a1bfb573d5e83f828f0f9eeed70ae..a44cc370ac601bb9eb2d685db9571320ed4c7258 100644 (file)
@@ -299,9 +299,6 @@ typedef struct
        char *szQueuepausecommand;
        char *szQueueresumecommand;
        char *szPrintername;
-       char *szPrinterDriver;
-       char *szPrinterDriverLocation;
-       char *szDriverFile;
        char *szDontdescend;
        char **szHostsallow;
        char **szHostsdeny;
@@ -356,7 +353,6 @@ typedef struct
        BOOL bGuest_only;
        BOOL bGuest_ok;
        BOOL bPrint_ok;
-       BOOL bPostscript;
        BOOL bMap_system;
        BOOL bMap_hidden;
        BOOL bMap_archive;
@@ -421,9 +417,6 @@ static service sDefault = {
        NULL,                   /* szQueuepausecommand */
        NULL,                   /* szQueueresumecommand */
        NULL,                   /* szPrintername */
-       NULL,                   /* szPrinterDriver - this is set in init_globals() */
-       NULL,                   /* szPrinterDriverLocation */
-       NULL,                   /* szDriverFile */
        NULL,                   /* szDontdescend */
        NULL,                   /* szHostsallow */
        NULL,                   /* szHostsdeny */
@@ -478,7 +471,6 @@ static service sDefault = {
        False,                  /* bGuest_only */
        False,                  /* bGuest_ok */
        False,                  /* bPrint_ok */
-       False,                  /* bPostscript */
        False,                  /* bMap_system */
        False,                  /* bMap_hidden */
        True,                   /* bMap_archive */
@@ -883,7 +875,6 @@ static struct parm_struct parm_table[] = {
        {"printcap", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_HIDE},
        {"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_PRINT},
        {"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_HIDE},
-       {"postscript", P_BOOL, P_LOCAL, &sDefault.bPostscript, NULL, NULL, FLAG_PRINT | FLAG_DEPRECATED},
        {"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, NULL, enum_printing, FLAG_PRINT | FLAG_GLOBAL},
        {"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL},
        {"disable spoolss", P_BOOL, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL},
@@ -904,9 +895,6 @@ static struct parm_struct parm_table[] = {
        {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_HIDE},
        {"use client driver", P_BOOL, P_LOCAL, &sDefault.bUseClientDriver, NULL, NULL, FLAG_PRINT},
        {"default devmode", P_BOOL, P_LOCAL, &sDefault.bDefaultDevmode, NULL, NULL, FLAG_PRINT},
-       {"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, FLAG_PRINT | FLAG_DEPRECATED},
-       {"printer driver file", P_STRING, P_LOCAL, &sDefault.szDriverFile, NULL, NULL, FLAG_PRINT | FLAG_DEPRECATED},
-       {"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL | FLAG_DEPRECATED},
 
        {"Filename Handling", P_SEP, P_SEPARATOR},
        {"strip dot", P_BOOL, P_GLOBAL, &Globals.bStripDot, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -1102,9 +1090,6 @@ Initialise the sDefault parameter structure for the printer values.
 ***************************************************************************/
 static void init_printer_values(void)
 {
-       string_set(&sDefault.szPrinterDriver, "");
-       string_set(&sDefault.szDriverFile, dyn_DRIVERFILE);
-
        /* choose defaults depending on the type of printing */
        switch (sDefault.iPrinting)
        {
@@ -1709,8 +1694,6 @@ FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
 static FN_LOCAL_STRING(_lp_printername, szPrintername)
-FN_LOCAL_STRING(lp_driverfile, szDriverFile)
-FN_LOCAL_STRING(lp_printerdriver, szPrinterDriver)
 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
@@ -1730,7 +1713,6 @@ FN_LOCAL_STRING(lp_mangled_map, szMangledMap)
 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
-FN_LOCAL_STRING(lp_driverlocation, szPrinterDriverLocation)
 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
@@ -1749,7 +1731,6 @@ FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
-FN_LOCAL_BOOL(lp_postscript, bPostscript)
 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
 FN_LOCAL_BOOL(lp_locking, bLocking)
index fcb493a614895de15358e08805e1033a57d5d770..222619032332e2ce612ff9ace62eca3fb84c165c 100644 (file)
@@ -1793,67 +1793,6 @@ static WERROR get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr,
        return WERR_OK;
 }
 
-/****************************************************************************
-****************************************************************************/
-uint32 get_a_printer_driver_9x_compatible(pstring line, fstring model)
-{
-       NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3;
-       TDB_DATA kbuf;
-       pstring key;
-       int i;
-       line[0] = '\0';
-
-       slprintf(key, sizeof(key)-1, "%s%s/%d/%s", DRIVERS_PREFIX, "WIN40", 0, model);
-       DEBUG(10,("driver key: [%s]\n", key));
-       
-       kbuf.dptr = key;
-       kbuf.dsize = strlen(key)+1;
-       if (!tdb_exists(tdb_drivers, kbuf))
-               return False;
-
-       ZERO_STRUCT(info3);
-       get_a_printer_driver_3(&info3, model, "Windows 4.0", 0);
-       
-       DEBUGADD(10,("info3->name            [%s]\n", info3->name));
-       DEBUGADD(10,("info3->datafile        [%s]\n", info3->datafile));
-       DEBUGADD(10,("info3->helpfile        [%s]\n", info3->helpfile));
-       DEBUGADD(10,("info3->monitorname     [%s]\n", info3->monitorname));
-       DEBUGADD(10,("info3->defaultdatatype [%s]\n", info3->defaultdatatype));
-       for (i=0; info3->dependentfiles && *info3->dependentfiles[i]; i++) {
-               DEBUGADD(10,("info3->dependentfiles  [%s]\n", info3->dependentfiles[i]));
-       }
-       DEBUGADD(10,("info3->environment     [%s]\n", info3->environment));
-       DEBUGADD(10,("info3->driverpath      [%s]\n", info3->driverpath));
-       DEBUGADD(10,("info3->configfile      [%s]\n", info3->configfile));
-
-       /*pstrcat(line, info3->name);             pstrcat(line, ":");*/
-       trim_string(info3->driverpath, "\\print$\\WIN40\\0\\", 0);
-       pstrcat(line, info3->driverpath);
-       pstrcat(line, ":");
-       trim_string(info3->datafile, "\\print$\\WIN40\\0\\", 0);
-       pstrcat(line, info3->datafile);
-       pstrcat(line, ":");
-       trim_string(info3->helpfile, "\\print$\\WIN40\\0\\", 0);
-       pstrcat(line, info3->helpfile);
-       pstrcat(line, ":");
-       trim_string(info3->monitorname, "\\print$\\WIN40\\0\\", 0);
-       pstrcat(line, info3->monitorname);
-       pstrcat(line, ":");
-       pstrcat(line, "RAW");                /*info3->defaultdatatype);*/
-       pstrcat(line, ":");
-
-       for (i=0; info3->dependentfiles && *info3->dependentfiles[i]; i++) {
-               if (i)
-                       pstrcat(line, ",");               /* don't end in a "," */
-               trim_string(info3->dependentfiles[i], "\\print$\\WIN40\\0\\", 0);
-               pstrcat(line, info3->dependentfiles[i]);
-       }
-       
-       SAFE_FREE(info3);
-
-       return True;    
-}
-
 /****************************************************************************
  Debugging function, dump at level 6 the struct in the logs.
 ****************************************************************************/
@@ -2839,7 +2778,6 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin
                 get_called_name(), sharename);
        fstrcpy(info.sharename, sharename);
        fstrcpy(info.portname, SAMBA_PRINTER_PORT_NAME);
-       fstrcpy(info.drivername, lp_printerdriver(snum));
 
        /* by setting the driver name to an empty string, a local NT admin
           can now run the **local** APW to install a local printer driver
index 95d89159766deebd69d3ea51306c195d21419e2d..afcf0ee7202b91dd0c80af2f4cdfdbab07ef1785 100644 (file)
@@ -1572,17 +1572,6 @@ to open spool file %s.\n", pjob.filename));
 
        release_print_db(pdb);
 
-       /*
-        * If the printer is marked as postscript output a leading
-        * file identifier to ensure the file is treated as a raw
-        * postscript file.
-        * This has a similar effect as CtrlD=0 in WIN.INI file.
-        * tim@fsg.com 09/06/94
-        */
-       if (lp_postscript(snum)) {
-               print_job_write(snum, jobid, "%!\n",3);
-       }
-
        return jobid;
 
  fail:
index d5df9826dfd09cb6f8a62c3d0073e77777b74488..6bae1df996c8af0606f713ea73117e5812108acc 100644 (file)
@@ -30,13 +30,9 @@ static BOOL setup_write_cache(files_struct *, SMB_OFF_T);
 
 static SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos)
 {
-       SMB_OFF_T offset = 0;
        SMB_OFF_T seek_ret;
 
-       if (fsp->print_file && lp_postscript(fsp->conn->service))
-               offset = 3;
-
-       seek_ret = fsp->conn->vfs_ops.lseek(fsp,fsp->fd,pos+offset,SEEK_SET);
+       seek_ret = fsp->conn->vfs_ops.lseek(fsp,fsp->fd,pos,SEEK_SET);
 
        if(seek_ret == -1) {
                DEBUG(0,("seek_file: (%s) sys_lseek failed. Error was %s\n",
@@ -45,10 +41,10 @@ static SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos)
                return -1;
        }
 
-       fsp->pos = seek_ret - offset;
+       fsp->pos = seek_ret;
 
        DEBUG(10,("seek_file (%s): requested pos = %.0f, new pos = %.0f\n",
-               fsp->fsp_name, (double)(pos+offset), (double)fsp->pos ));
+               fsp->fsp_name, (double)pos, (double)fsp->pos ));
 
        return(fsp->pos);
 }
index 8bfad4ab334854b938677f973ee5308283da36ac..0db1af60325b98fc0f5f34aa5a8dec8c1077f0e3 100644 (file)
@@ -494,7 +494,7 @@ static void fill_printjob_info(connection_struct *conn, int snum, int uLevel,
 
 /********************************************************************
  Return a driver name given an snum.
Looks in a tdb first. Returns True if from tdb, False otherwise.
+ Returns True if from tdb, False otherwise.
  ********************************************************************/
 
 static BOOL get_driver_name(int snum, pstring drivername)
@@ -507,8 +507,6 @@ static BOOL get_driver_name(int snum, pstring drivername)
                pstrcpy( drivername, info->info_2->drivername);
                in_tdb = True;
                free_a_printer(&info, 2);
-       } else {
-               pstrcpy( drivername, lp_printerdriver(snum));
        }
 
        return in_tdb;
@@ -518,162 +516,83 @@ static BOOL get_driver_name(int snum, pstring drivername)
  Respond to the DosPrintQInfo command with a level of 52
  This is used to get printer driver information for Win9x clients
  ********************************************************************/
-static void fill_printq_info_52(connection_struct *conn, int snum, int uLevel,
-                               struct pack_desc* desc,
-                               int count, print_queue_struct* queue,
-                               print_status_struct* status)
+static void fill_printq_info_52(connection_struct *conn, int snum, 
+                               struct pack_desc* desc, int count )
 {
-       int i;
-       BOOL ok = False;
-       pstring tok,driver,datafile,langmon,helpfile,datatype;
-       char *p;
-       char **lines = NULL;
-       pstring gen_line;
-       BOOL in_tdb = False;
-       fstring location;
-       pstring drivername;
-
-       /*
-        * Check in the tdb *first* before checking the legacy
-        * files. This allows an NT upload to take precedence over
-        * the existing fileset. JRA.
-        * 
-        * we need to lookup the driver name prior to making the call
-        * to get_a_printer_driver_9x_compatible() and not rely on the
-        * 'print driver' parameter --jerry
-        */
-
-
-       if ((get_driver_name(snum,drivername)) && 
-           ((ok = get_a_printer_driver_9x_compatible(gen_line, drivername)) == True))
-       {
-               in_tdb = True;
-               p = gen_line;
-               DEBUG(10,("9x compatable driver line for [%s]: [%s]\n", drivername, gen_line));
-       } 
-       else 
-       {
-               /* didn't find driver in tdb */
-
-               DEBUG(10,("snum: %d\nprinterdriver: [%s]\nlp_driverfile: [%s]\n",
-                          snum, drivername, lp_driverfile(snum)));
-
-               lines = file_lines_load(lp_driverfile(snum),NULL);
-               if (!lines) 
-               {
-                       DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum),
-                                 strerror(errno)));
-                       desc->errcode=NERR_notsupported;
-                       goto done;
-               } 
-
-               /* lookup the long printer driver name in the file description */
-               for (i=0;lines[i] && !ok;i++) 
-               {
-                       p = lines[i];
-                       if (next_token(&p,tok,":",sizeof(tok)) &&
-                          (strlen(drivername) == strlen(tok)) &&
-                          (!strncmp(tok,drivername,strlen(drivername))))
-                       {
-                               ok = True;
-                       }
-               }
+       int                             i;
+       fstring                         location;
+       NT_PRINTER_DRIVER_INFO_LEVEL    driver;
+       NT_PRINTER_INFO_LEVEL           *printer = NULL;
+
+       if ( !W_ERROR_IS_OK(get_a_printer( &printer, 2, lp_servicename(snum))) ) {
+               DEBUG(3,("fill_printq_info_52: Failed to lookup printer [%s]\n", 
+                       lp_servicename(snum)));
+               goto err;
        }
-
-       if (ok)
+               
+       if ( !W_ERROR_IS_OK(get_a_printer_driver(&driver, 3, printer->info_2->drivername, 
+               "Windows 4.0", 0)) )
        {
-               /* driver file name */
-               if (!next_token(&p,driver,":",sizeof(driver)))
-                       goto err;
-
-               /* data file name */
-               if (!next_token(&p,datafile,":",sizeof(datafile)))
-                       goto err;
-
-               /*
-                * for the next tokens - which may be empty - I have
-                * to check for empty tokens first because the
-                * next_token function will skip all empty token
-                * fields */
+               DEBUG(3,("fill_printq_info_52: Failed to lookup driver [%s]\n", 
+                       printer->info_2->drivername));
+               goto err;
+       }
 
-               /* help file */
-               if (*p == ':') 
-               {
-                       *helpfile = '\0';
-                       p++;
-               } 
-               else if (!next_token(&p,helpfile,":",sizeof(helpfile)))
-                       goto err;
+       trim_string(driver.info_3->driverpath, "\\print$\\WIN40\\0\\", 0);
+       trim_string(driver.info_3->datafile, "\\print$\\WIN40\\0\\", 0);
+       trim_string(driver.info_3->helpfile, "\\print$\\WIN40\\0\\", 0);
        
-               /* language monitor */
-               if (*p == ':') 
-               {
-                       *langmon = '\0';
-                       p++;
-               } 
-               else if (!next_token(&p,langmon,":",sizeof(langmon)))
-                       goto err;
+       PACKI(desc, "W", 0x0400);                     /* don't know */
+       PACKS(desc, "z", driver.info_3->name);        /* long printer name */
+       PACKS(desc, "z", driver.info_3->driverpath);  /* Driverfile Name */
+       PACKS(desc, "z", driver.info_3->datafile);    /* Datafile name */
+       PACKS(desc, "z", driver.info_3->monitorname); /* language monitor */
        
-               /* default data type */
-               if (!next_token(&p,datatype,":",sizeof(datatype))) 
-                       goto err;
+       fstrcpy(location, "\\\\");
+       fstrcat(location, get_called_name());
+       fstrcat(location, "\\print$\\WIN40\\0");
+       PACKS(desc,"z", location);                          /* share to retrieve files */
        
-               PACKI(desc,"W",0x0400);               /* don't know */
-               PACKS(desc,"z",drivername);    /* long printer name */
-               PACKS(desc,"z",driver);                    /* Driverfile Name */
-               PACKS(desc,"z",datafile);                  /* Datafile name */
-               PACKS(desc,"z",langmon);                         /* language monitor */
-               if (in_tdb)
-               {
-                       fstrcpy(location, "\\\\");
-                       fstrcat(location, global_myname);
-                       fstrcat(location, "\\print$\\WIN40\\0");
-                       PACKS(desc,"z",location);   /* share to retrieve files */
-               }
-               else
-               {
-                       PACKS(desc,"z",lp_driverlocation(snum));   /* share to retrieve files */
-               }
-               PACKS(desc,"z",datatype);                        /* default data type */
-               PACKS(desc,"z",helpfile);                  /* helpfile name */
-               PACKS(desc,"z",driver);                    /* driver name */
-
-               DEBUG(3,("printerdriver:%s:\n",drivername));
-               DEBUG(3,("Driver:%s:\n",driver));
-               DEBUG(3,("Data File:%s:\n",datafile));
-               DEBUG(3,("Language Monitor:%s:\n",langmon));
-               if (in_tdb)
-                       DEBUG(3,("lp_driverlocation:%s:\n",location));
-               else
-                       DEBUG(3,("lp_driverlocation:%s:\n",lp_driverlocation(snum)));
-               DEBUG(3,("Data Type:%s:\n",datatype));
-               DEBUG(3,("Help File:%s:\n",helpfile));
-               PACKI(desc,"N",count);                     /* number of files to copy */
-
-               for (i=0;i<count;i++) 
-               {
-                       /* no need to check return value here
-                        * - it was already tested in
-                        * get_printerdrivernumber */
-                       next_token(&p,tok,",",sizeof(tok));
-                       PACKS(desc,"z",tok);         /* driver files to copy */
-                       DEBUG(3,("file:%s:\n",tok));
-               }
-               
-               DEBUG(3,("fill_printq_info on <%s> gave %d entries\n",
-                         SERVICE(snum),count));
-
-               desc->errcode=NERR_Success;
-               goto done;
+       PACKS(desc,"z", driver.info_3->defaultdatatype);    /* default data type */
+       PACKS(desc,"z", driver.info_3->helpfile);           /* helpfile name */
+       PACKS(desc,"z", driver.info_3->driverpath);               /* driver name */
+
+       DEBUG(3,("Printer Driver Name: %s:\n",driver.info_3->name));
+       DEBUG(3,("Driver: %s:\n",driver.info_3->driverpath));
+       DEBUG(3,("Data File: %s:\n",driver.info_3->datafile));
+       DEBUG(3,("Language Monitor: %s:\n",driver.info_3->monitorname));
+       DEBUG(3,("Driver Location: %s:\n",location));
+       DEBUG(3,("Data Type: %s:\n",driver.info_3->defaultdatatype));
+       DEBUG(3,("Help File: %s:\n",driver.info_3->helpfile));
+       PACKI(desc,"N",count);                     /* number of files to copy */
+
+       for ( i=0; i<count && driver.info_3->dependentfiles && *driver.info_3->dependentfiles[i]; i++) 
+       {
+               trim_string(driver.info_3->dependentfiles[i], "\\print$\\WIN40\\0\\", 0);
+               PACKS(desc,"z",driver.info_3->dependentfiles[i]);         /* driver files to copy */
+               DEBUG(3,("Dependent File: %s:\n",driver.info_3->dependentfiles[i]));
        }
+       
+       /* sanity check */
+       if ( i != count )
+               DEBUG(3,("fill_printq_info_52: file count specified by client [%d] != number of dependent files [%i]\n",
+                       count, i));
+               
+       DEBUG(3,("fill_printq_info on <%s> gave %d entries\n", SERVICE(snum),i));
 
-  err:
+        desc->errcode=NERR_Success;
+       goto done;
 
+err:
        DEBUG(3,("fill_printq_info: Can't supply driver files\n"));
        desc->errcode=NERR_notsupported;
 
- done:
-       file_lines_free(lines); 
+done:
+       if ( printer )
+               free_a_printer( &printer, 2 );
+               
+       if ( driver.info_3 )
+               free_a_printer_driver( driver, 3 );
 }
 
 
@@ -751,88 +670,42 @@ static void fill_printq_info(connection_struct *conn, int snum, int uLevel,
                        fill_printjob_info(conn,snum,uLevel == 2 ? 1 : 2,desc,&queue[i],i);
        }
 
-       if (uLevel==52) {
-               fill_printq_info_52(conn, snum, uLevel, desc, count, queue, status);
-       }
+       if (uLevel==52)
+               fill_printq_info_52( conn, snum, desc, count );
 }
 
 /* This function returns the number of files for a given driver */
 static int get_printerdrivernumber(int snum)
 {
-       int i, result = 0;
-       BOOL ok = False;
-       pstring tok;
-       char *p;
-       char **lines = NULL;
-       pstring gen_line;
-       pstring drivername;
-       
-       /*
-        * Check in the tdb *first* before checking the legacy
-        * files. This allows an NT upload to take precedence over
-        * the existing fileset. JRA.
-        *
-        * we need to lookup the driver name prior to making the call
-        * to get_a_printer_driver_9x_compatible() and not rely on the
-        * 'print driver' parameter --jerry
-        */
-       
-       if ((get_driver_name(snum,drivername)) && 
-           (ok = get_a_printer_driver_9x_compatible(gen_line, drivername) == True)) 
-       {
-               p = gen_line;
-               DEBUG(10,("9x compatable driver line for [%s]: [%s]\n", drivername, gen_line));
-       } 
-       else 
-       {
-               /* didn't find driver in tdb */
-       
-               DEBUG(10,("snum: %d\nprinterdriver: [%s]\nlp_driverfile: [%s]\n",
-                         snum, drivername, lp_driverfile(snum)));
-               
-               lines = file_lines_load(lp_driverfile(snum), NULL);
-               if (!lines) 
-               {
-                       DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum),strerror(errno)));
-                       goto done;
-               } 
+       int                             result = 0;
+       NT_PRINTER_DRIVER_INFO_LEVEL    driver;
+       NT_PRINTER_INFO_LEVEL           *printer = NULL;
 
-               /* lookup the long printer driver name in the file description */
-               for (i=0;lines[i] && !ok;i++) 
-               {
-                       p = lines[i];
-                       if (next_token(&p,tok,":",sizeof(tok)) &&
-                          (strlen(drivername) == strlen(tok)) &&
-                          (!strncmp(tok,drivername,strlen(drivername)))) 
-                       {
-                               ok = True;
-                       }
-               }
+       if ( !W_ERROR_IS_OK(get_a_printer( &printer, 2, lp_servicename(snum))) ) {
+               DEBUG(3,("get_printerdrivernumber: Failed to lookup printer [%s]\n", 
+                       lp_servicename(snum)));
+               goto done;
        }
-       
-       if( ok ) 
-       {
-               /* skip 5 fields */
-               i = 5;
-               while (*p && i) {
-                       if (*p++ == ':') i--;
-               }
-               if (!*p || i) {
-                       DEBUG(3,("Can't determine number of printer driver files\n"));
-                       goto done;
-               }
                
-               /* count the number of files */
-               while (next_token(&p,tok,",",sizeof(tok)))
-                       i++;
-       
-               result = i;
+       if ( !W_ERROR_IS_OK(get_a_printer_driver(&driver, 3, printer->info_2->drivername, 
+               "Windows 4.0", 0)) )
+       {
+               DEBUG(3,("get_printerdrivernumber: Failed to lookup driver [%s]\n", 
+                       printer->info_2->drivername));
+               goto done;
        }
-
+       
+       /* count the number of files */
+       while ( driver.info_3->dependentfiles && *driver.info_3->dependentfiles[result] )
+                       result++;
+                       \
  done:
-
-       file_lines_free(lines);
-
+       if ( printer )
+               free_a_printer( &printer, 2 );
+               
+       if ( driver.info_3 )
+               free_a_printer_driver( driver, 3 );
+               
        return result;
 }