I try to install printer driver ( oemdll from WDK ) with
AddprinterDriver() function.

But I get each time the same error : Error 2.

How to add printer driver in Vista ?

Re: Printer installation in Vista by Ivco

Ivco
Thu Apr 19 12:28:02 CDT 2007

If you want to install the driver without inf file you should use
AddPrinterDriver.
The DRIVER_INFO structure could be your problem. Make sure that it is
filled out correctly.

Also check this out:
http://www.microsoft.com/whdc/driver/install/default.mspx/

I hope this helps

laurentjp@free.fr wrote:
> I try to install printer driver ( oemdll from WDK ) with
> AddprinterDriver() function.
>
> But I get each time the same error : Error 2.
>
> How to add printer driver in Vista ?
>

Re: Printer installation in Vista by laurentjp

laurentjp
Tue Apr 24 09:02:09 CDT 2007

On 19 avr, 19:28, Ivco <ivco...@abv.bg> wrote:
> If you want to install the driver without inf file you should use
> AddPrinterDriver.
> The DRIVER_INFO structure could be your problem. Make sure that it is
> filled out correctly.
>
> Also check this out:http://www.microsoft.com/whdc/driver/install/default.=
mspx/
>
> I hope this helps
>
>
>
> lauren...@free.fr wrote:
> > I try to install printer driver ( oemdll from WDK ) with
> > AddprinterDriver() function.
>
> > But I get each time the same error : Error 2.
>
> > How to add printer driver in Vista ?- Masquer le texte des messages pr=
=E9c=E9dents -
>
> - Afficher le texte des messages pr=E9c=E9dents -


Now, with my code, I get 1804 error code.

BOOL RetCode =3D FALSE;

int iLevel =3D 6;
DRIVER_INFO_6 DI6;

ZeroMemory(&DI6, sizeof(DI6));
DI6.cVersion =3D 3;
DI6.pName =3D (LPTSTR)"Bitmap";
//DI6.pEnvironment =3D "Windows NT x86" ;
DI6.pEnvironment =3D NULL ;
DI6.pDriverPath =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\\UNIDRV.DLL";
DI6.pDataFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\\w32x86\
\BITMAP.GPD" ;
DI6.pConfigFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\\UNIDRVUI.DLL";
DI6.pHelpFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\\w32x86\
\UNIDRV.HLP";

DI6.pDependentFiles =3D (LPTSTR)"BITMAP.DLL\0";//STDNAMES.GPD\0";
DI6.pMonitorName =3D NULL ;
DI6.pDefaultDataType =3D (LPTSTR)"RAW" ;
RetCode=3DAddPrinterDriverEx(NULL,iLevel,
(LPBYTE)&DI6,APD_COPY_ALL_FILES);

if ( !RetCode )
{
See_Error(_T("AddPrinterDriver")); return FALSE;
}

HANDLE aph;
DWORD Level =3D 2;
PRINTER_INFO_2 PI2;

ZeroMemory(&PI2, sizeof(PI2));
PI2.pServerName=3DNULL;
PI2.pPrinterName=3D(LPTSTR)"Bitmap";
PI2.pShareName=3DNULL;
PI2.pPortName=3D(LPTSTR)"FILE:";
PI2.pDriverName=3D(LPTSTR)"Bitmap";

PI2.pComment=3DNULL;
PI2.pDevMode=3DNULL;
PI2.pSepFile=3DNULL;
PI2.pPrintProcessor=3D(LPTSTR)"WinPrint";
PI2.pDatatype=3D(LPTSTR)"RAW";
PI2.pParameters=3DNULL;
PI2.pSecurityDescriptor=3DNULL;

PI2.Attributes=3DPRINTER_ATTRIBUTE_RAW_ONLY || PRINTER_ATTRIBUTE_LOCAL;
PI2.Priority=3D1;
PI2.DefaultPriority=3D1;
PI2.StartTime=3D0;
PI2.UntilTime=3D0;
PI2.Status=3D0;
PI2.cJobs=3D0;
PI2.AveragePPM=3D0;
aph=3DAddPrinter(NULL,Level,(LPBYTE)&PI2);
if ( aph=3D=3DNULL )
{
See_Error(_T("AddPrinter")); return FALSE;
}
else ClosePrinter(aph);

RetCode =3D TRUE;

What's is wrong ?


Re: Printer installation in Vista by laurentjp

laurentjp
Wed Apr 25 01:56:01 CDT 2007

On 19 avr, 19:28, Ivco <ivco...@abv.bg> wrote:
> If you want to install the driver without inf file you should use
> AddPrinterDriver.
> The DRIVER_INFO structure could be your problem. Make sure that it is
> filled out correctly.
>
> Also check this out:http://www.microsoft.com/whdc/driver/install/default.=
mspx/
>
> I hope this helps
>
>
>
> lauren...@free.fr wrote:
> > I try to install printer driver ( oemdll from WDK ) with
> > AddprinterDriver() function.
>
> > But I get each time the same error : Error 2.
>
> > How to add printer driver in Vista ?- Masquer le texte des messages pr=
=E9c=E9dents -
>
> - Afficher le texte des messages pr=E9c=E9dents -


And now, with my code, I get error : 1804.

BOOL RetCode =3D FALSE;

int iLevel =3D 6;
DRIVER_INFO_6 DI6;

ZeroMemory(&DI6, sizeof(DI6));
DI6.cVersion =3D 3;
DI6.pName =3D (LPTSTR)"Bitmap";
//DI6.pEnvironment =3D "Windows NT x86" ;
DI6.pEnvironment =3D NULL ;
DI6.pDriverPath =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\\UNIDRV.DLL";
DI6.pDataFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\
\BITMAP.GPD" ;
DI6.pConfigFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\\UNIDRVUI.DLL";
DI6.pHelpFile =3D (LPTSTR)"C:\\WINDOWS\\system32\\spool\\drivers\
\w32x86\
\UNIDRV.HLP";

DI6.pDependentFiles =3D (LPTSTR)"BITMAP.DLL\0";//STDNAMES.GPD\0";
DI6.pMonitorName =3D NULL ;
DI6.pDefaultDataType =3D (LPTSTR)"RAW" ;
RetCode=3DAddPrinterDriverEx(NULL,iLevel,
(LPBYTE)&DI6,APD_COPY_ALL_FILES);

if ( !RetCode )
{
See_Error(_T("AddPrinterDriver")); return FALSE;
}

HANDLE aph;
DWORD Level =3D 2;
PRINTER_INFO_2 PI2;

ZeroMemory(&PI2, sizeof(PI2));
PI2.pServerName=3DNULL;
PI2.pPrinterName=3D(LPTSTR)"Bitmap";
PI2.pShareName=3DNULL;
PI2.pPortName=3D(LPTSTR)"FILE:";
PI2.pDriverName=3D(LPTSTR)"Bitmap";

PI2.pComment=3DNULL;
PI2.pDevMode=3DNULL;
PI2.pSepFile=3DNULL;
PI2.pPrintProcessor=3D(LPTSTR)"WinPrint";
PI2.pDatatype=3D(LPTSTR)"RAW";
PI2.pParameters=3DNULL;
PI2.pSecurityDescriptor=3DNULL;

PI2.Attributes=3DPRINTER_ATTRIBUTE_RAW_ONLY || PRINTER_ATTRIBUTE_LOCAL;
PI2.Priority=3D1;
PI2.DefaultPriority=3D1;
PI2.StartTime=3D0;
PI2.UntilTime=3D0;
PI2.Status=3D0;
PI2.cJobs=3D0;
PI2.AveragePPM=3D0;
aph=3DAddPrinter(NULL,Level,(LPBYTE)&PI2);
if ( aph=3D=3DNULL )
{
See_Error(_T("AddPrinter")); return FALSE;
}
else ClosePrinter(aph);

RetCode =3D TRUE;