visual-studio-2022wdkwindows-driver

WDK UMDF V2 USB template code does not match documentation


I followed this article to generate a template project: https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/implement-driver-entry-for-a-usb-driver--umdf- It does in fact run on a target computer, and I can use WinDbg to read debug prints that I added for functions that trigger as they should when the device is plugged in or out. However, the article that allegedly explains how the template code works and what it does (https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/understanding-the-umdf-template-code-for-usb) seems to reference something entirely different. In fact, the template that was generated is exclusively C code VS2022 solution explorer showing C files, while the explanation is evidently about C++ code. Some other documentation also referenced things the template should do, which I can see happens in the code given in the explanation article but (as far as I can tell) not in what was actually generated.

I'm (obviously) very new to this and I'm wondering if it's something I did wrong or if this is a known issue?

I am completely certain this is a UMDF V2 project (my VS history is only showing USB UMDF V2 and the creation wizard doesn't even have such an option with UMDF V1). I did create a new project in the same way. Its file structure is completely identical.


Solution

  • In case someone has the same dumb problem:

    On further reading (https://learn.microsoft.com/en-us/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2), it seems that the old UMDF V1 used C++, and the new UMDF V2 is C.

    So, by all appearances, I got it backwards - the "create from template" documentation page is up-to-date and the "explanation" is for an older version that you should no longer use. My best guess at this point is to refer to KMDF documentation for UMDF V2 since they're supposed to be mostly the same.