CmSetCallbackObjectContext routine

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 [in, out]

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 [in]

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 [in]

A pointer to driver-defined context information.

OldContext [out, optional]

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

Version

Available starting with Windows Vista.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= APC_LEVEL

See also

CmRegisterCallbackEx
CmUnRegisterCallback
REG_CREATE_KEY_INFORMATION
REG_CREATE_KEY_INFORMATION_V1
RegistryCallback
REG_OPEN_KEY_INFORMATION
REG_OPEN_KEY_INFORMATION_V1

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft