Using WHEA on Windows 10
In Windows 10, version 2004, Windows Hardware Error Architecture (WHEA) includes a new interface (v2). This page describes how to register as an error source and report errors.
Adding an Error Source
To register with WHEA as an error source using WHEA v2, the driver should do the following:
Specify a configuration for your device driver by instantiating a WHEA_ERROR_SOURCE_CONFIGURATION_DEVICE_DRIVER structure, providing pointers to WHEA_ERROR_SOURCE_INITIALIZE_DEVICE_DRIVER and WHEA_ERROR_SOURCE_UNINITIALIZE_DEVICE_DRIVER event callback functions.
Call WheaAddErrorSourceDeviceDriver, providing the configuration structure. Typically, the driver calls this routine from DriverEntry.
To remove an error source at a later time, call WheaRemoveErrorSourceDeviceDriver.
WHEA calls the the driver's WHEA_ERROR_SOURCE_INITIALIZE_DEVICE_DRIVER event callback function when the error source is ready to report errors. The driver receives an ErrorSourceId as a parameter to the callback.
Reporting an Error
To report an error, perform the following steps in sequence at the same time:
Call WheaCreateHwErrorReportDeviceDriver, providing the ErrorSourceId and, optionally, a DeviceObject for the driver. The routine returns a handle to the in progress error.
To add data to the error, call WheaAddHwErrorReportSectionDeviceDriver, providing the error handle. This function adds a single section to the error report and configures a driver-supplied data buffer. The driver can call this routine up to MaxSectionsPerReport times as specified in WHEA_ERROR_SOURCE_CONFIGURATION_DEVICE_DRIVER.
Optionally, the driver can call WheaHwErrorReportSetSeverityDeviceDriver to set the error severity of the packet and sections. Also see WheaHwErrorReportSetSectionNameDeviceDriver, which is a helper function for updating the FRUText field of the WHEA_ERROR_RECORD_SECTION_DESCRIPTOR structure.
Copy error data into the buffer set.
Call WheaHwErrorReportSubmitDeviceDriver, again providing the error handle. After this call, buffers in the buffer sets are unavailable and the handle is invalid.
If an error occurs or the error is no longer valid, the driver can optionally call WheaHwErrorReportAbandonDeviceDriver. In this case, no report is submitted to WHEA.
The driver must call either WheaHwErrorReportSubmitDeviceDriver or WheaHwErrorReportAbandonDeviceDriver on every handle created by WheaCreateHwErrorReportDeviceDriver. Otherwise, WheaRemoveErrorSourceDeviceDriver might return STATUS_RESOURCE_IN_USE.
Submit and view feedback for