Best approach for adapting WDM drivers

Hi,
I'm new to driver development and have been tasked with adapting an old Windows XP WDM device driver so it works on at least Windows 10. The device in question is a PCIe to multiple UARTs. I've read through old threads and questions similar to my situation, but given the expertise here, I'd like to discuss the best options for moving forward. Any advice or guidance would be greatly appreciated!
The device is a PCIe to multiple UARTS that would be used as COM ports by application. Current driver has lot of existing code from Plx and its API and heavily embedded with other applications. Bridge is exposed as system device in device manager. Ports have Instance SERENUM\Mouse... each.

  1. Should I consider rewriting the driver using KMDF frameworks for better compatibility with Windows 10 and ease of development?
  2. Is it advisable to use the existing driver code as a reference, or should I develop a new driver from scratch?
  3. Are there significant API changes or deprecated functions between XP and Windows 10 that I should be aware of? and is it worth updating those.
  4. Can a hybrid approach work, such that I keep the existing driver but replace certain PnP handling with WDF?
  5. Can anyone share sample code or open-source projects that could serve as a helpful starting point?
  6. Am aware of driver signing requirements, but want to get the ball rolling with design options and have the driver load without any errors!

Yes you should.

That is a badly formed question. The answer is 'yes', you should use the existing driver as a 'reference', and yes you should develop a new driver from scratch, although you may be able to salvage some of the old driver's device specific code.

There are a lot of changes, however with the exception of pool allocation, mostly XP drivers use a subset of existing kernel interfaces. XP era pool allocation syntax has been deprecated.

It can work but is a bad idea, as, in my opinion, it will be more work to stitch together this frankendriver than to just rewrite it.

All the MSFT driver samples are on github. Earlier versions of this repo had both WDM and KMDF (or UMDF) versions of drivers, but mostly all are WDF now. In particular see: Windows-driver-samples/general/PLX9x5x/sys at main · microsoft/Windows-driver-samples · GitHub

Always use driver verifier while testing. If you have the bandwidth, consider bringing up an HLK test environment early on, and have it incorporated into your build processes (manually as automating it still sucks as far as I know) as this can be the long pole for getting your product out the door.

1 Like

Thank you. I have been going through microsoft documentation on serial controller driver guides to understand the existing source better. Usage of modern SerCx doesn't seem to be applicable for my implementation ( no DMA controllers available on FPGA/UART and the existing application possibly accesses ports by name).

The Serial example on github is WDF but Serenum is still WDM which is used in current implementation. Am trying to take your advise of not doing hybrid but what are my other options ?

I am trying to learn more about WDF and time is not on my side. Should I try and update existing IO's to be compatible with Windows 10(i.e pool allocation etc) without making architectural changes and see if it runs and fix runtime errors as they arise. Please excuse lack of my knowledge in this area.(keen to put in effort and hours )

Sure. I would do that and then strongly suggest that this is a short term solution and that a longer term work item needs to be scheduled to convert it to wdf.