Condividi tramite


Recupero delle funzionalità di inserimento degli errori

Nota

L'interfaccia di inserimento degli errori WHEA richiede un computer con la tabella ACPI EMAK o un Plug-In PSHED che implementa l'area funzionale di inserimento degli errori. La maggior parte dei sistemi consumer non include un'implementazione di ESHELL e Windows non dispone di un Plug-In PSHED predefinito per abilitare l'inserimento degli errori. Con nessuna di queste interfacce, le interfacce di inserimento degli errori restituiscono un errore.

Un'applicazione in modalità utente può ottenere informazioni sulle funzionalità di inserimento degli errori della piattaforma hardware chiamando il metodo WHEAErrorChangectionMethods::GetErrorConfigurationectionCapabilitiesRtn . Questo metodo restituisce una struttura WHEA_ERROR_INJECTION_CAPABILITIES che descrive le funzionalità di inserimento degli errori supportate dalla piattaforma hardware.

Nell'esempio di codice seguente viene illustrato come recuperare le informazioni sulle funzionalità di inserimento degli errori.

IWbemServices *pIWbemServices;
BSTR ClassName;
BSTR MethodName;
HRESULT Result;
IWbemClassObject *pOutParameters;
VARIANT Parameter;
ULONG Status;
WHEA_ERROR_INJECTION_CAPABILITIES ErrorInjectionCapabilities;

// The following example assumes that the application
// has previously connected to WMI on the local machine
// and that the pIWbemServices variable contains the
// pointer that was returned from the call to the
// IWbemLocator::ConnectServer method.

// Specify the class and method to execute
ClassName = SysAllocString(L"WHEAErrorInjectionMethods");
MethodName = SysAllocString(L"GetErrorInjectionCapabilitiesRtn");

// Call the GetErrorInjectionCapabilitiesRtn method indirectly
// by calling the IWbemServices::ExecMethod method.
Result =
  pIWbemServices->ExecMethod(
    ClassName,
    MethodName,
    0,
    NULL,
    NULL,
    &pOutParameters,
    NULL
    );

// Get the status from the output parameters object
Result =
  pOutParameters->Get(
    L"Status",
    0,
    &Parameter,
    NULL,
    NULL
    );
Status = Parameter.ulVal;
VariantClear(&Parameter);

// Get the capabilities from the output parameters object
Result =
  pOutParameters->Get(
    L"Capabilities",
    0,
    &Parameter,
    NULL,
    NULL
    );
ErrorInjectionCapabilities.AsULONG = Parameter.ulVal;
VariantClear(&Parameter);

// Process the error injection capabilities data
...

// Free up resources
SysFreeString(ClassName);
SysFreeString(MethodName);
pOutParameters->Release();