參與錯誤來源探索
若要參與錯誤來源探索,PSHED 外掛程式必須實作 GetAllErrorSources 回呼函式。 參與錯誤來源探索的 PSHED 外掛程式也可以實作選擇性 的 GetErrorSourceInfo 回 呼函式。
下列程式碼範例示範如何實作這些回呼函式。
//
// 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;
}
}
參與錯誤來源探索的 PSHED 外掛程式,必須在向作業系統註冊本身時指定PshedFADiscovery旗標。