Installation of printer driver files

I want to add a virtual printer (using my driver) to the user’s system.

My impression is that AddPrinterDriverEx() and AddMonitor() are my
best bet. (although I didn’t find where I could specify a port monitor
for the new printer – only language monitor)

But perhaps there is a convenience function that will accept my .inf
file as input and do the rest? (after all, the add printer wizard
seems content using my .inf file)

On a related note, as a user, I often see “Install” in the context
menu of .inf files, but it rarely (if ever) does anything…? Is it
supposed to?

Should I look into using dpinst for this?


Rune

Re: “convenience function”

http://download.microsoft.com/download/8/2/c/82cffcfa-56f6-4fc3-bfa5-80c
d84793871/PrintUIUsersGuide.doc

The document appears to be 2003-specific, but I believe that the method
described will work on all or most modern versions of Windows.

ScottR

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rune Moberg
Sent: Wednesday, January 16, 2008 7:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Installation of printer driver files

I want to add a virtual printer (using my driver) to the user’s system.

My impression is that AddPrinterDriverEx() and AddMonitor() are my best
bet. (although I didn’t find where I could specify a port monitor for
the new printer – only language monitor)

But perhaps there is a convenience function that will accept my .inf
file as input and do the rest? (after all, the add printer wizard seems
content using my .inf file)

On a related note, as a user, I often see “Install” in the context menu
of .inf files, but it rarely (if ever) does anything…? Is it supposed
to?

Should I look into using dpinst for this?


Rune


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

printui.dll, as pointed out earlier, should work well for installing
your printer driver. I’ve used it from w2k and up without any problems.

You will need to install the port monitor separately from your printer
driver. I would do something like this:

  • Call AddMonitor() to install the monitor.
  • Call AddPort() to create a port on that monitor.
  • Use printui.dll to install the printer driver, specifying the port you
    have just created.

Hope this helps.

Rune Moberg wrote:

I want to add a virtual printer (using my driver) to the user’s system.

My impression is that AddPrinterDriverEx() and AddMonitor() are my
best bet. (although I didn’t find where I could specify a port monitor
for the new printer – only language monitor)

But perhaps there is a convenience function that will accept my .inf
file as input and do the rest? (after all, the add printer wizard
seems content using my .inf file)

On a related note, as a user, I often see “Install” in the context
menu of .inf files, but it rarely (if ever) does anything…? Is it
supposed to?

Should I look into using dpinst for this?

On Jan 16, 2008 6:46 PM, Faris Y. Yau wrote:
> - Call AddMonitor() to install the monitor.
> - Call AddPort() to create a port on that monitor.
> - Use printui.dll to install the printer driver, specifying the port you
> have just created.

Thanks guys. PrintUI.dll seems to be the ticket. Too bad it can’t
handle the port monitor inf file as well (at least I couldn’t trick it
into doing anything with my .inf).

FWIW:
rundll32 printui.dll,PrintUIEntry /if /b “My new printer” /f
bitmap.inf /m “Bitmap Driver” /r “file:” /w
seems to do the trick. I was surprised how sensitive it was to the /m switch.


Rune

Hi Rone! I am also doing the same thing what you have did… But, i don’t know how to step into my work… I have studied some of the required things like DDK documentation. Still now i don’t know how to step off… I am able to build all the samples given in kit. But, i don’t know how to run it… That is how to call the dll created… Please help me in knowing how to do it… And I am new to driver development field… This is my first driver developing that too virtual printer driver… I am not asking your code… I am asking just the steps i need to know everything like how to run EMF printer driver sample given in WDDK… I am doing it as a project work…

On Jan 22, 2008 7:23 AM, wrote:
> I am asking just the steps i need to know everything like how to run EMF printer
> driver sample given in WDDK… I am doing it as a project work…

You’ll need its .inf file.

Given the bitmap sample (print\oemdll\bitmap), look in the parent
directory (print\oemdll) and you’ll find the .inf.

Now, in the printers folder you can add a printer, and next you point
it to your .inf file. At this point the OS’ installer should copy the
relevant .dll to the system directory and you’ll be ready to print a
test page. (remember to set the new printer’s destination port to
FILE:)

To add your port monitor, you first have to install it (there is an
install button where you can select ports) and add it.

Programmatically, see Scott and Faris’ responses. I initially thought
AddPort() was not the right function for me, because I misunderstood
what the SDK said. (The SDK made it sound like AddPort() was exported
by the monitor DLL itself, which would be bad, given that my 32-bit
installer would have some interesting issues calling a 64-bit DLL’s
exports)


Rune