CmSetCallbackObjectContext function

The CmSetCallbackObjectContext routine associates specified context information with a specified registry object.

Syntax

NTSTATUS CmSetCallbackObjectContext(
  _Inout_   PVOID          Object,
  _In_      PLARGE_INTEGER Cookie,
  _In_      PVOID          NewContext,
  _Out_opt_ PVOID          *OldContext
);

Parameters

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_CREATE_KEY_INFORMATION REG_CREATE_KEY_INFORMATION_V1 REG_OPEN_KEY_INFORMATION REG_OPEN_KEY_INFORMATION_V1

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.

NewContext

A pointer to driver-defined context information.

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.

For more information about CmSetCallbackObjectContext and filtering registry operations, see Filtering Registry Calls.

Requirements

   
Windows version 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"

See Also

CmUnRegisterCallback

RegistryCallback

REG_OPEN_KEY_INFORMATION_V1

REG_OPEN_KEY_INFORMATION

CmRegisterCallbackEx

REG_CREATE_KEY_INFORMATION

REG_CREATE_KEY_INFORMATION_V1

Send comments about this topic to Microsoft