Previous Next

BugCheckSecondaryDumpDataCallback

The BugCheckSecondaryDumpDataCallback routine provides data to the system to append to the crash dump file when the system issues a bug check.

VOID
  BugCheckSecondaryDumpDataCallback (
    IN KBUGCHECK_CALLBACK_REASON Reason,
    IN PKBUGCHECK_REASON_CALLBACK_RECORD Record,
    IN OUT PVOID ReasonSpecificData,
    IN ULONG ReasonSpecificDataLength 
    );

Parameters

Reason
Specifies the situation in which the callback is executed. For BugCheckSecondaryDumpDataCallback, this parameter is always KbCallbackSecondaryDumpData.
Record
Pointer to the KBUGCHECK_REASON_CALLBACK_RECORD structure that the driver passed when registering this callback.
ReasonSpecificData
Pointer to a KBUGCHECK_SECONDARY_DUMP_DATA structure. Certain members of this structure are populated by the system, and others must be supplied by the callback.
ReasonSpecificDataLength
Specifies the size, in bytes, of the buffer supplied by the ReasonSpecificData parameter. For BugCheckSecondaryDumpDataCallback, this parameter is always sizeof(KBUGCHECK_SECONDARY_DUMP_DATA).

Return Value

None

Comments

Drivers can only implement BugCheckSecondaryDumpDataCallback routines on Windows XP SP1, Windows Server 2003, and later operating systems.

The system uses BugCheckSecondaryDumpDataCallback routines to poll drivers for crash dump data.

The system sets the InBuffer, InBufferLength, OutBuffer, and MaximumAllowed members of the KBUGCHECK_SECONDARY_DUMP_DATA structure that ReasonSpecificData points to. The MaximumAllowed member specifies the maximum amount of dump data the routine can provide.

The value of the OutBuffer member determines whether the system is requesting the size of the driver's dump data, or the data itself, as follows:

The InBuffer member of KBUGCHECK_SECONDARY_DUMP_DATA points to a small buffer for the routine's use. The InBufferLength member specifies the size of the buffer. If the amount of data to be written is less than InBufferLength, the callback routine can use this buffer to supply the crash dump data to the system. The callback routine then sets OutBuffer to InBuffer and OutBufferLength to the actual amount of data written to the buffer.

A driver that must write an amount of data that is larger than InBufferLength can use its own buffer to provide the data. This buffer must have been allocated before the callback routine is executed, and must reside in resident memory (such as nonpaged pool). The buffer must be page-aligned. The callback routine then sets OutBuffer to point to the driver's buffer, and OutBufferLength to the amount of data in the buffer to be written to the crash dump file.

Each block of data to be written to the crash dump file is tagged with the value of the Guid member of KBUGCHECK_SECONDARY_DUMP_DATA. The GUID used must be unique to the driver. To display the secondary dump data corresponding to this GUID, you can use the .enumtag command or the IDebugDataSpaces3::ReadTagged method in a debugger extension. For information about debuggers and debugger extensions, see Debugging Tools for NT-Based Operating Systems.

A driver can write multiple blocks with the same GUID to the crash dump file, but this is very poor practice, because only the first block will be accessible to the debugger. Drivers that register multiple BugCheckSecondaryDumpDataCallback routines should allocate a unique GUID for each callback.

Use KeRegisterBugCheckReasonCallback to register a BugCheckSecondaryDumpDataCallback routine. A driver can subsequently remove the callback routine by using the KeDeregisterBugCheckReasonCallback routine. If the driver can be unloaded, then it must remove any registered callback routines in its Unload routine.

A BugCheckSecondaryDumpDataCallback is very restricted in the actions it can take. For more information, see Writing a Bug Check Callback Routine.

BugCheckSecondaryDumpDataCallback routines execute at IRQL = HIGH_LEVEL.

See Also

KBUGCHECK_REASON_CALLBACK_RECORD, KBUGCHECK_SECONDARY_DUMP_DATA, KeDeregisterBugCheckCallback, KeRegisterBugCheckCallback, BugCheckDumpIoCallback, BugCheckSecondaryDumpDataCallback