KMDF object还支持如下类型:
Collection |
String |
DPC |
Timer |
Interrupt |
WMI |
Lookaside list |
Work item |
Registry key | |
Several objects for DMA: DMA enabler, DMA transaction, and common buffer |
Several objects for hardware resources: resource range list, resource list, and resource requirements list |
driver给object method传递handle作为参数
KMDF给event callback传递handle作为参数
KMDF对象类型
Object |
Type |
Description |
---|---|---|
Child list |
WDFCHILDLIST |
Represents a list of the child devices that the bus driver enumerates for a parent device. |
Collection |
WDFCOLLECTION |
Describes a list of similar objects, such as resources or the devices for which a filter driver filters requests. |
Device |
WDFDEVICE |
Represents an instance of a device. A driver typically has one WDFDEVICE object for each device that it controls. |
DMA common buffer |
WDFCOMMONBUFFER |
Represents a buffer that can be accessed by both the device and the driver to perform DMA. |
DMA enabler |
WDFDMAENABLER |
Enables DMA use by a device. A driver that handles device I/O operations has one WDFDMAENABLER object for each DMA channel within the device. |
DMA transaction |
WDFDMATRANSACTION |
Represents a single DMA transaction. |
DPC |
WDFDPC |
Represents a DPC. |
Driver |
WDFDRIVER |
Represents the driver itself and maintains information about the driver, such as its entry points. Every driver has one WDFDRIVER object. |
File |
WDFFILEOBJECT |
Represents a file object through which external drivers or applications can access the device. |
Generic object |
WDFOBJECT |
Represents a generic object for the driver to use as required. |
I/O queue |
WDFQUEUE |
Represents an I/O queue. A driver can have any number of WDFQUEUE objects. |
I/O request |
WDFREQUEST |
Represents a request for device I/O. |
I/O target |
WDFIOTARGET |
Represents a device stack to which the driver is forwarding an I/O request. A driver can have any number of WDFIOTARGET objects. |
Interrupt |
WDFINTERRUPT |
Represents a device's interrupt object. Any driver that handles device interrupts has one WDFINTERRUPT object for each IRQ or message-signaled interrupt (MSI) that the device can trigger. |
Lookaside list |
WDFLOOKASIDE |
Represents a dynamically sized list of identical buffers that are allocated from either paged or nonpaged pool. |
Memory |
WDFMEMORY |
Represents memory that the driver uses, typically an input or output buffer that is associated with an I/O request. |
Registry key |
WDFKEY |
Represents a registry key. |
Resource list |
WDFCMRESLIST |
Represents the list of resources that have actually been assigned to the device. |
Resource range list |
WDFIORESLIST |
Represents a possible configuration for a device. |
Resource requirements list |
WDFIORESREQLIST |
Represents a set of I/O resource lists, which comprises all possible configurations for the device. Each element of the list is a WDFIORESLIST object. |
String |
WDFSTRING |
Represents a counted Unicode string. |
Synchronization: spin lock |
WDFSPINLOCK |
Represents a spin lock, which synchronizes access to data DISPATCH_LEVEL. |
Synchronization: wait lock |
WDFWAITLOCK |
Represents a wait lock, which synchronizes access to data at PASSIVE_LEVEL. |
Timer |
WDFTIMER |
Represents a timer that fires either once or periodically and causes a callback routine to run. |
USB device |
WDFUSBDEVICE |
Represents a USB device. |
USB interface |
WDFUSBINTERFACE |
Represents an interface on a USB device. |
USB pipe |
WDFUSBPIPE |
Represents a configured pipe in a USB interface's setting. |
WMI instance |
WDFWMIINSTANCE |
Represents an individual WMI data block that is associated with a particular provider. |
WMI provider |
WDFWMIPROVIDER |
Represents the schema for WMI data blocks that the driver provides. |
Work item |
WDFWORKITEM |
Represents a work item, which runs in a system thread at PASSIVE_LEVEL. |
*Framework object之手创建它的driver管理,不能在不同的framework driver中共享
KMDF命名规则
method:WDF[Ojbect][Operation]
[Object]: method操作的KMDF object
[Operation]: method做什么
例子:WdfDeviceCreate
Property: Wdf[Object]{Set|Get}[Data] Wdf[Object]{Set|Get}[Data]
[Object]:函数操作的KMDF object
[Data]:field
例子:VOID WdfInterruptGetInfo
KMDF event callback function: Evt[Object][Description]
[Object]: 函数操作的object
[Description]: 什么触发了callback
大多数sample driver会把Evt替换为driver名称,比如Osrusbfx2 driver的callback函数前缀为OsrFxEvt
例子:若device能被eject,则注册一个EvtDeviceEject callback,在PnP向设备发送IRP_MN_EJECT请求时会调用。
*KMDF event与windows提供的kernel-dispatcher event(同步机制)无关
*driver无法创建,操控或等待一个KMDF event,因为KMDF event只是一个函数。可以使用timer object