Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-07 22:44 UTC
[Samba] GetPrinter Level 2 does not get devmode
Hi all, I have uploaded the printer drivers succesfully on RedHat Linux/ Samba 2.2.4 server. I can download and print without any problems. But when I do Windows API call GetPrinter with PRINTER_INFO_2, the devmode in printer_info is always null. My code looks like HANDLE hPrinter=NULL; PRINTER_DEFAULTS pDefaults; pDefaults.DesiredAccess = PRINTER_ACCESS_USE; pDefaults.pDatatype=NULL; pDefaults.pDevMode=NULL; BOOL b = OpenPrinter(cPrinterName,&hPrinter,&pDefaults); if (b) { LPBYTE printerInfo=NULL; DWORD dwNeeded; b = GetPrinter(hPrinter,2,NULL,NULL,&dwNeeded); printerInfo = (LPBYTE) new BYTE [dwNeeded]; b = GetPrinter(hPrinter,2,printerInfo,dwNeeded,&dwNeeded); if(b) { PRINTER_INFO_2 * pInfo = (PRINTER_INFO_2 *)printerInfo; if(pInfo->pDevMode) { if (DMPAPER_A4 == pInfo->pDevMode->dmPaperSize) MessageBox("A4"); else MessageBox("LT"); } else MessageBox("Devmode is NUll"); } else DWORD dwErr = GetLastError(); delete printerInfo; printerInfo = NULL; } else MessageBox("Could not open printer"); ClosePrinter(hPrinter); hPrinter = NULL; I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks ok. I can see the devmode properly there. I repeat, I have no problems in downloading and printing. My requirement is I need to change some devmode setting of a printer depending on some parameters, and these should be visible when the driver is downloaded to the clients. While working on this, I found that the devmode returned by samba is null, and hence the driver reverts to the default devmode values stored in the driver. Thanks and regards, Rohit.
On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> Hi all, > > I have uploaded the printer drivers succesfully on RedHat Linux/ Samba > 2.2.4 server. I can download and print without any problems. But when I do > Windows API call GetPrinter with PRINTER_INFO_2, the devmode in > printer_info is always null. My code looks likeDid you ever get the client to set it? See the instructions in the Printing HOWTO one samba.org/docs> I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks > ok. I can see the devmode properly there.Are you sure about this? Did you check a level 10 debug log on the samba box? cheers, jerry
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-07 23:18 UTC
[Samba] GetPrinter Level 2 does not get devmode
Hi Jerry,>Did you ever get the client to set it? See the instructions in the >Printing HOWTO one samba.org/docsI uploaded the drivers from a Windows 2000 workstation, with the APW. No errors were reported on the windows machine. This is supposed to set the, printer_info and devmode on the samba server, right? No other step from the client is needed to set these, as far as I know. Also, PRINTER_INFO_2 is NOT null. PRINTER_INFO_2->devmode is null, (just to clarify). I have not checked the log while uploading, but while downloading I have and I see a message "Returning NULL devicemode!" .> I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks > ok. I can see the devmode properly there.When I say I have checked the dump of nt_printers.tdb, I mean I have visually verified. I know there can be something wrong with the tdb, so I am going to check again. Thanks and best regards, Rohit. On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> Hi all, > > I have uploaded the printer drivers succesfully on RedHat Linux/ Samba > 2.2.4 server. I can download and print without any problems. But when Ido> Windows API call GetPrinter with PRINTER_INFO_2, the devmode in > printer_info is always null. My code looks likeDid you ever get the client to set it? See the instructions in the Printing HOWTO one samba.org/docs> I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks > ok. I can see the devmode properly there.Are you sure about this? Did you check a level 10 debug log on the samba box? cheers, jerry
Are you now something about specific data binary data named "PrinterData", have length 560 bytes and saved into ntprinters.tdb file. This structure has any incompatibility between NT and 2K drivers. Thanks Arcady -----Original Message----- From: Rohit.Wadhwa@tabs.toshiba.com [mailto:Rohit.Wadhwa@tabs.toshiba.com] Sent: Thursday, October 10, 2002 5:38 AM To: jerry@samba.org Cc: samba@samba.org Subject: Re: [Samba] GetPrinter Level 2 does not get devmode Hi Jerry,>Did you ever get the client to set it? See the instructions in the >Printing HOWTO one samba.org/docsI uploaded the drivers from a Windows 2000 workstation, with the APW. No errors were reported on the windows machine. This is supposed to set the, printer_info and devmode on the samba server, right? No other step from the client is needed to set these, as far as I know. Also, PRINTER_INFO_2 is NOT null. PRINTER_INFO_2->devmode is null, (just to clarify). I have not checked the log while uploading, but while downloading I have and I see a message "Returning NULL devicemode!" .> I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks > ok. I can see the devmode properly there.When I say I have checked the dump of nt_printers.tdb, I mean I have visually verified. I know there can be something wrong with the tdb, so I am going to check again. Thanks and best regards, Rohit. On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> Hi all, > > I have uploaded the printer drivers succesfully on RedHat Linux/ Samba > 2.2.4 server. I can download and print without any problems. But when Ido> Windows API call GetPrinter with PRINTER_INFO_2, the devmode in > printer_info is always null. My code looks likeDid you ever get the client to set it? See the instructions in the Printing HOWTO one samba.org/docs> I have checked the dump of nt_printers.tdb by tdbtool and the tdb looks > ok. I can see the devmode properly there.Are you sure about this? Did you check a level 10 debug log on the samba box? cheers, jerry -- To unsubscribe from this list go to the following URL and read the instructions: http://lists.samba.org/mailman/listinfo/samba
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-08 16:51 UTC
[Samba] GetPrinter Level 2 does not get devmode
Hi Jerry, I just went through Samba-HOWTO-Collection.pdf and am going to try 'tickling' the driver to save a devmode. Thanks for the pointer Jerry. Also, I uploaded my drivers using the same process on a HP 4200 Print Server Appliance which runs Samba too. I do not remember tickling anything to set the devmode on the server , but I can still get devmode through my program. I guess I need to verify this again. regards, Rohit. Gerald Carter <jerry@samba. To: Rohit Wadhwa/DSE/IRV/TOSHIBA-TABS@TOSHIBA-TABS org> cc: samba@samba.org Subject: Re: [Samba] GetPrinter Level 2 does not get devmode 10/07/02 04:56 PM On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> I uploaded the drivers from a Windows 2000 workstation, with the APW. No > errors were reported on the windows machine. This is supposed to set > the, printer_info and devmode on the samba server, right? No other step > from the client is needed to set these, as far as I know.Rohit, Setting the devmode requires that the driver be executed (which samba can't do). Please read the Printing section regarding this in http://samba.org/samba/docs/Samba-HOWTO-Collection.pdf> Also, PRINTER_INFO_2 is NOT null. PRINTER_INFO_2->devmode is null, (just > to clarify). I have not checked the log while uploading, but while > downloading I have and I see a message "Returning NULL devicemode!" .Yes. I know exactly of the problem which you speak. :-) cheers, jerry --------------------------------------------------------------------- Hewlett-Packard http://www.hp.com SAMBA Team http://www.samba.org -- http://www.plainjoe.org "SAMS Teach Yourself Samba in 24 Hours" 2ed. ISBN 0-672-32269-2 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-08 17:09 UTC
[Samba] GetPrinter Level 2 does not get devmode
I did that a few weeks back, so I do not remember. I guess I used the PSA's web ui probably. regards, Rohit. Gerald Carter <jerry@samba. To: Rohit Wadhwa/DSE/IRV/TOSHIBA-TABS@TOSHIBA-TABS org> cc: samba@samba.org Subject: Re: [Samba] GetPrinter Level 2 does not get devmode 10/08/02 10:05 AM On Tue, 8 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> I just went through Samba-HOWTO-Collection.pdf and am going to try > 'tickling' the driver to save a devmode. Thanks for the pointer Jerry. > > Also, I uploaded my drivers using the same process on a HP 4200 Print > Server Appliance which runs Samba too. I do not remember tickling > anything to set the devmode on the server , but I can still get devmode > through my program. I guess I need to verify this again.native tools or through the PSA's web ui? The Web UI initializes the driver for you using some client side code. cheers, jerry
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-10 18:15 UTC
[Samba] GetPrinter Level 2 does not get devmode
Hi Jerry, I followed the steps as outlined by Gregory in one of the posts to the list. That is 1. Define your printer as a share or in CUPS as needed. 2. Define PRINT$ share with only admin users having write access. 3. Restart Samba and make sure printer appears in the server Printers folder 4. Right-click on the printer in question and choose Properties. 5. Respond "NO" to the "Install Driver now prompt" - Question: Why respond "No" at this point? All docs say to do so without explanation. 6. Once in the driver dialog go to the Advanced Tab and click on "New Driver" 7. Select your driver from wherever and make sure it copies to \\Server\PRINT$\W32X86\... 8. Click on Apply to make sure dialog gets updated with printer-specific configuration tabs. 9. On General tab, choose Printing Preferences - Basics and switch page layouts between portrait and landscape clicking OK in between to update the driver. - I assume at this point the driver Devmode is being set, correct? 10. The printer is now ready to install on Workstations. I see a little bit of a different behaviour. After step 8, I do not see the "Printing Preferences" button on the General Tab. I only see the "Printing Preferences" button if instead of "Apply" I hit "Ok" and bring up the printer properties again. (This I was able to reproduce with a HP LaserJet 8100 Series PCL 6 driver). (I am running Samba-2.2.4.) Then if I do step 9, I see that the devmode for my printer is written under HKEY_CURRENT_USER\Printers\DevModePerUser and HKEY_CURRENT_USER\Printers\DevModes2 on the Windows machine from which I was uploading the driver. If I run my program again to get the devmode, the Windows API call gets the devmode from the local registry. If I delete these registry values, it can only get the PRINTER_INFO_2 with null devmode from the server. Any pointers as to where the problem may lie would be very helpful. Thanks and regards, Rohit. Gerald Carter <jerry@samba. To: Rohit Wadhwa/DSE/IRV/TOSHIBA-TABS@TOSHIBA-TABS org> cc: samba@samba.org Subject: Re: [Samba] GetPrinter Level 2 does not get devmode 10/07/02 04:56 PM On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> I uploaded the drivers from a Windows 2000 workstation, with the APW. No > errors were reported on the windows machine. This is supposed to set > the, printer_info and devmode on the samba server, right? No other step > from the client is needed to set these, as far as I know.Rohit, Setting the devmode requires that the driver be executed (which samba can't do). Please read the Printing section regarding this in http://samba.org/samba/docs/Samba-HOWTO-Collection.pdf> Also, PRINTER_INFO_2 is NOT null. PRINTER_INFO_2->devmode is null, (just > to clarify). I have not checked the log while uploading, but while > downloading I have and I see a message "Returning NULL devicemode!" .Yes. I know exactly of the problem which you speak. :-) cheers, jerry --------------------------------------------------------------------- Hewlett-Packard http://www.hp.com SAMBA Team http://www.samba.org -- http://www.plainjoe.org "SAMS Teach Yourself Samba in 24 Hours" 2ed. ISBN 0-672-32269-2 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-10 19:13 UTC
[Samba] GetPrinter Level 2 does not get devmode
Hi Jerry, THANKS A TON ! This seems to be working. Regards, Rohit. "Gerald (Jerry) To: Rohit Wadhwa/DSE/IRV/TOSHIBA-TABS@TOSHIBA-TABS Carter" cc: samba@samba.org, <gsmith@ahbl.ca> <jerry@samba. Subject: Re: [Samba] GetPrinter Level 2 does not get devmode org> 10/10/02 11:55 AM On Thu, 10 Oct 2002 Rohit.Wadhwa@tabs.toshiba.com wrote:> 1. Define your printer as a share or in CUPS as needed. > 2. Define PRINT$ share with only admin users having write access. > 3. Restart Samba and make sure printer appears in the server Printers > folder > 4. Right-click on the printer in question and choose Properties. > 5. Respond "NO" to the "Install Driver now prompt" - Question: Why > respond > "No" at this point? All docs say to do so without explanation. > 6. Once in the driver dialog go to the Advanced Tab and click on "New > Driver" > 7. Select your driver from wherever and make sure it copies to > \\Server\PRINT$\W32X86\... > 8. Click on Apply to make sure dialog gets updated with printer-specific > configuration tabs. > 9. On General tab, choose Printing Preferences - Basics and switch page > layouts between portrait and landscape clicking OK in between to updatethe> driver. - I assume at this point the driver Devmode is being set,correct? Ahh... The general tab is for the per user device mode. You must do this from the advanced tab to set it on the server.> 10. The printer is now ready to install on Workstations. > > I see a little bit of a different behaviour. After step 8, I do not seethe> "Printing Preferences" button on the General Tab. I only see the"Printing> Preferences" button if instead of "Apply" I hit "Ok" and bring up the > printer properties again. (This I was able to reproduce with a HPLaserJet> 8100 Series PCL 6 driver). (I am running Samba-2.2.4.)Yeah. This is the same thing. Win2k does this. Please test again with 2.2.6rc2. There've been a lot of printing fixes since 2.2.4.> Then if I do step 9, I see that the devmode for my printer is written > under HKEY_CURRENT_USER\Printers\DevModePerUser and > HKEY_CURRENT_USER\Printers\DevModes2 on the Windows machine from which I > was uploading the driver. If I run my program again to get the devmode, > the Windows API call gets the devmode from the local registry. If I > delete these registry values, it can only get the PRINTER_INFO_2 with > null devmode from the server.cheers, jerry --------------------------------------------------------------------- Hewlett-Packard http://www.hp.com SAMBA Team http://www.samba.org -- http://www.plainjoe.org "SAMS Teach Yourself Samba in 24 Hours" 2ed. ISBN 0-672-32269-2 --"I never saved anything for the swim back." Ethan Hawk in Gattaca--
> 9. On General tab, choose Printing Preferences - Basics and switch page > layouts between portrait and landscape clicking OK in between to updatethe> driver. - I assume at this point the driver Devmode is being set,correct?>Ahh... The general tab is for the per user device mode. You must do this >from the advanced tab to set it on the server.Hmm. All controls on the Advanced tab are greyed out, even for the administrator connecting as root. Is this related to being unable to delete drivers from the ssrver using Server Properties? This was mentioned as one of the 2.2.6rc2 fixes. Greg
Rohit.Wadhwa@tabs.toshiba.com
2002-Oct-10 20:58 UTC
[Samba] GetPrinter Level 2 does not get devmode
Greg, Do you have the following defined in smb.conf ? 1. "write list = " under [print$] 2, "admin users" and "printer admin" under global settings. I think the advanced tab (or any other tab) will not be grayed out if these are defined. Hope this helps. Rohit. gsmith@ahbl.c a To: jerry@samba.org, Rohit Wadhwa/DSE/IRV/TOSHIBA-TABS@TOSHIBA-TABS cc: samba@samba.org, gsmith@ahbl.ca 10/10/02 Subject: RE: [Samba] GetPrinter Level 2 does not get devmode 01:12 PM> 9. On General tab, choose Printing Preferences - Basics and switch page > layouts between portrait and landscape clicking OK in between to updatethe> driver. - I assume at this point the driver Devmode is being set,correct?>Ahh... The general tab is for the per user device mode. You must do this >from the advanced tab to set it on the server.Hmm. All controls on the Advanced tab are greyed out, even for the administrator connecting as root. Is this related to being unable to delete drivers from the ssrver using Server Properties? This was mentioned as one of the 2.2.6rc2 fixes. Greg