Windows Driver Kit: User-Mode Driver Framework
IWDFObject::DeleteWdfObject
The DeleteWdfObject method deletes a previously created Microsoft Windows Driver Foundation (WDF) object.
HRESULT
DeleteWdfObject(
void
);
Parameters
- None
Return Value
DeleteWdfObject returns S_OK if the operation succeeds. Otherwise, this method returns HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) or one of the other error codes that are defined in Winerror.h.
Comments
A driver is unable to delete some WDF objects. For example, the driver cannot delete a framework device object because the framework owns and controls device objects. For more information about the hierarchy of WDF objects, see Framework Object Hierarchy.
The driver typically deletes only WDF objects that it creates and owns. For more information about deleting framework objects, see Managing the Lifetime of Objects.
However, when a parent object is deleted, all child objects are automatically deleted. For example, if the driver called IWDFDevice::CreateIoQueue to create an I/O queue object, the newly created I/O queue becomes a child of the device object. The I/O queue object is then automatically deleted when the device object is deleted without the driver explicitly calling DeleteWdfObject.
Example
For a code example of how to use the DeleteWdfObject method, see IWDFDevice::SetPnpState.
Requirements
Headers: Declared in Wudfddi.h. Include Wudfddi.h.
See Also
IWDFDevice::CreateIoQueue