Cannot Install Print Driver on XP Only

Scott, Tim

I tried setting the sources files as follows…

_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WINXP)
WIN32_WINNT_VERSION=$(0x0501)
NTDDI_VERSION=$(NTDDI_WINXP)

and when I try to compile as XP x86 Free I get the following errors…

_NT_TARGET_VERSION SET TO WINXP
2>errors in directory d:\xpd\xpd_ui
2>c:\winddk\7600.16385.0\bin\makefile.new(6016) : error U1023: syntax error in expression
2>nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS1 NOLINK=1 PASS1_NOLIB=1 MAKEDIR_RELATIVE_TO_BASEDIR= failed - rc = 2

which brings me makefile.new line 6016…

! IF $(WIN32_WINNT_VERSION) == 0x0601

Continue to default to Vista due to extra requirement to link to ole32.dll in Win7 stubs

MIDL_TARGET=$(MIDL_TARGET_VISTA)
! ELSEIF $(WIN32_WINNT_VERSION) == 0x0600
MIDL_TARGET=$(MIDL_TARGET_VISTA)
! ELSEIF $(WIN32_WINNT_VERSION) == 0x0502
MIDL_TARGET=$(MIDL_TARGET_WINXP)
! ELSEIF $(WIN32_WINNT_VERSION) == 0x0501
MIDL_TARGET=$(MIDL_TARGET_WIN2K)
! ELSEIF $(WIN32_WINNT_VERSION) == 0x0500
MIDL_TARGET=$(MIDL_TARGET_WIN2K)
! ELSE
! if !$(WIN64)
MIDL_NO_ROBUST=1
! else
MIDL_TARGET=$(MIDL_TARGET_WIN2K)
! endif
! ENDIF

…which is the "if !$(WIN64) line

Cary Johnston

Use
WIN32_WINNT_VERSION=0x0501
not
WIN32_WINNT_VERSION=$(0x0501)
The “$(xxx)” construct means to expand a variable, you want to set it to
the constant 0x0501.

ScottR

Scott,

I changed the line, and it compiled with one error in my DrvPrinterEvent function.

On my switch case on the (DriverEvent) the compiler choked on…

case PRINTER_EVENT_CONFIGURATION_UPDATE:

The compiler did not recognize that as a valid constant. Since my code for that case did not do anything, I commented that case out, and then the project compiled with no errors.

It still will not install on XP. i still get the error…

“Unable To Install Printer. operation could not be completed”.

The interesting thing is that even though the printer does not show up in the printer and fax list,
when you right click in that list and choose …

“Server Properties”
and then the “Drivers” tab…
the failed print driver DOES show up there. If you select the driver and then click the “Properties” button…

The dialog shows the correct Config file, Data file and Driver File.

If you choose “Remove” to remove the dirver and the confirm the remove, it removes the driver from the list.

This has been the behaviour all along…the print driver faisl to install and will not show up in the printer list, but the driver itself shows up in the driver package list and can be removed.

Cary Johnston

Other things to try:

On the XP box, use DEPENDS on your rendering and UI DLLs to see if there
are any references missing.

Use an earlier WDK to build the driver & see if it works.

Put calls to OutputDebugString everywhere, including DLLMain.

Does your driver hook DrvTextOut?

ScottR

Scott,

I have never used DEPENDS, but I will research it and try it.

I think I have some of the older WDK’s around, so I will also try to build using those.

As far as calls to OutputDebugString, I pretty much have them everywhere already. Here is what that information yields…

When I install the XP x86 Free build on a Vista box, the debug strings reveal the following sequence during the install…

//----------------------------------------------------------

XPD_UI DLL Main - Process Attach

XPD_PG DrvQueryDriverInfo DRVQUERY_USERMODE
*** pBuffer = TRUE return TRUE

XPD_UI DLL Main - Process Detach

XPD_UI DLL Main - Process Attach

XPD_PG DrvQueryDriverInfo DRVQUERY_USERMODE
*** pBuffer = TRUE return TRUE

XPD_UI DLL Main - Process Detach

XPD_UI DLL Main - Process Attach

XPD_UI DrvPrinterEvent PRINTER_EVENT_INITIALIZE
— pPrinterName == \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— PRINTER_EVENT_FLAG_NO_UI Do not display UI
— return TRUE

XPD_UI DrvConvertDevMode
— pPrinterName == \GUYNOTEBOOK\Busta Print Driver,LocalOnly,DrvConvert
— pdmIn devmode == 0x00000000
— pdmOut devmode == 0x00000000
— pcbNeeded == 0x02b3e930
— *pcbNeeded == 0
— fMode == CDM_DRIVER_DEFAULT
*** *pcbNeeded = sizeof(DEVMODEW) = 220
— return FALSE

XPD_UI DrvConvertDevMode
— pPrinterName == \GUYNOTEBOOK\Busta Print Driver,LocalOnly,DrvConvert
— pdmIn devmode == 0x00000000
— pdmOut devmode == 0x016280d0
— pcbNeeded == 0x02b3e930
— *pcbNeeded == 220
— fMode == CDM_DRIVER_DEFAULT

— DEVMODEW Printout 0x016280d0

— dmDeviceName =
— dmSpecVersion = 0
— dmDriverVersion = 0
— dmSize = 0
— dmDriverExtra = 0
— dmFields = 0
— dmOrientation = 0
— dmPaperSize = 0
— dmPaperLength = 0
— dmPaperWidth = 0
— dmScale = 0
— dmCopies = 0
— dmDefaultSource = 0
— dmPrintQuality = 0
— dmPosition.x = 0
— dmPosition.y = 0
— dmDisplayOrientation = 0
— dmDisplayFixedOutput = 0
— dmColor = 0
— dmDuplex = 0
— dmYResolution = 0
— dmTTOption = 0
— dmCollate = 0
— dmFormName =
— dmLogPixels = 0
— dmBitsPerPel = 0
— dmPelsWidth = 0
— dmPelsHeight = 0
— dmDisplayFlags = 0
— dmNup = 0
— dmDisplayFrequency = 0
— dmICMMethod = 0
— dmICMIntent = 0
— dmMediaType = 0
— dmDitherType = 0
— dmReserved1 = 0
— dmReserved2 = 0
— dmPanningWidth = 0
— dmPanningHeight = 0

— xpd ini pathname = C:\Users\admin\AppData\Local\Busta\XPD.ini
— InitDevmode() called Initializing with defaults
— devmode->dmFields initialized to 27935

— DEVMODEW Printout 0x016280d0

— dmDeviceName = Busta Print Driver
— dmSpecVersion = 1025
— dmDriverVersion = 0
— dmSize = 220
— dmDriverExtra = 0
— dmFields = 27935
— dmOrientation = 1
— dmPaperSize = 256
— dmPaperLength = 2794
— dmPaperWidth = 2159
— dmScale = 100
— dmCopies = 1
— dmDefaultSource = 0
— dmPrintQuality = 4237
— dmPosition.x = 16777217
— dmPosition.y = 141495018
— dmDisplayOrientation = 65636
— dmDisplayFixedOutput = 277676032
— dmColor = 2
— dmDuplex = 0
— dmYResolution = 5076
— dmTTOption = 0
— dmCollate = 0
— dmFormName =
— dmLogPixels = 0
— dmBitsPerPel = 0
— dmPelsWidth = 0
— dmPelsHeight = 0
— dmDisplayFlags = 0
— dmNup = 0
— dmDisplayFrequency = 0
— dmICMMethod = 0
— dmICMIntent = 0
— dmMediaType = 0
— dmDitherType = 0
— dmReserved1 = 0
— dmReserved2 = 0
— dmPanningWidth = 0
— dmPanningHeight = 0

— return TRUE

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_BINNAMES
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_COLLATE
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_COLORDEVICE
— return 1

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_DUPLEX
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_STAPLE
— return FALSE

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_MAXEXTENT
— return pts->x = 2159
— return pts->y = 2794

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_MINEXTENT
— return x 1, y 1

XPD_UI DrvSplDeviceCaps
— hPrinter = 1734772
— pwDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— cchBuf = 0
— pDM devmode = 0x00000000
— iDevCap = DC_PAPERNAMES
— return 1

XPD_UI DrvSplDeviceCaps
— hPrinter = 1734772
— pwDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x01629590
— cchBuf = 19264
— pDM devmode = 0x00000000
— iDevCap = DC_PAPERNAMES
— return Custom Table Size

XPD_UI DrvSplDeviceCaps
— hPrinter = 1734772
— pwDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— cchBuf = 0
— pDM devmode = 0x00000000
— iDevCap = DC_MEDIAREADY
— return 1

XPD_UI DrvSplDeviceCaps
— hPrinter = 1734772
— pwDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x01629590
— cchBuf = 19264
— pDM devmode = 0x00000000
— iDevCap = DC_MEDIAREADY
— return Custom Table Size

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_NUP
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_PRINTERMEM
— return 64 MB

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_ORIENTATION
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_ENUMRESOLUTIONS
— return 1

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x016281b8
— pDevMode = 0x00000000
— iDevCap = DC_ENUMRESOLUTIONS
— pvOutput = x,y 4237 5076
— return 1

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_PERSONALITY
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_PRINTRATE
— return 9000

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_PRINTRATEUNIT
— return PRINTRATEUNIT_IPM

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_PRINTRATEPPM
— return 0

XPD_UI DrvDeviceCapabilities
— hPrinter = 1734772
— pDeviceName = \GUYNOTEBOOK\Busta Print Driver,LocalsplOnly
— pvOutput buffer = 0x00000000
— pDevMode = 0x00000000
— iDevCap = DC_VERSION
— return DM_SPECVERSION = 1025

//------------------------------------------------------------------------

The above sequence of DebugString calls are always output on any install.
The one exception is install on an XP box, in which case there are NO strings output at all.
Not even the first call from…

XPD_UI DLL Main - Process Attach

this seems to be telling me that the DLL is never being loaded, and it’s main function is never called.
And then afterwards none of the other calsl are made either.

My driver DOES hook DrvTextOut

Cary Johnston