Partecipazione all'individuazione dell'origine degli errori
Per partecipare all'individuazione dell'origine degli errori, un plug-in PSHED deve implementare una funzione di callback GetAllErrorSources . Un plug-in PSHED che partecipa all'individuazione dell'origine degli errori può implementare anche una funzione di callback GetErrorSourceInfo facoltativa.
Nell'esempio di codice seguente viene illustrato come implementare queste funzioni di callback.
//
// The PSHED plug-in's GetAllErrorSources callback function
//
NTSTATUS
GetAllErrorSources(
IN OUT PVOID PluginContext,
IN OUT PULONG Count,
IN OUT PWHEA_ERROR_SOURCE_DESCRIPTOR *ErrorSources,
IN OUT PULONG Length
)
{
// Check if there is enough space remaining in the buffer
// that contains the array of error source descriptors to
// include any additional error sources to be reported by
// the PSHED plug-in.
if (...)
{
// Update the list of error sources by modifying the
// existing error sources in the list and adding any
// additional error sources to the list.
...
// If the number of error sources in the list has changed
// update the count that is returned back to the kernel.
*Count = ...;
// If successful, return success status
if (...)
{
return STATUS_SUCCESS;
}
// Failed to update the list of error sources
else
{
return STATUS_UNSUCCESSFUL;
}
}
// Insufficient space in the buffer.
else
{
// Set the length the necessary buffer size
*Length = ...;
return STATUS_BUFFER_TOO_SMALL;
}
}
//
// The PSHED plug-in's GetErrorSourceInfo callback function
//
NTSTATUS
GetErrorSourceInfo(
IN OUT PVOID PluginContext,
IN OUT PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource
)
{
// Modify the information contained in the
// error source descriptor as appropriate.
...
// If successful, return success status
if (...)
{
return STATUS_SUCCESS;
}
// Failed to update the error source information
else
{
return STATUS_UNSUCCESSFUL;
}
}
Un plug-in PSHED che partecipa all'individuazione dell'origine degli errori deve specificare il flag PshedFADiscovery quando si registra con il sistema operativo.