Summary of KMDF and WDM Equivalents - 1

Summary of KMDF and WDM Equivalents

September 7, 2006

Abstract

This paper provides information that is useful in porting drivers from the Microsoft® Windows® Driver Model (WDM) to the kernel-mode driver framework (KMDF) for the Microsoft Windows family of operating systems. It includes tables that show how KMDF objects, methods, and event callback functions correspond to WDM objects and functions. Readers of this paper should also see the companion paper titled Porting a Driver from WDM to KMDF, which provides additional information about porting.

This information applies for the following operating systems:
Microsoft Windows Vista™
Microsoft Windows Server® 2003
Microsoft Windows XP
Microsoft Windows 2000

The current version of this paper is maintained on the Web at:

Contents

Introduction

KMDF and WDM Object Types

WDM Driver Routines and Corresponding KMDF Event Callbacks

KMDF Methods and WDM Equivalents

WDM Equivalents for KMDF Buffer Pointers

Buffers for IRP_MJ_READ Requests

Buffers for IRP_MJ_WRITE Requests

Buffers for IRP_MJ_DEVICE_CONTROL Requests

Buffers for METHOD_NEITHER Requests

WDM IRPs and KMDF Event Callback Functions

KMDF Callbacks for IRP_MJ_PNP

KMDF Callbacks for IRP_MJ_POWER

Resources

Disclaimer

This is a preliminary document and may be changed substantially prior to final commercial release of the software described herein.

The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.

This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT.

Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place or event is intended or should be inferred.

© 2006 Microsoft Corporation. All rights reserved.

Microsoft, Windows, Windows NT, Windows Server, and Windows Vista are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.

Introduction

This paper provides tables that compare kernel-mode driver framework (KMDF) objects and methods with the corresponding Microsoft® Windows® Driver Mode (WDM) objects and functions. The tables list:

  • KMDF and WDM object types
  • WDM driver-defined routines and equivalent KMDF event callback functions
  • KMDF methods and the WDM functions that perform the equivalent operation
  • WDM equivalents for KMDF buffer pointers
  • KMDF callbacks that correspond to the WDM IRP codes

A companion to this paper titled Porting a Driver from WDM to KMDF outlines a strategy for porting and describes differences between the two driver models in greater detail. It is listed in the “Resources” section at the end of this paper.

KMDF and WDM Object Types

Table 1 shows how KMDF object types correspond to WDM objects and concepts.

Table 1. KMDF and WDM Object Types

KMDF object type / Corresponding WDM object type / Description of KMDF object
WDFCHILDLIST / DEVICE_RELATIONS for BusRelations / List of the child devices that are enumerated by a parent device
WDFCMRESLIST / CM_RESOURCE_LIST / Resource list that describes the hardware resources allocated to a device
WDFCOLLECTION / None (most closely related to LIST_ENTRY and its related functions) / Group of framework objects
WDFCOMMONBUFFER / PVOID returned by AllocateCommonBuffer / Shared memory buffer used for direct memory access (DMA)
WDFDEVICE / DEVICE_OBJECT / Device object
WDFDMAENABLER / DMA_ADAPTER / DMA adapter object
WDFDMATRANSACTION / None / A DMA transaction, including callback methods
WDFDPC / KDPC / Deferred procedure call (DPC) object
WDFDRIVER / DRIVER_OBJECT / Driver object
WDFFILEOBJECT / DEVICE_OBJECT / Device object that is the target of a create, cleanup, or close request
WDFINTERRUPT / PKINTERRUPT / Interrupt object
WDFIORESLIST / IO_RESOURCE_LIST / Resource range list that represents a possible logical configuration for a device
WDFIORESREQLIST / IO_RESOURCE_REQUIREMENTS_LIST / Resource requirements list for a device that specifies one or more resource lists
WDFIOTARGET / DEVICE_OBJECT / Target of an I/O request that a KMDF driver sends; framework calls ZwCreateFile when the driver opens the target
WDFKEY / HANDLE returned by ZwCreateKey or ZwOpenKey / Registry access
WDFLOOKASIDE / PAGED_LOOKASIDE_LIST or NPAGED_LOOKASIDE_LIST / Paged or nonpaged lookaside list
WDFMEMORY / None; accessed through a PVOID returned by memory allocation functions / Memory allocated from kernel-mode paged or nonpaged pool; WDFMEMORY is reference counted
WDFOBJECT / None / Generic object
WDFQUEUE / IO_CSQ / Cancel-safe I/O request packet (IRP) queue; WDFQUEUE supports state management, dispatching, serialization of I/O requests, and synchronization with Plug and Play
WDFREQUEST / IRP / I/O request packet for create, read, write, device I/O control, or internal device I/O control request
WDFSPINLOCK / KSPIN_LOCK / Spin lock
WDFSTRING / UNICODE_STRING / Reference-counted Unicode string
WDFTIMER / KTIMER / Timer object
WDFUSBDEVICE / Attached DEVICE_OBJECT for a USB-enumerated stack / Collection of all the WDFUSBINTERFACE objects for a device, which manages the configuration for the device
WDFUSBINTERFACE / USB_INTERFACE_DESCRIPTOR / Collection of all the settings on a specific USB interface number and a collection of all the currently selected WDFUSBPIPE objects for the current setting
WDFUSBPIPE / USBD_PIPE_HANDLE / USB pipe that is the target of I/O requests
WDFWAITLOCK / KEVENT, KeEnterCriticalRegion, KeLeaveCriticalRegion / Kernel dispatcher object (a PASSIVE_LEVEL lock)
WDFWMIINSTANCE / None; accessed through parameters to driver-defined DpWmiXxx callback functions / An instance of a Windows Management Instrumentation (WMI) data block. The KMDF object encapsulates the WMI GUID and instance index.
WDFWMIPROVIDER / None; accessed through parameters to driver-defined DpWmiXxx callback functions / WMI data block
WDFWORKITEM / IO_WORKITEM / Work item to be processed in a system worker thread at IRQL PASSIVE_LEVEL

WDM Driver Routines and Corresponding KMDF Event Callbacks

Table 2 lists the standard required and optional WDM driver routines with the KMDF equivalents. For some WDM routines, no KMDF equivalent is listed. Instead, the table specifies “None” or “Not supported”:

  • "None" means that KMDF does not define a corresponding routine, typically because the KMDF architecture does not require such a routine. In this case, the table indicates how a driver can perform the same task.
  • "Not supported" means that KMDF does not support this feature and drivers cannot use it.

Table 2. WDM Driver Routines and KMDF Equivalents

WDM driver routine / KMDF equivalent
AdapterControl / EvtProgramDma
AdapterListControl / EvtProgramDma
AddDevice / EvtDriverDeviceAdd
BugCheckCallback / None; use WDM routines
BugCheckDumpIoCallback / None; use WDM routines
BugCheckSecondaryDumpDataCallback / None; use WDM routines
Cancel / EvtRequestCancel or EvtIoCanceledOnQueue
ControllerControl / Not supported
CsqAcquireLock / None; framework supplies lock
CsqCompleteCanceledIrp / EvtRequestCancel
CsqInsertIrp / WdfRequestForwardToIoQueue and WdfRequestRequeue
CsqInsertIrpEx / WdfRequestForwardToIoQueue and WdfRequestRequeue
CsqPeekNextIrp / WdfIoQueueFindRequest
CsqReleaseLock / None; framework supplies lock
CsqRemoveIrp / WdfIoQueueRetrieveNextRequest, WdfIoQueueRetrieveFoundRequest, and WdfIoQueueRetrieveRequestByFileObject
CustomDpc / EvtDpcFunc
CustomThreadedDpc / None; driver should queue a work item from EvtDpcFunc
CustomTimerDpc / EvtTimerFunc
DispatchCleanup / EvtFileCleanup
DispatchClose / EvtFileClose
DispatchCreate / EvtDeviceFileCreate or EvtIoDefault
DispatchCreateClose / See DispatchCreate and DispatchClose
DispatchDeviceControl / EvtIoDeviceControl or EvtIoDefault
DispatchFlushBuffers / None; use EvtDeviceWdmIrpPreprocess
DispatchInternalDeviceControl / EvtIoInternalDeviceControl or EvtIoDefault
DispatchPnP / Many
DispatchPower / Many
DispatchQueryInformation / None; use EvtDeviceWdmIrpPreprocess
DispatchRead / EvtIoRead or EvtIoDefault
DispatchSetInformation / None; use EvtDeviceWdmIrpPreprocess
DispatchShutdown / EvtDeviceShutdownNotification (control device objects only)
DispatchSystemControl / EvtWmiXxx
DispatchWrite / EvtIoWrite or EvtIoDefault
DpcForIsr / EvtInterruptDpc
DllInitialize / Not supported
DllUnload / Not supported
DriverEntry / DriverEntry
InterruptMessageService / EvtInterruptIsr
InterruptService / EvtInterruptIsr
IoCompletion / CompletionRoutine
IoTimer / EvtTimerFunc
RegistryCallback / None; use WDM routines
Reinitialize / Not supported
StartIo / EvtIoRead, EvtIoWrite, EvtIoDeviceControl, EvtIoInternalDeviceControl, or EvtIoDefault with the queue dispatch type WdfIoQueueDispatchSequential
SynchCritSection / EvtInterruptSynchronize or
WdfInterruptAcquireLock followed by WdfInterruptReleaseLock
Unload / EvtDriverUnload, EvtCleanupCallback on the WDFDRIVER object
ExWorkItem / EvtWorkItem
IoWorkItem / EvtWorkItem

KMDF Methods and WDM Equivalents

Table 3 lists all the KMDF methods along with the WDM functions (and in some cases, pseudocode sequences) that perform the same task.

Table 3. KMDF Methods and WDM Equivalents

KMDF method / WDM equivalent
WdfCollectionCreate / Create and manipulate a list:
LIST_ENTRY
InitializeListHead
InsertHeadList
RemoveEntryList
IsListEmpty
WdfCollectionGetCount
WdfCollectionAdd
WdfCollectionRemove
WdfCollectionRemoveItem
WdfCollectionGetItem
WdfCollectionGetFirstItem
WdfCollectionGetLastItem
WdfChildListAddOrUpdateChildDescriptionAsPresent / In a bus driver, enumerate children and create child physical device objects (PDOs):
IoInvalidateDeviceRelations (BusRelations)
Respond to IRP_MN_QUERY_DEVICE_RELATIONS (BusRelations)
IoCreateDevice for a child PDO
WdfChildListBeginIteration
WdfChildListBeginScan
WdfChildListUpdateAllChildDescriptionsAsPresent
WdfChildListUpdateChildDescriptionAsMissing
WdfChildListEndIteration
WdfChildListEndScan
WdfFdoAddStaticChild
WdfPdoMarkMissing
WdfChildListGetDevice / None
WdfChildListRequestChildEject / IoRequestDeviceEject
WdfChildListRetrieveAddressDescription / None
WdfChildListRetrieveNextDevice / None
WdfChildListRetrievePdo / None
WdfChildListCreate / None
WdfCmResourceListAppendDescriptor / Add CM_PARTIAL_RESOURCE_DESCRIPTOR to the end of a CM_PARTIAL_RESOURCE_LIST
WdfCmResourceListGetCount / PCM_PARTIAL_RESOURCE_LISTCount
WdfCmResourceListGetDescriptor / CM_PARTIAL_RESOURCE_DESCRIPTOR
WdfCmResourceListInsertDescriptor / Add CM_PARTIAL_RESOURCE_DESCRIPTOR to CM_PARTIAL_RESOURCE_LIST
WdfCmResourceListRemove / Remove CM_PARTIAL_RESOURCE_DESCRIPTOR from CM_PARTIAL_RESOURCE_LIST
WdfCmResourceListRemoveByDescriptor / Remove CM_PARTIAL_RESOURCE_DESCRIPTOR from CM_PARTIAL_RESOURCE_LIST
WdfCommonBufferCreate / AllocateCommonBuffer
WdfCommonBufferCreateWithConfig / AllocateCommonBuffer
WdfCommonBufferGetAlignedLogicalAddress / LogicalAddress (PPHYSICAL_ADDRESS) returned by AllocateCommonBuffer
WdfCommonBufferGetAlignedVirtualAddress / Return value (PVOID) of AllocateCommonBuffer
WdfCommonBufferGetLength / Length (ULONG) passed to AllocateCommonBuffer
WdfControlDeviceInitAllocate / IoCreateDevice for a non-PnP (legacy Microsoft NT® 4.0-style) device object
WdfControlDeviceInitSetShutdownNotification / IoRegisterShutdownNotification
WdfControlFinishInitializing / Clear DO_DEVICE_INITIALIZING flag in DEVICE_OBJECT Flags for control device object
WdfDeviceAddDependentUsageDeviceObject / Affects IRP_MN_DEVICE_USAGE_NOTIFICATION for devices that support special files and depend on other devices
WdfDeviceAddQueryInterface / Provide custom IRP_MN_QUERY_INTERFACE handling
WdfDeviceAddRemovalRelationsPhysicalDevice / IRP_MN_QUERY_DEVICE_RELATIONS (RemovalRelations)
WdfDeviceAllocAndQueryProperty / IoGetDeviceProperty
WdfDeviceAssignMofResourceName / Supply MofResourceName value returned by DpWmiQueryRegInfo
WdfDeviceAssignS0IdleSettings / PoRegisterDeviceForIdleDetection with automatic I/O queue state management
WdfDeviceAssignSxWakeSettings / Request IRP_MN_WAIT_WAKE while the machine is in low power
WdfDeviceClearRemovalRelationsDevices / IRP_MN_QUERY_DEVICE_RELATIONS (RemovalRelations)
WdfDeviceConfigureRequestDispatching / None
WdfDeviceCreate / IoCreateDevice
WdfDeviceCreateDeviceInterface / IoRegisterDeviceInterface
WdfDeviceCreateSymbolicLink / IoCreateSymbolicLink
WdfDeviceEnqueueRequest / None
WdfDeviceGetAlignmentRequirement / Return DeviceObject-> AlignmentRequirement
WdfDeviceGetCharacteristics / Return DeviceObject->Characteristics
WdfDeviceGetDefaultQueue / None
WdfDeviceGetDevicePnpState / None
WdfDeviceGetDevicePowerPolicyState / None
WdfDeviceGetDevicePowerState / None
WdfDeviceGetDeviceState / None
WdfDeviceGetDriver / None
WdfDeviceGetFileObject / None
WdfDeviceGetIoTarget / PDEVICE_OBJECT used for IoCallDriver to next lower driver
WdfDeviceIndicateWakeStatus / Supply status to complete IRP_MN_WAIT_WAKE request
WdfDeviceInitAssignName / Supply DeviceName parameter for IoCreateDevice and IoCreateDeviceSecure
WdfDeviceInitAssignSDDLString / Supply DefaultSDDLString parameter for IoCreateDeviceSecure
WdfDeviceInitAssignWdmIrpPreprocessCallback / None
WdfDeviceInitFree / None
WdfDeviceInitRegisterPnpStateChangeCallback / None
WdfDeviceInitRegisterPowerPolicyStateChangeCallback / None
WdfDeviceInitRegisterPowerStateChangeCallback / None
WdfDeviceInitSetCharacteristics / Set DeviceObject>Characteristics
WdfDeviceInitSetDeviceClass / Supply DeviceClassGuid parameter for IoCreateDeviceSecure
WdfDeviceInitSetDeviceType / Supply DeviceType parameter for IoCreateDevice and IoCreateDeviceSecure
WdfDeviceInitSetExclusive / Sets Exclusive parameter for IoCreateDevice and IoCreateDeviceSecure
WdfDeviceInitSetFileObjectConfig / Set dispatch routines for IRP_MJ_CREATE, IRP_MJ_CLEANUP, and IRP_MJ_CLOSE
WdfDeviceInitSetIoInCallerContextCallback / None
WdfDeviceInitSetIoType / Set METHOD_BUFFERED, METHOD_IN_DIRECT, METHOD_OUT_DIRECT, or METHOD_NEITHER in DriverObject >Flags
WdfDeviceInitSetPnpPowerEventCallbacks / Provide callback functions to handle some aspects of IRP_MJ_PNP and IRP_MJ_POWER requests
WdfDeviceInitSetPowerInrush / Set DO_POWER_INRUSH in DriverObject>Flags
WdfDeviceInitSetPowerNotPageable / Clear DO_POWER_PAGABLE in DriverObject>Flags
WdfDeviceInitSetPowerPageable / Set DO_POWER_PAGABLE in DriverObject>Flags
WdfDeviceInitSetPowerPolicyEventCallbacks / None
WdfDeviceInitSetPowerPolicyOwnership / None
WdfDeviceInitSetRequestAttributes / None
WdfDeviceMiniportCreate / None
WdfDeviceOpenRegistryKey / IoOpenDeviceRegistryKey
WdfDeviceQueryProperty / IoGetDeviceProperty
WdfDeviceRemoveRemovalRelationsPhysicalDevice / IRP_MN_QUERY_DEVICE_RELATIONS (RemovalRelations)
WdfDeviceResumeIdle / PoRegisterDeviceForIdleDetection with automatic I/O queue state management
WdfDeviceRetrieveDeviceInterfaceString / Get SymbolicLinkName parameter returned by IoRegisterDeviceInterface
WdfDeviceRetrieveDeviceName / Get DeviceName parameter for IoCreateDevice and IoCreateDeviceSecure
WdfDeviceSetAlignmentRequirement / Set DeviceObject > AlignmentRequirement
WdfDeviceSetBusInformationForChildren / Supply PNP_BUS_INFORMATION returned by IRP_MN_QUERY_BUS_INFORMATION
WdfDeviceSetCharacteristics / Set DeviceObject->Characteristics
WdfDeviceSetDeviceInterfaceState / IoSetDeviceInterfaceState
WdfDeviceSetDeviceState / The sequence:
  • IoInvalidateDeviceState
  • IRP_MN_QUERY_PNP_DEVICE_STATE

WdfDeviceSetFailed / The sequence:
  • IoInvalidateDeviceState
  • IRP_MN_QUERY_PNP_DEVICE_STATE (PNP_DEVICE_FAILED)

WdfDeviceSetPnpCapabilities / Set Plug and Play capabilities in response to IRP_MN_QUERY_CAPABILITIES
WdfDeviceSetPowerCapabilities / Set power capabilities in response to IRP_MN_QUERY_CAPABILITIES
WdfDeviceSetSpecialFileSupport / Set special file support in response to IRP_MN_DEVICE_USAGE_NOTIFICATION
WdfDeviceSetStaticStopRemove / Supply information used to respond to IRP_MN_QUERY_REMOVE_DEVICE and IRP_MN_QUERY_STOP_DEVICE
WdfDeviceStopIdle / PoSetDeviceBusy
WdfDeviceWdmDispatchPreprocessedIrp / None
WdfDeviceWdmGetAttachedDevice / PDEVICE_OBJECT for next-lower device object
WdfDeviceWdmGetDeviceObject / PDEVICE_OBJECT for current device object
WdfDeviceWdmGetPhysicalDevice / PDEVICE_OBJECT for underlying PDO
WdfDmaEnablerCreate / IoGetDmaAdapter
WdfDmaEnablerGetFragmentLength / Maximum length of a single DMA transfer, used in calculating NumberOfMapRegisters
WdfDmaEnablerGetMaximumLength / PDEVICE_DESCRIPTION MaximumLength
WdfDmaEnablerGetMaximumScatterGatherElements / None
WdfDmaEnablerSetMaximumScatterGatherElements / None
WdfDmaEnablerWdmGetDmaAdapter / PDMA_ADAPTER
WdfDmaTransactionCreate / None
WdfDmaTransactionDmaCompleted / PutScatterGatherList or FlushAdapterBuffers
WdfDmaTransactionDmaCompletedFinal / PutScatterGatherList or FlushAdapterBuffers
WdfDmaTransactionDmaCompletedWithLength / PutScatterGatherList or FlushAdapterBuffers
WdfDmaTransactionExecute / For busmaster DMA, depends on Windows version:
  • BuildScatterGatherList on Windows XP and later releases
  • GetScatterGatherList on Windows 2000
For packet-based DMA, the sequence:
AllocateAdapterChannel
KeFlushIoBuffers
MapTransfer
WdfDmaTransactionGetBytesTransferred / None
WdfDmaTransactionGetCurrentDmaTransferLength / None
WdfDmaTransactionGetRequest / None
WdfDmaTransactionInitialize / CalculateScatterGatherList
WdfDmaTransactionInitializeUsingRequest / CalculateScatterGatherList
WdfDmaTransactionRelease / PutScatterGatherList or FlushAdapterBuffers
WdfDmaTransactionSetMaximumLength / None
WdfDpcCreate / KeInitializeDpc
WdfDpcEnqueue / KeInsertQueueDpc
WdfDpcCancel / KeRemoveQueueDpc
WdfDpcGetParentObject / None
WdfDpcWdmGetDpc / Return KDPC
WdfDriverCreate / Initialize DriverObject>Dispatch
WdfDriverGetRegistryPath / Registry path passed to DriverEntry
WdfDriverIsVersionAvailable / None
WdfDriverMiniportUnload / None
WdfDriverOpenParametersRegistryKey / None
WdfDriverRegisterTraceInfo / None
WdfDriverRetrieveVersionString / None
WdfDriverWdmGetDriverObject / PDRIVER_OBJECT
WdfFdoAddStaticChild / None
WdfFdoGetDefaultChildList / None
WdfFdoInitAllocAndQueryProperty / IoGetDeviceProperty
WdfFdoInitOpenRegistryKey / IoOpenDeviceRegistryKey
WdfFdoInitQueryProperty / IoGetDeviceProperty
WdfFdoInitSetDefaultChildListConfig / None
WdfFdoInitSetEventCallbacks / None
WdfFdoInitSetFilter / None
WdfFdoInitWdmGetPhysicalDevice / PDEVICE_OBJECT for the PDO
WdfFdoLockStaticChildListForIteration / None
WdfFdoQueryForInterface / Send IRP_MJ_PNP (IRP_MN_QUERY_INTERFACE) to the top of the current stack
WdfFdoRetrieveNextStaticChild / None
WdfFdoUnlockStaticChildListFromIteration / None
WdfFileObjectGetDevice / None
WdfFileObjectGetFileName / PFILE_OBJECTFileName
WdfFileObjectGetFlags / PFILE_OBJECTFlags
WdfFileObjectWdmGetFileObject / PFILE_OBJECT
WdfInterruptAcquireLock / KeAcquireInterruptSpinLock
WdfInterruptCreate / IoConnectInterrupt or IoConnectInterruptEx
WdfInterruptDisable / None
WdfInterruptEnable / None
WdfInterruptGetDevice / None
WdfInterruptGetInfo / Return information from CM_PARTIAL_RESOURCE_LIST
WdfInterruptQueueDpcForIsr / KeInsertQueueDpc
WdfInterruptReleaseLock / KeReleaseInterruptSpinLock
WdfInterruptSetPolicy / Set information in IO_RESOURCE_DESCRIPTOR for interrupt
WdfInterruptSynchronize / KeSynchronizeExecution
WdfInterruptWdmGetInterrupt / PKINTERRUPT
WdfIoQueueCreate / Any of the following queuing mechanisms:
KeInitializeDeviceQueue (PKDEVICE_QUEUE)
IoCsqInitialize (PIO_CSQ)
Tail.Overlay.ListEntry
WdfIoQueueDrain
WdfIoQueueDrainSynchronously
WdfIoQueueFindRequest
WdfIoQueueGetDevice
WdfIoQueueGetState
WdfIoQueuePurge
WdfIoQueuePurgeSynchronously
WdfIoQueueReadyNotify
WdfIoQueueRetrieveFoundRequest
WdfIoQueueRetrieveNextRequest
WdfIoQueueRetrieveRequestByFileObject
WdfIoQueueStop
WdfIoQueueStopSynchronously
WdfIoResourceListAppendDescriptor / Append IO_RESOURCE_DESCRIPTOR to IO_RESOURCE_LIST
WdfIoResourceListCreate / None
WdfIoResourceListGetCount / PIO_RESOURCE_LISTCount
WdfIoResourceListGetDescriptor / Get IO_RESOURCE_DESCRIPTOR from IO_RESOURCE_LIST
WdfIoResourceListInsertDescriptor / Insert IO_RESOURCE_DESCRIPTOR into IO_RESOURCE_LIST
WdfIoResourceListRemove / Remove IO_RESOURCE_DESCRIPTOR from IO_RESOURCE_LIST
WdfIoResourceListRemoveByDescriptor / Remove IO_RESOURCE_DESCRIPTOR from IO_RESOURCE_LIST
WdfIoResourceListUpdateDescriptor / Update _IO_RESOURCE_DESCRIPTOR
WdfIoResourceRequirementsListAppendIoResList / Append IO_RESOURCE_LIST to IO_RESOURCE_REQUIREMENTS_LIST
WdfIoResourceRequirementsListGetCount / PIO_RESOURCE_REQUIREMENTS_LISTAlternativeLists
WdfIoResourceRequirementsListGetIoResList / None
WdfIoResourceRequirementsListInsertIoResList / Insert IO_RESOURCE_LIST into IO_RESOURCE_REQUIREMENTS_LIST
WdfIoResourceRequirementsListRemove / None
WdfIoResourceRequirementsListRemoveByIoResList / Remove IO_RESOURCE_LIST from IO_RESOURCE_REQUIREMENTS_LIST
WdfIoResourceRequirementsListSetInterfaceType / PIO_RESOURCE_REQUIREMENTS_LISTInterfaceType
WdfIoResourceRequirementsListSetSlotNumber / PIO_RESOURCE_REQUIREMENTS_LISTSlotNumber
WdfIoTargetAllocAndQueryTargetProperty / IoGetDeviceProperty on target device PDO
WdfIoTargetClose / The sequence:
  • ObDereferenceObject (PFILE_OBJECT) or ZwClose
  • GUID_TARGET_DEVICE_REMOVE_COMPLETE event

WdfIoTargetCloseForQueryRemove / The sequence:
  • ObDereferenceObject (PFILE_OBJECT) or ZwClose
  • GUID_TARGET_DEVICE_QUERY_REMOVE event

WdfIoTargetCreate / None
WdfIoTargetFormatRequestForInternalIoctl / IoAllocateIrp or
IoBuildAsynchronousFsdRequest
WdfIoTargetFormatRequestForInternalIoctlOthers
WdfIoTargetFormatRequestForIoctl
WdfIoTargetFormatRequestForRead
WdfIoTargetFormatRequestForWrite
WdfIoTargetGetDevice / None
WdfIoTargetGetState / None
WdfIoTargetOpen / The sequence:
ZwCreateFile
IoRegisterPlugPlayNotification for EventCategoryTargetDeviceChange
IoGetDeviceObjectPointer
Handle GUID_DEVICE_INTERFACE_ARRIVAL and GUID_TARGET_DEVICE_REMOVE_CANCELLED
WdfIoTargetQueryForInterface / Send IRP_MJ_PNP for IRP_MN_QUERY_INTERFACE to the top of the target device’s stack
WdfIoTargetQueryTargetProperty / IoGetDeviceProperty on target device PDO
WdfIoTargetSendInternalIoctlOthersSynchronously / The sequence:
IoBuildDeviceIoControlRequest or IoBuildSynchronousFsdRequest
status = IoCallDriver();
If (status == STATUS_PENDING) {
KeWaitForSingleObject();
}
WdfIoTargetSendInternalIoctlSynchronously
WdfIoTargetSendIoctlSynchronously
WdfIoTargetSendReadSynchronously
WdfIoTargetSendWriteSynchronously
WdfIoTargetStart / None
WdfIoTargetStop / None
WdfIoTargetWdmGetTargetDeviceObject / PDEVICE_OBJECT for target device
WdfIoTargetWdmGetTargetFileHandle / HANDLE returned by ZwCreateFile for target device
WdfIoTargetWdmGetTargetFileObject / PFILE_OBJECT represented by handle returned by ZwCreateFile
WdfIoTargetWdmGetTargetPhysicalDevice / PDEVICE_OBJECT for target device PDO
WdfLookasideListCreate / ExInitializeNPagedLookasideList and ExInitializePagedLookasideList
WdfMemoryAssignBuffer / None
WdfMemoryCopyFromBuffer / RtlCopyMemory with bounds checking
WdfMemoryCopyToBuffer / RtlCopyMemory with bounds checking
WdfMemoryCreate / ExAllocatePool and ExAllocatePoolWithTag
WdfMemoryCreateFromLookaside / ExAllocateFromNPagedLookasideList and ExAllocateFromPagedLookasideList
WdfMemoryCreatePreallocated / None
WdfMemoryGetBuffer / None
WdfObjectAcquireLock / Either KeAcquireSpinlock or KeWaitForMutexObject/KeWaitForSingleObject (PRKMUTEX), depending on the object execution level
WdfObjectAllocateContext / ExAllocatePool
WdfObjectContextGetObject / None
WdfObjectCreate / ExAllocatePool
WdfObjectDereferenceActual / None
WdfObjectGetTypedContext / None
WdfObjectReferenceActual / None
WdfObjectReleaseLock / None
WdfPdoAddEjectionRelationsPhysicalDevice / Add ejection relations for IRP_MN_QUERY_DEVICE_RELATIONS (EjectionRelations)
WdfPdoClearEjectionRelationsDevices / Remove ejection relations for IRP_MN_QUERY_DEVICE_RELATIONS (EjectionRelations)
WdfPdoGetParent / None
WdfPdoInitAddCompatibleID / Add compatible ID in response to IRP_MN_QUERY_ID for BusQueryCompatibleIDs
WdfPdoInitAddDeviceText / IRP_MN_QUERY_DEVICE_TEXT
WdfPdoInitAddHardwareID / Add hardware ID in response to IRP_MN_QUERY_ID for BusQueryHardwareIDs
WdfPdoInitAllocate / IoCreateDevice for a PDO
WdfPdoInitAssignDeviceID / Supply device ID in response to IRP_MN_QUERY_ID for BusQueryDeviceID
WdfPdoInitAssignInstanceID / Supply instance ID in response to IRP_MN_QUERY_ID for BusQueryInstanceID
WdfPdoInitAssignRawDevice / Set PDEVICE_CAPABILITIESRawDeviceOK
WdfPdoInitSetDefaultLocale / Set Parameters.QueryDeviceText.LocaleId for IRP_MN_QUERY_DEVICE_TEXT
WdfPdoInitSetEventCallbacks / None
WdfPdoRemoveEjectionRelationsPhysicalDevice / Remove ejections relations for IRP_MN_QUERY_DEVICE_RELATIONS (EjectionRelations)
WdfPdoRequestEject / IoRequestDeviceEject
WdfPdoRetrieveAddressDescription / None
WdfPdoRetrieveIdentificationDescription / None
WdfPdoUpdateAddressDescription / None
WdfRegistryAssignMemory / ZwSetValueKey for any type
WdfRegistryAssignMultiString / ZwSetValueKey for REG_MULTI_SZ
WdfRegistryAssignString / ZwSetValueKey for REG_SZ
WdfRegistryAssignULong / ZwSetValueKey for REG_DWORD
WdfRegistryAssignUnicodeString / ZwSetValueKey for UNCODE_STRING
WdfRegistryAssignValue / ZwSetValueKey for any type
WdfRegistryClose / ZwClose
WdfRegistryCreateKey / ZwCreateKey
WdfRegistryOpenKey / ZwOpenKey
WdfRegistryQueryMemory / ZwQueryValueKey for any type
WdfRegistryQueryMultiString / ZwQueryValueKey for REG_MULTI_SZ
WdfRegistryQueryString / ZwQueryValueKey for REG_SZ
WdfRegistryQueryULong / ZwQueryValueKey for REG_DWORD
WdfRegistryQueryUnicodeString / ZwQueryValueKey for REG_SZ
WdfRegistryQueryValue / ZwQueryValueKey for any type
WdfRegistryRemoveKey / ZwDeleteKey
WdfRegistryRemoveValue / ZwDeleteValueKey
WdfRegistryWdmGetHandle / Handle returned by ZwCreateKey or ZwOpenKey
WdfRequestAllocateTimer / The sequence:
KeInitializeDpc
KeInitializeTimerEx to cancel an I/O request after a certain time period elapses
WdfRequestCancelSentRequest / IoCancelIrp
WdfRequestChangeTarget / None
WdfRequestComplete / IoCompleteRequest
WdfRequestCompleteWithInformation / IoCompleteRequest
WdfRequestCompleteWithPriorityBoost / IoCompleteRequest
WdfRequestCreate / IoAllocateIrp
WdfRequestCreateFromIrp / None
WdfRequestFormatRequestUsingCurrentType / IoCopyCurrentIrpStackLocationToNext
WdfRequestForwardToIoQueue / None
WdfRequestGetCompletionParams / Value of PIO_STACK_LOCATION in IoCompletion routine
WdfRequestGetFileObject / IoGetCurrentIrpStackLocationFileObject
WdfRequestGetInformation / Irp->IoStatus.Information
WdfRequestGetIoQueue / None
WdfRequestGetParameters / IoGetCurrentIrpStackLocation
WdfRequestGetRequestorMode / Irp>RequestorMode
WdfRequestGetStatus / Irp>IoStatus.Status
WdfRequestIsCanceled / Irp>Cancel
WdfRequestIsFrom32BitProcess / IoIs32bitProcess
WdfRequestMarkCancelable / IoSetCancelRoutine
WdfRequestProbeAndLockUserBufferForRead / ProbeForRead
WdfRequestProbeAndLockUserBufferForWrite / ProbeForWrite
WdfRequestRequeue / None
WdfRequestRetrieveInputBuffer / For details, see “WDM Equivalents for KMDF Buffer Pointers,” later in this paper.
WdfRequestRetrieveInputMemory
WdfRequestRetrieveInputWdmMdl
WdfRequestRetrieveOutputBuffer
WdfRequestRetrieveOutputMemory
WdfRequestRetrieveOutputWdmMdl
WdfRequestRetrieveUnsafeUserInputBuffer / For details, see “Buffers for METHOD_NEITHER Requests,” later in this paper.
WdfRequestRetrieveUnsafeUserOutputBuffer
WdfRequestReuse / IoReuseIrp
WdfRequestSend / IoCallDriver
WdfRequestSetCompletionRoutine / IoSetCompletionRoutine
WdfRequestSetInformation / Supply Irp>IoStatus.Information
WdfRequestStopAcknowledge / None
WdfRequestUnmarkCancelable / IoSetCancelRoutine with CancelRoutine set to NULL
WdfRequestWdmGetIrp / PIRP
WdfSpinLockRelease / KeReleaseSpinLock
WdfSpinLockAcquire / KeAcquireSpinLock
WdfSpinLockCreate / KeInitializeSpinLock
WdfStringCreate / None
WdfStringGetUnicodeString / None
WdfTimerGetParentObject / None
WdfTimerCreate / The sequence:
KeInitializeTimer
KeInitializeDpc
WdfTimerStart / KeSetTimerEx
WdfTimerStop / KeCancelTimer, then wait for the TimerDpc to run to completion
WdfUsbInterfaceGetConfiguredPipe / None
WdfUsbInterfaceGetConfiguredSettingIndex / None
WdfUsbInterfaceGetDescriptor / PUSB_INTERFACE_DESCRIPTOR
WdfUsbInterfaceGetEndpointInformation / PUSB_ENDPOINT_DESCRIPTOR
WdfUsbInterfaceGetInterfaceNumber / PUSBD_INTERFACE_INFORMATION InterfaceNumber
WdfUsbInterfaceGetNumConfiguredPipes / PUSBD_INTERFACE_INFORMATION NumberOfPipes
WdfUsbInterfaceGetNumEndpoints / PUSB_INTERFACE_DESCRIPTOR bNumEndpoints
WdfUsbInterfaceGetNumSettings / Number of interfaces in the configuration descriptor that has the same InterfaceNumber
WdfUsbInterfaceSelectSetting / URB_FUNCTION_SELECT_INTERFACE
WdfUsbTargetDeviceAllocAndQueryString / UsbBuildGetDescriptorRequest for DescriptorType USB_STRING_DESCRIPTOR_TYPE
WdfUsbTargetDeviceCreate / Retrieve USB configuration descriptor and USB device descriptor
WdfUsbTargetDeviceCyclePortSynchronously / Send IOCTL_INTERNAL_USB_CYCLE_PORT
WdfUsbTargetDeviceFormatRequestForControlTransfer / Set up _URB_HEADER for URB_FUNCTION_CONTROL_TRANSFER
WdfUsbTargetDeviceFormatRequestForCyclePort / Send IOCTL_INTERNAL_USB_CYCLE_PORT
WdfUsbTargetDeviceFormatRequestForString / Allocate a PURB to retrieve a USB_STRING_DESCRIPTOR
WdfUsbTargetDeviceFormatRequestForUrb / Allocate a PURB to send asynchronous I/O
WdfUsbTargetDeviceGetDeviceDescriptor / None
WdfUsbTargetDeviceGetInterface / USBD_ParseConfigurationDescriptorEx
WdfUsbTargetDeviceGetNumInterfaces / USBD_ParseConfigurationDescriptorEx in a loop
WdfUsbTargetDeviceIsConnectedSynchronous / Send IOCTL_INTERNAL_USB_GET_PORT_STATUS and check for USBD_PORT_CONNECTED status
WdfUsbTargetDeviceQueryString / UsbBuildGetDescriptorRequest for USB_STRING_DESCRIPTOR_TYPE
WdfUsbTargetDeviceResetPortSynchronously / Send IOCTL_INTERNAL_USB_RESET_PORT
WdfUsbTargetDeviceRetrieveConfigDescriptor / UsbBuildGetDescriptorRequest for USB_CONFIGURATION_DESCRIPTOR_TYPE
WdfUsbTargetDeviceRetrieveCurrentFrameNumber / PUSB_BUSIFFN_QUERY_BUS_TIME
WdfUsbTargetDeviceRetrieveInformation / The sequence:
PUSB_BUSIFFN_GETUSBDI_VERSION
UsbBuildGetStatusRequest (GET_STATUS_FROM_DEVICE) for a USB_CONFIGURATION_DESCRIPTOR
IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_GET_STATUS_FROM_DEVICE
PUSB_BUSIFFN_IS_DEVICE_HIGH_SPEED
WdfUsbTargetDeviceSelectConfig / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_SELECT_CONFIGURATION
WdfUsbTargetDeviceSendControlTransferSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_CONTROL_TRANSFER
WdfUsbTargetDeviceSendUrbSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB
WdfUsbTargetDeviceWdmGetConfigurationHandle / URB_SELECT_CONFIGURATION ConfigurationHandle
WdfUsbTargetPipeAbortSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_ABORT_PIPE
WdfUsbTargetPipeConfigContinuousReader / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
WdfUsbTargetPipeFormatRequestForAbort / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_ABORT_PIPE
WdfUsbTargetPipeFormatRequestForRead / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
WdfUsbTargetPipeFormatRequestForReset / Send IOCTL_INTERNAL_USB_RESET_PORT
WdfUsbTargetPipeFormatRequestForUrb / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set by driver
WdfUsbTargetPipeFormatRequestForWrite / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
WdfUsbTargetPipeGetInformation / USBD_PIPE_INFORMATION
WdfUsbTargetPipeGetType / PUSBD_PIPE_INFORMATION PipeType
WdfUsbTargetPipeIsInEndpoint / USB_ENDPOINT_DIRECTION_IN
WdfUsbTargetPipeIsOutEndpoint / USB_ENDPOINT_DIRECTION_OUT
WdfUsbTargetPipeReadSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
WdfUsbTargetPipeResetSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_RESET_PIPE
WdfUsbTargetPipeSendUrbSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set by driver
WdfUsbTargetPipeSetNoMaximumPacketSizeCheck / None
WdfUsbTargetPipeWdmGetPipeHandle / PUSBD_PIPE_INFORMATION PipeHandle
WdfUsbTargetPipeWriteSynchronously / Send IOCTL_INTERNAL_USB_SUBMIT_URB with UrbHeader.Function set to URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
WdfVerifierDbgBreakPoint / DbgBreakPoint
WdfVerifierKeBugCheck / KeBugCheck
WdfWaitLockAcquire / The sequence:
KeEnterCriticalRegion
KeWaitForSingleObject
WdfWaitLockCreate / KeInitializeEvent
WdfWaitLockRelease / The sequence:
KeSetEvent
KeLeaveCriticalRegion
WdfWdmDeviceGetWdfDeviceHandle / None
WdfWdmDriverGetWdfDriverHandle / None
WdfWmiInstanceCreate / IoWmiRegistrationControl with Action parameter set to WMIREG_ACTION_REGISTER;
Handle IRP_MJ_SYSTEM_CONTROL requests for any of the following minor IRP codes:
IRP_MN_CHANGE_SINGLE_INSTANCE
IRP_MN_CHANGE_SINGLE_ITEM
IRP_MN_DISABLE_COLLECTION
IRP_MN_DISABLE_EVENTS
IRP_MN_ENABLE_COLLECTION
IRP_MN_ENABLE_EVENTS
IRP_MN_EXECUTE_METHOD
IRP_MN_QUERY_ALL_DATA
IRP_MN_QUERY_SINGLE_INSTANCE
IRP_MN_REGINFO
IRP_MN_REGINFO_EX
WdfWmiInstanceDeregister
WdfWmiInstanceGetDevice
WdfWmiInstanceGetProvider
WdfWmiInstanceRegister
WdfWmiProviderCreate
WdfWmiProviderGetDevice
WdfWmiProviderGetTracingHandle
WdfWmiProviderIsEnabled
WdfWmiInstanceFireEvent / IoWmiWriteEvent
WdfWorkItemCreate / IoAllocateWorkItem
WdfWorkItemEnqueue / IoQueueWorkItem
WdfWorkItemFlush / KeWaitForSingleObject
WdfWorkItemGetParentObject / None

WDM Equivalents for KMDF Buffer Pointers

KMDF supplies the following methods for retrieving I/O buffers for buffered and direct I/O: