问题
I came across kernel-mode drivers with very little experience. Here's what I am trying to do:
- Have a user-mode application that loads the driver.
- Have the user-mode application write to it, in order to send it an instruction.
- Have the driver send the RDMSR instruction to the Intel chip.
- Return the results back to the user-mode application.
I've read this article that describes the different ways in which you can accomplish this behavior (Buffered I/O, Direct I/O, or Neither).
My problem is this...the article has code that represents the way you would structure a WDM driver, and I was expecting to be able to create a WDM KMDF project template using the Windows Driver Kit, but when I downloaded the Windows Driver Kit (WDK), the only KMDF driver template was for a WDF driver. MSDN has an article describing the differences between the two. This is kind of strange to me. I was expecting to get a template out of the box that I could modify to work like in the article I've linked, but I don't see it. Why is there no template for a WDM KMDF driver?
Just an added note, you can quite easily tell the type of the driver based on the way it creates the device (IoCreateDevice implies WDM, whereas WdfDeviceCreate implies WDF).
回答1:
There is a lot of inconsistencies in the question. First of all, KMDF
is a subset of WDF
(and it's the only relevant WDF
part when talking about kernel drivers), so there is no contradiction between the two. Every kernel driver is essentially a WDM
driver. KMDF
is a framework in the WDM
and KMDF
drivers are normally called, well, KMDF
drivers, without mentioning WDM
. WDM
driver usually refers to driver that does not use any additional framework, such as KMDF
. Second, WDK
integrates with VS2012/2013 and you must have it installed in addition to WDK to get the templates. Third, WDM
template does appear in the list. If you don't have it, I suggest reinstalling the WDK
and VS
.
来源:https://stackoverflow.com/questions/24016441/why-is-there-no-wdm-kernel-mode-driver-template-in-windows-driver-kit