Tech Support > Microsoft Windows > Drivers > Re: Problem installing WINxp printer driver
Re: Problem installing WINxp printer driver
Posted by Colin freeserve on June 30th, 2003


ok, I have tried the AddPrinter after the AddPrinterDriver API call

I get error code 1797 "ERROR_UNKNOWN_PRINTER_DRIVER"

If I check in the registry under
HKLM\\SYSTEM\CurrentControlSet\Control\Print\Print ers the printer is not
added.

AddPrinterDriver API call does not return an error?!

So the problem does seem to be with AddPrinterDriver - no printer driver
added, but no error logged.

If I manually add the printer - it appears in the registry path as above. If
I then run my install code I get error 1802 "ERROR_PRINTER_ALREADY_EXISTS"
which is what you would expect - and still points to a problem with the
AddPrinterDriver call.

Any other suggestions?

Regards
Colin


"Vikas Rao" <vikas@robosoftin.com> wrote in message
news:OCZ%23MYxODHA.3016@TK2MSFTNGP10.phx.gbl...


Posted by Colin freeserve on July 1st, 2003


Here is the code snippet - with AddPrinterDriver returning an ok response -
but no driver is installed:

static BOOL AddNCRPrinterDriver()
{
PRINTER_INFO_2 PrinterInfo2;
DRIVER_INFO_3 DriverInfo3;
BOOL bRetVal;

char szErrorMsg[100];
DWORD temp;


// cmck 06/03
// DriverInfo3.cVersion = 2;
// for xp only
DriverInfo3.cVersion = 3;
// end cmck 06/03

DriverInfo3.pName = TEXT("NCR Self-service Printer Module");
DriverInfo3.pEnvironment = TEXT("Windows NT x86");
DriverInfo3.pDriverPath = TEXT("RASDD.dll");
DriverInfo3.pDataFile = TEXT("HPPCL.dll");
DriverInfo3.pConfigFile = TEXT("NCROpenPrinter.dll");
DriverInfo3.pHelpFile = TEXT("RASDDUI.hlp");
DriverInfo3.pDependentFiles =
TEXT("HPPCL.dll\0RASDD.dll\0RASDDUI.dll\0RASDDUI.h lp\0NCROpenPrinter.dll\0")
;
DriverInfo3.pMonitorName = TEXT("NCR Self-service Printer Language
Monitor");
DriverInfo3.pDefaultDataType = NULL;

// cmck 06/03
// was
// return (AddPrinterDriver(NULL, 3, (LPBYTE) &DriverInfo3));

// now
bRetVal = AddPrinterDriver(NULL, 3, (LPBYTE) &DriverInfo3);

PrinterInfo2.pServerName = NULL;
PrinterInfo2.pPrinterName = TEXT("NCR Self-service Printer Module");
PrinterInfo2.pShareName = NULL;
PrinterInfo2.pPortName = TEXT("PAR12841:");
PrinterInfo2.pDriverName = TEXT("RASDD.dll");
PrinterInfo2.pComment = NULL;
PrinterInfo2.pLocation = NULL;
PrinterInfo2.pDevMode = NULL;
PrinterInfo2.pSepFile = NULL;
PrinterInfo2.pPrintProcessor = TEXT("HPPCL.dll");
PrinterInfo2.pDatatype = NULL;
PrinterInfo2.pParameters = NULL;
PrinterInfo2.pSecurityDescriptor = NULL;
PrinterInfo2.Attributes = PRINTER_ATTRIBUTE_DEFAULT;
PrinterInfo2.Priority = 1;
PrinterInfo2.DefaultPriority = 1;
PrinterInfo2.StartTime = 0;
PrinterInfo2.UntilTime = 0;
PrinterInfo2.Status = 0;
PrinterInfo2.cJobs = 0;
PrinterInfo2.AveragePPM = 0;

if(AddPrinter(NULL, 2, (LPBYTE) &PrinterInfo2) == NULL)
{
sprintf(szErrorMsg, TEXT("Failed to Add Printer (no handle) ERROR: %d"),
GetLastError());
AddToEventLog(EVENTLOG_ERROR_TYPE, szErrorMsg);
}

return bRetVal;

// end cmck 06/03

}