This site uses advanced css techniques
In the process of developing a Windows printer driver, we created this winprinfo tool to allow us to query the printer system from the point of view of an application: there are several APIs that permit a wide range of query. This tool exercises them all and proved to be indispensible in our development.
IMPORTANT - We don't mind providing support for the tool itself, but explaining what the output means or assisting in driver/application debugging is substantially beyond the scope of this free tool. The Microsoft MSDN documentation is pretty good at explaining what all these things mean, and we encourage you to Google for the names of the API functions in question for more information.
NOTE - this is a console-mode tool: it must be run in an MS-DOS/command window. If you try to run it from Explorer, it will flash a window and exit. This is not a GUI tool.
Both source and binary are available:
We promise that the binary was built from this source and that it performs no shenanigans. We don't promise that it has no bugs. Use at your own risk.
This code was built with Microsoft Visual C++, but strictly in the command-line mode, not using the IDE. In addition, the makefile requires GNU Make (gmake.exe) because we simply cannot stand Microsoft's NMAKE. You can get a GNU Make executable for Win32 here.
We built this to run strictly on NT/Win2000/XP platforms: if it works at all on Win95/98/ME, we'd be very surprised.
Once a printer has been opened, there are several Win32 API calls that can be used to query the device. These are DeviceCapabilities(), GetDeviceCaps, and EnumForms() (there may be more, but we'll add them as we discover them.
The output is quite verbose, and this shows part of the results for the HP LaserJet 4200 named "Upstairs LaserJet" (run on Win2000):
C> winprinfo --printer="Upstairs LaserJet" winprinfo 1.0.1 - 2003-10-02 - http://www.unixwiz.net/tools/ Querying printer "Upstairs LaserJet" via port "" Printer Upstairs LaserJet is open fetched DEVMODE, 4360 bytes DEVMODE PARAMETERS Numeric parameters: DC_COLLATE 1 DC_COLORDEVICE 0 DC_COPIES 9999 DC_DRIVER 1280 DC_DUPLEX 0 DC_EMF_COMPLIANT -1 DC_EXTRA 4140 DC_FIELDS 0x781ff43 DC_MINEXTENT w= 98.4 h= 190.5 mm DC_MAXEXTENT w= 297.0 h= 431.8 mm ...
The full output can be found HERE.
When winprinfo is run without command-line arguments, it reports a short "help" listing that summarizes the options available, which are expanded.
C> winprinfo --default Default = "HP4200 PS"
C> winprinfo --enumproviders [0] name = "Windows NT Local Print Providor" comment = "Locally connected Printers" descr = "Windows NT Local Printers" flags = PRINTER_ENUM_CONTAINER|ICON1 [1] name = "Windows NT Remote Printers" comment = "Remote Printers" descr = "Microsoft Windows Network" flags = PRINTER_ENUM_EXPAND|CONTAINER|ICON1 [2] name = "Windows NT Internet Provider" comment = "Internet URL Printers" descr = "Windows NT Internet Printing" flags = PRINTER_ENUM_CONTAINER|ICON1
C> winprinfo --enumprocessors Print processor dir: C:\WINDOWS\System32\spool\PRTPROCS\W32X86 [0] Processor = "ModiPrint" Datatype = "RAW" Datatype = "NT EMF 1.006" Datatype = "NT EMF 1.007" Datatype = "NT EMF 1.008" Datatype = "TEXT" [1] Processor = "HPPRN05" Datatype = "RAW" Datatype = "RAW [FF appended]" Datatype = "RAW [FF auto]" Datatype = "NT EMF 1.003" Datatype = "NT EMF 1.006" Datatype = "NT EMF 1.007" Datatype = "NT EMF 1.008" Datatype = "TEXT" [2] Processor = "WinPrint" Datatype = "RAW" Datatype = "RAW [FF appended]" Datatype = "RAW [FF auto]" Datatype = "NT EMF 1.003" Datatype = "NT EMF 1.006" Datatype = "NT EMF 1.007" Datatype = "NT EMF 1.008" Datatype = "TEXT"
This is a simple mirror of the revision log in our development environment, but it might lag a bit behind the version of the executable actually found on the web.
2006-07-22 1.1.0 --- Added enumeration of driver configuration 2005-05-24 1.0.9 --- Added --default 2005-05-04 1.0.8 --- Added --enumproviders & --enumprocessors 2005-02-15 1.0.7 --- Added PRINTER_INFO_2 data 2004-07-28 1.0.6 -- Minor packaging updates 2003-10-13 1.0.5 -- Lots of PC-Lint-suggested cleanups 2003-10-10 1.0.4 -- Added remote-server support 2003-10-10 1.0.3 -- Fixed error message when --printer option omitted Thu Oct 9 20:44:21 PDT 2003 -- version 1.0.2 -- Added the "--enum" parameter Thu Oct 2 13:22:20 PDT 2003 -- version 1.0.1 -- Initial release