KeRegisterNmiCallback function (wdm.h)

The KeRegisterNmiCallback routine registers a routine to be called whenever a nonmaskable interrupt (NMI) occurs.

Syntax

PVOID KeRegisterNmiCallback(
  [in]           PNMI_CALLBACK CallbackRoutine,
  [in, optional] PVOID         Context
);

Parameters

[in] CallbackRoutine

Pointer to a function of the form:

BOOLEAN
 XxxNmiCallback(
 IN PVOID Context,
  IN BOOLEAN Handled
 );

[in, optional] Context

Specifies the value to be passed as the Context parameter of XxxNmiCallback when it is called.

Return value

On success, KeRegisterNmiCallback returns an opaque pointer that the caller passes to KeDeregisterNmiCallback to deregister the callback. The routine returns NULL if it is unable to register the callback.

Remarks

When a nonmaskable interrupt occurs, the system calls each registered callback in reverse order from the order in which they were registered. For the first callback, the system passes FALSE as the Handled parameter. For each subsequent callback, if any previous callback returned TRUE, the system passes TRUE as the Handled parameter, otherwise it passes FALSE. If any callback returns a value of TRUE, the system considers the interrupt to have been handled. Otherwise, the system calls the HAL's default handler for the interrupt, which normally causes the system to bug check.

The callback routine must be able to be run at IRQL = HIGH_LEVEL.

Requirements

Requirement Value
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL IRQL <= APC_LEVEL (see Remarks section)
DDI compliance rules HwStorPortProhibitedDDIs(storport), IrqlKeApcLte2(wdm)

See also

KeDeregisterNmiCallback