參與錯誤復原
若要參與錯誤復原,PSHED 外掛程式必須實作 AttemptRecovery 回呼函式 。
下列程式碼範例示範如何實作此回呼函式。
//
// The PSHED plug-in's AttemptRecovery callback function
//
NTSTATUS
AttemptRecovery(
IN OUT PVOID PluginContext,
IN ULONG BufferLength,
IN PWHEA_ERROR_RECORD ErrorRecord
)
{
// Check if the error condition was not corrected by the
// operating system or by the PSHED.
if (ErrorRecord->Header.Severity != WheaErrSevCorrected)
{
// Attempt to correct the error condition.
...
// If not successful, return failure status
if (...)
{
return STATUS_UNSUCCESSFUL;
}
}
// Perform any additional operations that are required
// to fully recover from the error condition.
...
// If successful, return success status
if (...)
{
return STATUS_SUCCESS;
}
// Failed to fully recover from the error condition
else
{
return STATUS_UNSUCCESSFUL;
}
}
參與錯誤復原的 PSHED 外掛程式必須在它向作業系統註冊本身時指定PshedFAErrorRecovery旗標。