addprinterdriver

  • Thread starter Thread starter beginner
  • Start date Start date
B

beginner

I use following code to install my printer driver:
TestDriver_info.cVersion=2;
TestDriver_info.pName="MyDriver";

TestDriver_info.pEnvironment="Windows NT x86";
TestDriver_info.pDriverPath="C:\Windows\System32
\spool\drivers\w32x86\myDriverDrv.dll";
TestDriver_info.pDataFile="C:\Windows\System32
\spool\drivers\w32x86\myDriver.ppd"; ;
TestDriver_info.pConfigFile="C:\Windows\System32
\spool\drivers\w32x86\myDriverUi.dll"; ;

if(!AddPrinterDriver(NULL,3,(LPBYTE)&TestDriver_info))
{
return FALSE;
}


After the above code was executed, my driver was supposed
to install into directory
<winsysdir>\spooler\driver\w32x86\2\; but it did not. The
driver was installed to <winsysdir>\spooler\driver\w32x86
\67539\. This is strange. I used the same code to install
other driver, and it worked for other driver.

Why this piece of code does not work for my driver?
anything wrong with my driver dll? I thought even my
driver has some problem, it may not be work correctly
but it should be able to be installed.

Please help me out. Thank you very much in advance.

Jim
 
Jim,
First of all are you trying to install a user mode printer driver (driver
for Windows 2000/XP) or a kernel mode printer driver (driver for Windows NT
4.0)? In case you are installing a user mode printer driver you must use the
value 3 for cVersion in the driver info structure. Unless you are
specifically targeting NT4.0 with you driver I would encourage you do
develop a user mode printer driver.

Also, did you copy all your driver files to winsysdir>\spooler\driver\w32x86
before you called AddPrinterDriver?

Thanks,
Mikael
 
To install printer driver.
1. copy all the neccessary file into ....w32x86 directory.
2. You don't need to specify full path for DriverPath, DataFile and
ConfigFile field.
3. You need to specify the dependant file list also. (on your code it's
missing...)
Your code is for ketnel mode driver. Are you sure you are developing Kernel
mode driver ?
I just asking since kernel mode driver is not working on XP.

If this is not helpful, then your driver has a problem.
Please check the your entry in driver file which is called by spooler during
installation...
(I can't remember the name at this point.)

Sang Lee
 
this is a piece of my code
Dim Result As Long
Dim DI2 As DRIVER_INFO_2

With DI2
..cVersion = 2
..pName = "Lexmark T620 PS3"
..pEnvironment = "Windows NT"
..pDriverPath = "lexpsnt3.dll"
..pDataFile = "LEXT620.PPD"
..pConfigFile = "LEXPSNTU.DLL"
End With

Result = AddPrinterDriver("nt3772", 2, DI2)

I don't understand what is the problem. I want to install drivers on a
remote PC.


laurent207
 
Back
Top