Tech Support > Microsoft Windows > Drivers > Problem installing a printer driver programmatically
Problem installing a printer driver programmatically
Posted by Jean-François Boumard on June 8th, 2005


I try to instal, programmatically , a post script driver for a CN3102 minolta
printer
on Windows XP (There's tha same problem on Server 2003)

The first step of the driver installation driver (via function
SetupInstallFromInfSection) is good and driver files are copied
in the folder "%windir%\system32\spool\drivers\win32x86"

The i call "AddPrinterDriver" function to end printer driver
installation. here's the code :

DWORD err;
DRIVER_INFO_3 di3;

ZeroMemory(&di3, sizeof(DRIVER_INFO_3));

di3.cVersion = 3;
di3.pName = _T("Fiery X3e 31C-M PS v2.0 eu");
di3.pEnvironment = _T("Windows NT x86");
di3.pDriverPath = _T("EF4M4A11.PPD");
di3.pDataFile = _T("EF4M4A11.PPD");
di3.pConfigFile = _T("EF4M4A11.PPD");
di3.pHelpFile = NULL;
di3.pDependentFiles = m_pDependentFiles;
di3.pMonitorName = NULL;
di3.pDefaultDataType = NULL;

if (AddPrinterDriver(NULL, 3, (LPBYTE) &di3))
err = ERROR_SUCCESS;
else
err = GetLastError();


This call does not fail, but, although I tell him explicitly (parameter
cVersion of the structure) that the driver is for 2000/XP, files are
copied in the folder "%windir%\system32\spool\drivers\win32x86\0" which
is the folder for 98/95/Me drivers. In the registry, the driver id added
under the key
"HKLM\System\CurrentControlSet\Control\Print\Envir onments\Windows NT
x86\Version-0"

Then the call to AddPrinter function failed while not finding the driver

The installation of this driver via windows assistant succeed

Is there somebody to help me ??

Thank you for any suggestion.

JF

Posted by Shrinidhi.Kulkarni on June 8th, 2005


Hi Jean,

Alternatively you an use rundll32 , something like this.....

rundll32 printui,PrintUIEntry /if /z /q /b "GDI Printer Driver"
/f"oemsetup.inf" /r "FILE:" /m "GDI Printer Driver"
Hth,
--
With Thanks & Regards,
Shrinidhi.Kulkarni
25732293x5215

--
/*With Thanks & Regards,*/main(){char*s="-..0.*2*-2.*#&.*.*.**&.*"
/*-Shrinidhi.Kulkarni-*/"**..*#&6.*.******.*.*#-4&0.*****.0&*#2*."
/*25732293/96 X 5215*/"**.*****.*.*#&.*.**.*1***..*#-..*.**2*-2.*#"
,_;while(_=*s/4)_-=8,printf("\n%*s"+!!_,_<<!!*s,"_/_/_/"+*s++%4*2);}

__(_,i){return putchar(!i?_:'
'),i?__(_,--i)putchar('\r'),_);}main(_){return _
=='
'?_:__(main(_+_/_),_)^_["]!!!!!\224\\;<((.-\"h\/\227\231\/\214_+4=(h/KK"]-'!';}



"Jean-François Boumard" wrote: