Export (0) Print
Expand All

Specifying Context Information

The configuration manager provides several ways for registry filtering drivers to assign context information to registry operations. A registry filtering driver can:

  • Assign context information to the RegistryCallback routine.

    When your driver calls CmRegisterCallback or CmRegisterCallbackEx to register for notification of a registry operation, the driver can specify a driver-defined context value. The configuration manager passes this context value to the driver's RegistryCallback routine each time that the configuration manager calls the routine.

    This context information is supported starting with Windows XP.

  • Assign context information to a registry operation.

    Drivers can store operation-specific context information in the CallContext member of each REG_XXX_KEY_INFORMATION structure that the driver's RegistryCallback routine receives. If your driver receives both a pre-notification and a post-notification for a registry operation, the REG_POST_OPERATION_INFORMATION structure contains a pointer to the appropriate pre-notification structure. When a RegistryCallback routine receives a REG_POST_OPERATION_INFORMATION structure, the CallContext member of that structure matches the CallContext member of the pre-notification structure.

    The CallContext member of these structures is available starting with Windows Vista.

  • Assign context information to a registry key object.

    A RegistryCallback routine can assign context information to a particular registry key object. If the RegistryCallback routine calls CmSetCallbackObjectContext to assign context information to a key object, subsequent pre-notifications and post-notifications for all operations on the object will include the context value in the ObjectContext member of each REG_XXX_KEY_INFORMATION structure. If a driver provides multiple RegistryCallback routines, the driver can assign different context information for each routine, for a single registry key object.

    If a driver has called CmSetCallbackObjectContext, the driver's RegistryCallback routine will receive a RegNtCallbackObjectContextCleanup notification after the key object's handle has been closed. In response to this notification, the routine should release any resources that it allocated for the object's context. When the Argument1 parameter to the RegistryCallback routine is RegNtCallbackObjectContextCleanup, the Argument2 parameter is a pointer to a REG_CALLBACK_CONTEXT_CLEANUP_INFORMATION structure that contains a pointer to the context.

    The CmSetCallbackObjectContext routine and RegNtCallbackObjectContextCleanup notification are available starting with Windows Vista.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft