Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

NT: Port Monitor

OSR_Community_UserOSR_Community_User Member Posts: 110,217
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

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Thanks for replying, Jeff. Questions/Responses within <edited for brevity!>:

    >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
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 15 November 2021 Live, Online
Writing WDF Drivers 24 January 2022 Live, Online
Developing Minifilters 7 February 2022 Live, Online
Kernel Debugging 21 March 2022 Live, Online