Finding the installed KMDF/WDF version

Is there a way to programmatically find the supported version of KMDF for an OS? Before dropping in a driver via the installer, i want to ensure that the installed framework is compatible.
This needs to work all the way back till vista, win7 and server 2008.

It doesn’t work that way.

You need to write your driver to use the newest version of the Framework that’s supported by the oldest OS you need to support… OR… write your driver to dynamically look for newer functions and use down-level equivalents if they’re not available.

Peter

I am not sure I follow. Win7 shipped with 1.9 was upgradable to 1.11. If I build my driver with kmdf major =1 and kmdf minor = 11 then it won’t load on an umpatched win7. How do I determine that before hand?

You ship your driver with the KMDF co-installer, which will install the necessary version of KMDF a,one with your driver.

That’s what the co-installer section is for.

Peter

  1. if the coinstaller isn’t shipped with, will it will pick up the already installed one? Or is it mandatory to ship the coinstaller?
  2. If I build the driver with the lowest possible coinstaller, say 1.9, then it should be automatically compatible with win10 as well, which ships 1.15?
  1. Yes… if you do not ship a co-installer your driver will use whatever version of the Framework that’s installed on the machine

  2. Yes. And, as I said before, you can do run-time checks (if you want) to detect the presence of up-level functionality, so you can use it when it’s available.

Peter

Thanks!

What would be the gotcha’s of using this:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Wdf01000\Parameters]
“MajorVersion”=dword:00000001
“MinorVersion”=dword:0000001f
“BuildNumber”=dword:00000000

Don’t do that. Is it really that hard to follow the rules? Remember, 1.31 is only available in Windows 10 build 2004. Your driver wouldn’t work any previous release.

@“Peter_Viscarola_(OSR)” said:
You ship your driver with the KMDF co-installer, which will install the necessary version of KMDF a,one with your driver.

That’s what the co-installer section is for.

Peter

Well if the OP got his answer may I ask if one can install the latest version of KMDF(like 1.31) on the lower OS(like win 7)?
or there are limitations to this

There are limitations. See the whole list here.

KMDF 1.11 is somewhat famous, as it’s the latest version that works back to Win 7… which many of us still have to support. Grudgingly.

Peter

@Tim_Roberts said:
Don’t do that. Is it really that hard to follow the rules? Remember, 1.31 is only available in Windows 10 build 2004. Your driver wouldn’t work any previous release.

I didn’t mean it like that Tim. My plan was (since I need to support win 7) to build my driver with 1.11, yes there are some win 7’s which didn’t upgrade to 1.11, hence the registry check to see the compatibility. Since 1.11 is old, that same binary should work all the way to win10 as well.

Well if the OP got his answer may I ask if one can install the latest version of KMDF(like 1.31) on the lower OS(like win 7)?

This used to be possible. In fact, at the beginning, it was the standard recommended procedure to include the coinstaller in your driver package.

That ended with 1.11. Starting with 1.13, that is no longer possible nor necessary. Each version only runs on those systems where it is pre-installed.