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.
--
To unsubscribe from this list go to the following URL and read the
instructions: http://lists.samba.org/mailman/listinfo/samba