NT: Port Monitor

I’ve written an NT 4.0 Port Monitor that does everything I want it to do (thanks to some on these lists!) as long as I don’t reboot the machine.

When I install the port, it shows the name OurPrintMaster for Port and OurPrintMasterPort for the Description, as I would expect. I can then select the Configure Port button and my dialog box appears, allowing me to do as I wish.

When I reboot the machine, the name for Port is still shown as OurPrintMaster, but the Description shown is Local Port. I believe this is coming straight out of localmon.dll.

In the original localmon code, they do a CreatePortEntry() for every port that they find in InitializePrintMonitor. The machine I’m developing on has the standard Local Ports, as well as HP JetDirectPorts and LAN Manager Printer Ports.

I set SoftICE to start on boot, and I can see that InitializePrintMonitor, as well as EnumPorts are getting hit. The Local Ports seem to be found in InitializePrintMonitor, using the same code from localmon.

If I check to see that the name is OurPrintMaster before I do the CreatePortEntry, then the Description comes up correctly in Properties | Ports, yet when I hit the Configure Port button, I get the message from localmon saying there’s nothing to configure.

It seems to me I have not figured out how to correctly identify myself from with my port monitor DLL, and the (usually clear and accurate) MS docs don’t seem to help.

Can anybody tell me what I’m missing here? After a reboot, why isn’t my ConfigurePort function called when I hot the Configure Port button?

Thanks,

Steve

Thanks for replying, Jeff. Questions/Responses within :

>The print job would correctly run
>>through our driver, but would then be sent to the Local Monitor instead of
>>our portmon. It appears that when a print job is processed, I believe the
>>Spooler has some table mapping ports to port monitors. Just after install,
>>our portmon->FILE: mapping was at the top of this table and thus was chosen
>>by the Spooler to handle the “FILE:” port job. After a reboot I believe that
>>our portmon ended up behind the LocalMon->FILE: mapping. Thus the job was
>>sent to the standard LocalMon instead of our portmon. This explained why no
>>other compression was performed on the print data stream but it still ended
>>up written to a file.
>>

I am not trying to override localmon’s handling of FILE:. I want localmon to continue to handle that, but what you describe is very similar to what I’m seeing.

I finally figured out that I need to do a CreatePortEntry in InitializePrintMonitor if the Port name is the same as mine. So now I got it to the point where I can reboot it and the Description shown is what I want it to be (OurPrintMasterPort), instead of Local Port.

Now however, when I click on Configure Port, Local Port (localmon) throws up an error message box saying, “Nothing to Configure for this port”, and when I print to the port, things go…well, not to me. I’m still missing something.

Any additional “light-shedding” would be greatly appreciated.

Thanks,

Steve