WdfObjectCreate function (wdfobject.h)
[Applies to KMDF and UMDF]
The WdfObjectCreate method creates a general framework object.
Syntax
NTSTATUS WdfObjectCreate(
[in, optional] PWDF_OBJECT_ATTRIBUTES Attributes,
[out] WDFOBJECT *Object
);
Parameters
[in, optional] Attributes
A pointer to a WDF_OBJECT_ATTRIBUTES structure that contains driver-supplied attributes for the new object. This parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.
[out] Object
A pointer to a location that receives a handle to the new framework object.
Return value
WdfObjectCreate returns STATUS_SUCCESS if the operation succeeds. For a list of additional return values, see Framework Object Creation Errors.
This method might also return other NTSTATUS values.
Remarks
By default, the new general framework object's parent is the framework driver object that the WdfDriverCreate method created. You can use the ParentObject member of the WDF_OBJECT_ATTRIBUTES structure to specify a different parent. The framework deletes the general object when it deletes the parent object. If your driver does not change the default parent, the driver should delete the general object when it has finished using the object; otherwise, the object will remain until the I/O manager unloads your driver.
For more information about the WdfObjectCreate method, see Using General Framework Objects.
For more information about the cleanup rules for a framework object hierarchy, see Framework Object Life Cycle.
Examples
The following code example initializes an WDF_OBJECT_ATTRIBUTES structure and creates a general framework object.
WDF_OBJECT_ATTRIBUTES Attributes;
WDFOBJECT Object;
WDF_OBJECT_ATTRIBUTES_INIT(&Attributes);
status = WdfObjectCreate(
&Attributes,
&Object
);
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfobject.h (include Wdf.h) |
Library | Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF) |
IRQL | <=DISPATCH_LEVEL |
DDI compliance rules | DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf) |