Partager via


Obtention des fonctionnalités d’injection d’erreurs

Notes

L’interface d’injection d’erreurs WHEA nécessite un ordinateur avec la table ACPI EINJ ou un Plug-In PSHED qui implémente la zone fonctionnelle d’injection d’erreurs. La plupart des systèmes grand public n’incluent pas d’implémentation EINJ, et Windows ne dispose pas d’une Plug-In PSHED intégrée pour activer l’injection d’erreurs. Aucune d’entre elles n’est présente, les interfaces d’injection d’erreur retournent une erreur.

Une application en mode utilisateur peut obtenir des informations sur les fonctionnalités d’injection d’erreurs de la plateforme matérielle en appelant la méthode WHEAErrorInjectionMethods::GetErrorInjectionCapabilitiesRtn . Cette méthode retourne une structure WHEA_ERROR_INJECTION_CAPABILITIES qui décrit les fonctionnalités d’injection d’erreurs prises en charge par la plateforme matérielle.

L’exemple de code suivant montre comment récupérer les informations sur les fonctionnalités d’injection d’erreurs.

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();