WDM Programming Hints
Last updated Aug 11, 1998
The method is completely dependent on the operating system that you are planning to be running with.
If it is Windows NT 5.0, you can use driver layering and use the common serial port driver. The serial port can be reached by having your device be plug and play (during IoAttachDeviceToDeviceStack), or, get a handle with ZwCreateFile. After you have the handle, use IoCallDriver to send commands to the device. (Check NT Documentation, under Kernel Mode Drivers->Reference->Part 2->I/O Requests for Parallel and Serial Drivers.)
If it is Windows 98, a VxD layer will have to be written. The WDM driver sends all serial requests through the VxD layer to VCOMM.
When there are move than one device using the same driver, device specific information can't use the same keys from DriverEntry. The call IoOpenDeviceInterfaceRegistryKey can be used to get the device specific key. An application (Win32) can also create/read/write this key. Look at the documentation for SetupDiCreateDeviceInterfaceKey and SetupDiOpenDeviceInterfaceKey.
For various different reasons, sometimes a WDM driver need to use a function in another driver. If a driver is exporting functions for another WDM driver, the exporter needs to be loaded first. Otherwise the importer waits for the other driver to load before functioning, or may crash. (I've seen both happen.)
Soon, How to export functions for a WDM driver, and why you would want to.