Winprinfo tool

Saulius Krasuckas saulius2 at ar.fi.lt
Wed Apr 15 02:13:29 CDT 2009


I just have struck one tool related to Windows printer drivers [*]:

| 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.
   ...
| 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.
| 
| Driver Info / GetPrinterDriver()
|     By fetching a DRIVER_INFO_4 object for this printer, we're able to 
| show the version (kernel or user), as well as the paths used for all the 
| support files (driver and UI DLLs, plus the dependent files).
| 
| DEVMODE / DeviceCapabilities()
|     A central data structure involved in printing is the DEVMODE, which 
| is a collection of settings that apply to a printjob. Each printer has a 
| group of default settings that are used in the absense of any user input 
| on the subject, and they are managed with the printer's setup GUI.
|     Using the DeviceCapabilities() API function, we are able to extract 
| a number of individual parameters from the DEVMODE and report them.
| 
| GetDeviceCaps()
|     Since a printer is a "graphics device", there are some kinds of 
| parameters that are in common with other devices such as video displays. 
| The GetDeviceCaps() call returns a small set of numeric parameters, many 
| of which have no real interest to printer developers.
|
| EnumForms()
|     The NT print spooler supports the notion of "forms", which is simply 
| a way of attaching a name to a specifically-sized piece of output media. 
| There are built-in sizes such as Letter and Legal, but there are at 
| least a hundreds defined for oddball paper sizes all over the world. A 
| print driver can define additional forms as well, though the interaction 
| between the central forms database and the driver is still a little 
| unclear.

My guess, it could usefull for guys like Detlef working on Winspool and 
Co. also.  Then it can query printers over SMB.  One more (probably) 
interesting note (with regard to running the tool on Wine):

| 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.


[*] http://unixwiz.net/tools/winprinfo.html



More information about the wine-devel mailing list