WDF model 這就是WDF模型,這個驅動模型,在windows WDM驅動設計中,已經講到了WDM模型和WDF模型的區別,從這個模型就可以看出: 對於應用程式來說,下面採用WDM驅動還是WDF驅動模型,是透明的,同樣,對於kernel Subsystems來說,對於WDM和WDF驅動,都是一樣的。 在看下Framework,對於WDF驅動架構來說,架構套件括Object Model,I/O Model ,Pnp/Power Model,Object Model的作用是建立WDF對象,I/O Model 就是輸入輸出,對於WDM和WDF來說,處理IO是不同的,對於wdm,是由IO管理器負責派遣IRP,但是對於WDF來說,是由IRP和IO隊列分發的。對於Pnp電源管理來說,架構模型基本上為我們做完了; 接著看Framework Objects,它是由Object Model建立的;而Callbacks就是我們做驅動程式必須編寫的回呼函數: 比如讀函數,寫函數,及特殊的pnp,電源管理等函數。 WDF 對象•About Methods, Properties, and Events •1)
Methods Perform actions on the object. •2)
Properties: •
3) Events: Are messages that indicate that something has occurred for which a driver might be required to take action. 3.WDM和WDF驅動
WDFDRIVER |
Driver object |
WDFDEVICE |
Device object |
WDFQUEUE |
Cancel-safe queue/Dispatching /Serialization/Auto-locking/Synch with PnP |
WDFREQUEST |
IRP |
WDFINTERRUPT |
Interrupt |
WDFDPC |
DPC |
WDFWORKITEM |
Work item |
WDFDMAENABLER |
DMA adapter object |
WDFIOTARGET |
Sending I/O to another driver - IoCallDriver |
WDFWAITLOCK |
Event dispatcher object – passive level lock |
WDFSPINLOCK |
Spinlock |
WDFMEMORY |
Kernel pool - refcounted |
WDFKEY |
Registry access |
4)Why to Port a Driver
•Here are a few advantages of porting a driver to KMDF.
•1)KMDF Drivers Are Simpler and Easier to Maintain.
•2)KMDF Manages Most Interactions with the Operating System.
•3)KMDF Supports Versioning and Is Tested for Each Release of the Operating System.