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.