CmSetCallbackObjectContext function (wdm.h)
The CmSetCallbackObjectContext routine associates new context information with a specified registry object and callback routine.
Syntax
NTSTATUS CmSetCallbackObjectContext(
[in, out] PVOID Object,
[in] PLARGE_INTEGER Cookie,
[in] PVOID NewContext,
[out, optional] PVOID *OldContext
);
Parameters
[in, out] Object
A pointer to the registry key object that the driver is providing context information for. The driver obtains this pointer from the ResultObject member of one of the following structures:
REG_OPEN_KEY_INFORMATION
REG_OPEN_KEY_INFORMATION_V1
[in] Cookie
A pointer to a LARGE_INTEGER value that identifies the callback routine to associate the context with. The CmRegisterCallbackEx routine provided this value when you registered the callback routine.
[in] NewContext
A pointer to driver-defined context information.
[out, optional] OldContext
A pointer to a location that receives a pointer to context information that the driver previously associated with the specified object and cookie. This parameter is optional and can be NULL.
Return value
CmSetCallbackObjectContext returns STATUS_SUCCESS or another appropriate NTSTATUS-typed value.
Remarks
The CmSetCallbackObjectContext routine is available starting with Windows Vista.
A driver's RegistryCallback routine can call CmSetCallbackObjectContext for any registry key object after the object has been created or opened (that is, during a post-notification for a create operation, an open operation, or any subsequent notification up to the pre-notification of handle closure).
If a driver calls CmSetCallbackObjectContext, the driver's RegistryCallback routine will receive a RegNtCallbackObjectContextCleanup notification after the key object's handle has been closed or after the driver calls CmUnRegisterCallback to unregister the RegistryCallback routine. When the RegistryCallback routine receives this notification, the routine should release any resources that it allocated for the object's context.
If CmSetCallbackObjectContext is called before RegNtCallbackObjectContextCleanup notification, OldContext can still be referred by RegistryCallback which receives another notification. OldContext should not be released before RegNtCallbackObjectContextCleanup notification.
For more information about CmSetCallbackObjectContext and filtering registry operations, see Filtering Registry Calls.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available starting with Windows Vista. |
Target Platform | Universal |
Header | wdm.h (include Wdm.h, Ntddk.h, Ntifs.h) |
Library | NtosKrnl.lib |
DLL | NtosKrnl.exe |
IRQL | <= APC_LEVEL |