Участие в внедрении ошибок
Для участия в получении сведений об ошибках подключаемый модуль PSHED должен реализовывать следующие функции обратного вызова:
В следующем примере кода показано, как реализовать эти функции обратного вызова.
//
// The PSHED plug-in's GetInjectionCapabilities callback function
//
NTSTATUS
GetInjectionCapabilities(
IN OUT PVOID PluginContext,
OUT PWHEA_ERROR_INJECTION_CAPABILITIES Capabilities
)
{
// Set the members in the structure pointed to by the
// Capabilities parameter to indicate the error injection
// capabilities supported by the PSHED plug-in.
...
// Return success status
return STATUS_SUCCESS;
}
//
// The PSHED plug-in's InjectError callback function
//
NTSTATUS
InjectError(
IN OUT PVOID PluginContext,
IN ULONG ErrorType,
IN ULONGLONG Parameter1,
IN ULONGLONG Parameter2,
IN ULONGLONG Parameter3,
IN ULONGLONG Parameter4
)
{
// Inject the hardware error specified in the ErrorType
// parameter into the hardware platform.
// Parameter1 through Parameter4 contain any additional
// data that is required to inject the error.
...
// Note: For injected errors that are fatal or otherwise
// unrecoverable, this callback function might not continue
// execution past this point before the Windows kernel
// generates a bug check in response to the error condition.
// If successful, return success status
if (...)
{
return STATUS_SUCCESS;
}
// Failed to update the error record
else
{
return STATUS_UNSUCCESSFUL;
}
}
Подключаемый модуль PSHED, участвующий в внедрении ошибок, должен указывать флаг PshedFAErrorInjection при регистрации в операционной системе.