CmRegisterCallback function (wdm.h)

The CmRegisterCallback routine is obsolete for Windows Vista and later operating system versions. Use CmRegisterCallbackEx instead.

The CmRegisterCallback routine registers a RegistryCallback routine.


NTSTATUS CmRegisterCallback(
  [in]           PEX_CALLBACK_FUNCTION Function,
  [in, optional] PVOID                 Context,
  [out]          PLARGE_INTEGER        Cookie


[in] Function

A pointer to the RegistryCallback routine to register.

[in, optional] Context

A driver-defined value that the configuration manager will pass as the CallbackContext parameter to the RegistryCallback routine

[out] Cookie

A pointer to a LARGE_INTEGER variable that receives the value that identifies the callback routine. When you unregister the callback routine, pass this value as the Cookie parameter to CmUnRegisterCallback.

Return value

CmRegisterCallback returns STATUS_SUCCESS if the operation succeeds or the appropriate NTSTATUS error code if it fails.


The CmRegisterCallback routine is available on Windows XP and later operating system versions. For Windows Vista and later operating system versions, you should use CmRegisterCallbackEx instead.

A driver calls CmRegisterCallback to register a RegistryCallback routine, which is called every time a thread performs an operation on the registry.

Call CmUnRegisterCallback to unregister a callback routine that CmRegisterCallback registered.

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


Requirement Value
Minimum supported client Available in Windows XP and later versions of Windows.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
DDI compliance rules HwStorPortProhibitedDDIs(storport), IrqlExApcLte2(wdm)

See also