[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.
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
Resource list object
Resource requirements list object
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, 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, ControlDeviceDeleted, CtlDeviceFinishInitDeviceAdd, CtlDeviceFinishInitDrEntry, DriverCreate, InvalidReqAccessLocal, KmdfIrql, KmdfIrql2, MemAfterReqCompletedIntIoctlA, MemAfterReqCompletedIoctlA, MemAfterReqCompletedReadA, MemAfterReqCompletedWriteA, ReqDelete, ReqSendFail|