WdfObjectAddCustomTypeWithData macro
[Applies to KMDF and UMDF]
The WdfObjectAddCustomTypeWithData macro associates a framework object with a custom type, and optionally associates this pair with a data buffer and event callback functions.
Syntax
NTSTATUS WdfObjectAddCustomTypeWithData(
_handle,
_type,
_data,
_cleanup,
_destroy
);
Parameters
_handle
A handle to a framework object.
_type
The driver-defined name for the custom type.
_data
A pointer to a driver-supplied data buffer, or NULL. This parameter is optional.
_cleanup
A pointer to the driver's EvtCleanupCallback callback function, or NULL. This parameter is optional.
_destroy
A pointer to the driver's EvtDestroyCallback callback function, or NULL. This parameter is optional.
Return value
WdfObjectAddCustomTypeWithData returns STATUS_SUCCESS if the operation succeeds. Otherwise, this method might return one of the following values:
Return code | Description |
---|---|
STATUS_OBJECT_PATH_INVALID | The specified handle cannot have a custom type added to it. |
STATUS_INSUFFICIENT_RESOURCES | The custom type could not be allocated. |
STATUS_OBJECT_NAME_EXISTS | The driver has already added the specified custom type. |
STATUS_DELETE_PENDING | The object that the Handle parameter specifies is being deleted. In this situation, the framework does not add the custom type. |
Remarks
If your driver calls WdfObjectAddCustomTypeWithData with a pointer to a data buffer, the driver can provide an EvtCleanupCallback or EvtDestroyCallback callback function to deallocate the memory buffer when the object is deleted.
For more information about object custom types, see Framework Object Custom Types.
For a code example, see WdfObjectAddCustomType.
Requirements
Target platform |
Universal |
Minimum KMDF version |
1.11 |
Minimum UMDF version |
2.0 |
Header |
Wdfobject.h (include Wdf.h) |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for