WdfObjectDelete function (wdfobject.h)
[Applies to KMDF and UMDF]
The WdfObjectDelete method deletes a framework object and its child objects.
void WdfObjectDelete( [in] WDFOBJECT Object );
A handle to framework object.
A bug check occurs if the driver supplies an invalid object handle.
Callback functions that are called at PASSIVE_LEVEL cannot delete timer objects. For more info, see EVT_WDF_TIMER callback function.
After a driver calls WdfObjectDelete, the specified object is deleted after its reference count becomes zero.
Drivers cannot call WdfObjectDelete to delete the following framework objects, because the framework always handles deletion of these objects:
- Framework child-list objects (WDFCHILDLIST)
- Framework device objects (WDFDEVICE), unless the driver has called WdfControlDeviceInitAllocate and created a control device object, which the driver must sometimes delete
- Framework driver objects (WDFDRIVER)
- Framework file objects (WDFFILEOBJECT)
- Framework interrupt objects (WDFINTERRUPT)
- Framework queue objects (WDFQUEUE), if an object represents a default I/O queue or if the driver has called WdfDeviceConfigureRequestDispatching to set up the queue to receive all I/O requests of a particular type
- Framework USB pipe objects (WDFUSBPIPE)
- Framework USB interface objects (WDFUSBINTERFACE)
- Framework WMI provider objects (WDFWMIPROVIDER)
- Resource range list object (WDFIORESLIST)
- Resource list object (WDFCMRESLIST)
- Resource requirements list object (WDFIORESREQLIST)
The WdfObjectDelete method can return before the framework has deleted the object and its child objects. The order in which the framework deletes child objects is not predictable.
For more information about WdfObjectDelete and the cleanup rules for a framework object hierarchy, see Framework Object Life Cycle.
The WdfObjectDelete method must be called at IRQL <= DISPATCH_LEVEL. If your driver is deleting a control device object, WdfObjectDelete must be called at IRQL = PASSIVE_LEVEL. Similarly, if your driver is deleting a common buffer, WdfObjectDelete must be called at IRQL = PASSIVE_LEVEL.
The following code example deletes a framework object and its child objects.
|Minimum KMDF version||1.0|
|Minimum UMDF version||2.0|
|Header||wdfobject.h (include Wdf.h)|
|Library||Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)|
|IRQL||See Remarks section.|
|DDI compliance rules||AddPdoToStaticChildList(kmdf), ControlDeviceDeleted(kmdf), CtlDeviceFinishInitDeviceAdd(kmdf), CtlDeviceFinishInitDrEntry(kmdf), DriverCreate(kmdf), InvalidReqAccessLocal(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), MemAfterReqCompletedIntIoctlA(kmdf), MemAfterReqCompletedIoctlA(kmdf), MemAfterReqCompletedReadA(kmdf), MemAfterReqCompletedWriteA(kmdf), ReqDelete(kmdf), ReqSendFail(kmdf)|
Submit and view feedback for