Participando do controle do código-fonte de erro
Para participar do controle do código-fonte de erro, um plug-in PSHED deve implementar as seguintes funções de retorno de chamada:
O exemplo de código a seguir mostra como implementar essas funções de retorno de chamada.
//
// The PSHED plug-in's SetErrorSourceInfo callback function
//
NTSTATUS
SetErrorSourceInfo(
IN OUT PVOID PluginContext,
IN PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource
)
{
// Check if the plug-in supports configuring
// the specified error source.
if (...)
{
// Save the new configuration data for the error
// source in nonvolatile storage and apply the
// configuration changes to the error source such
// that they will become effective after the
// system is restarted.
...
// If successful, return success status
if (...)
{
return STATUS_SUCCESS;
}
// Failed to configure the error source
else
{
return STATUS_UNSUCCESSFUL;
}
}
// Not supported by the plug-in
else
{
return STATUS_NOT_SUPPORTED;
}
}
//
// The PSHED plug-in's EnableErrorSource callback function
//
NTSTATUS
EnableErrorSource(
IN OUT PVOID PluginContext,
IN PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource
)
{
// Check if the plug-in supports enabling
// the specified error source.
if (...)
{
// Enable the error source
...
// If successful
if (...)
{
// Return success status
return STATUS_SUCCESS;
}
// Failed to enable the error source
else
{
return STATUS_UNSUCCESSFUL;
}
}
// Not supported by the plug-in
else
{
return STATUS_NOT_SUPPORTED;
}
}
//
// The PSHED plug-in's DisableErrorSource callback function
//
NTSTATUS
DisableErrorSource(
IN OUT PVOID PluginContext,
IN PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource
)
{
// Check if the plug-in supports disabling
// the specified error source.
if (...)
{
// Disable the error source
...
// If successful
if (...)
{
// Return success status
return STATUS_SUCCESS;
}
// Failed to disable the error source
else
{
return STATUS_UNSUCCESSFUL;
}
}
// Not supported by the plug-in
else
{
return STATUS_NOT_SUPPORTED;
}
}
Um plug-in PSHED que participa do controle do código-fonte de erro deve especificar o sinalizador PshedFAErrorSourceControl quando ele se registra no sistema operacional.