Поделиться через


Участие в восстановлении ошибок

Для участия в восстановлении ошибок подключаемый модуль 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 при регистрации в операционной системе.