mabicha
mabicha

Reputation: 357

Error while installing Windows sample port monitor localmon

I am trying to install windows sample port monitor(localmon) provided in WDK. But I keep getting error while installing it:

An error occurred while installing port monitor 'DDK sample port monitor'. Please contact manufacturer for assistance.

I am using following instructions to install it:-

Open 'Devices and printers' folder. Right click on my targeted printer and choose 'printer properties'. Click the 'Ports' tab, and then click the 'Add Port...' button. On the Printer Ports dialog, click the 'New Port Type...' button. Type the path to the INF file in the text input box, and then click OK.

I am using windows 7, 64-bit version. Following is my INF file.

; monitor.inf
;
; Installation inf for printer port monitor
;
; (c) Copyright 2001-2003 DDK Example for print monitor installation
;

[Version]
Signature="$Windows NT$"
Provider=%PMProducer%
ClassGUID={4D36E979-E325-11CE-BFC1-08002BE10318}
Class=Printer

[PortMonitors]
"DDK Sample Port Monitor" = sampleportmon

[sampleportmon]
[email protected], @ddklocalui.dll
PortMonitorDll=ddklocalmon.dll

[SourceDisksFiles]
ddklocalmon.dll=1,,
ddklocalui.dll=1,,

[SourceDisksNames]
1="Sample Port Monitor Installation Disk",,,

[Strings]
PMProducer="Sample Port Monitor Company, Inc."

Can somebody help me here ?

Thanks a lot !!

Upvotes: 1

Views: 3977

Answers (2)

Jared Davison
Jared Davison

Reputation: 393

Problem Journey

In the INF file for the port monitor it needs to be directed to install the port monitor DLLs into the Windows\System32.

Following the WDK sample for the Language Port monitor one would think that the [DestinationDirs] directory id might be 66002. Note that the Port Monitor example .inf omits providing a [DestinationDir] section. https://learn.microsoft.com/en-us/windows-hardware/drivers/print/installing-a-print-monitor

The documentation for printer-dirids seems to confirm this. https://learn.microsoft.com/en-us/windows-hardware/drivers/print/printer-dirids

[DestinationDirs] 
DefaultDestDir = 66002

Dirid: 66002; Purpose: Represents the directory path to additional files to be copied to \System32 of the local system. See the paragraph following this table.; Directory Contents: Print monitor files

Note that INFGate tool will provide the following warning:

.\monitor.inf(xx): warning 8503: (DW22.23.8503) Use of DirID 66002 prevents full remote/point-and-print installation.

However, this still does not work in practice. Attempting to install the port monitor using 66002 again gives the same error that we started with.

Installing Port Monitor
---------------------------
An error occurred installing port monitor 'DDK sample port monitor'. Please contact the  manufacturer for assistance.
---------------------------
OK   
---------------------------

Solution

The driver documentation has another list of directory ids, and has another one:

https://learn.microsoft.com/en-us/windows-hardware/drivers/install/using-dirids

11 System directory. This is equivalent to %SystemRoot%\system32 for Windows 2000 and later versions of Windows..

My experience is that using Dirid value of 11 for the System directory seems to work on Windows XP & 10 for Port Monitors.

[DestinationDirs] 
DefaultDestDir = 11

Note that INFGate will still provide a warning about its discouraged use although it works. .\monitor.inf(56): warning 8505: (DW22.23.8505) DirID DefaultDestDir=11 is discouraged. Should be in 66000-66004 range in order to support remote install.

Upvotes: 0

mabicha
mabicha

Reputation: 357

I was finally able to fix the issue. It was a permissions issue. Method for getting to the Printer Properties with Administrator privileges in windows 7, is via Control Panel, System and Security, Administrative Tools, then right click on Print Management then Run as administrator. Once I did that I was able to install the port monitor.

Upvotes: 3

Related Questions