What is the "right" way to do this???

I am trying to determine the “correct” way to accomplish my needs within the
Win 2000 and/or WDM framework.

I need to write a driver that can directly control (and receive interrupts
from) a standard serial port. I know that I/O is no problem since the OS
doesn’t do anything to stop my driver from reading and writing any I/O
ports. The problem is that SERIAL.SYS normally controls all the standard
serial ports in a system. For several reasons, I must field the interrupt
from the serial port directly. I have 2 scenarios I’m considering:

  1. Have my driver open the COM port through SERIAL.SYS - this will cleanly
    let the rest of the system know that the port is in use. The problem with
    this approach is that I can’t find a way to register with the serial driver
    that I want it to use MY interrupt handler code - in fact I’m pretty sure
    there’s no way to ask SERIAL.SYS to in any way, shape or form let another
    driver handle the interrupt for the device.

  2. Create a driver that claims itself as the driver for (as an example)
    COM2. This seems more practical, but then how do I tell the system that I
    want COM2 for my driver only, and I don’t want SERIAL.SYS to do anything
    with COM2? Is there a way to install my driver such that the system assigns
    the resources for COM2 to my driver, and somehow doesn’t pass the resources
    for COM2 to SERIAL.SYS for initialization??

Does anyone know of a simple “legacy” WDM driver example where the driver is
designed to handle non-PnP hardware (i.e. a COM port) and use explicitly
declared resources?

Patrick Klos
Network Software Engineer
NuMega Lab / Compuware Corporation