Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Aplikacja trybu użytkownika może wyłączyć źródło błędów przez wywołanie metody WHEAErrorSourceMethods::DisableErrorSourceRtn.
Uwaga
Nie można wyłączyć następujących źródeł błędów: WheaErrSrcTypeMCE, WheaErrSrcTypeNMI, WheaErrSrcTypeINIT, WheaErrSrcTypeBOOT
Poniższy przykład kodu pokazuje, jak wyłączyć źródło błędów.
IWbemServices *pIWbemServices;
ULONG ErrorSourceID;
BSTR ClassName;
BSTR MethodName;
HRESULT Result;
IWbemClassObject *pClass;
IWbemClassObject *pInParametersClass;
IWbemClassObject *pInParameters;
IWbemClassObject *pOutParameters;
VARIANT Parameter;
ULONG Status;
// 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.
// The following also assumes that the ErrorSourceID
// variable has previously been initialized with the
// identifier of the error source to be disabled.
// Specify the class and method to execute
ClassName = SysAllocString(L"WHEAErrorSourceMethods");
MethodName = SysAllocString(L"DisableErrorSourceRtn");
// Get the class object for the method definition
Result =
pIWbemServices->GetObject(
ClassName,
0,
NULL,
&pClass,
NULL
);
// Get the input parameter class object for the method
Result =
pClass->GetMethod(
MethodName,
0,
&pInParametersClass,
NULL
);
// Create an instance of the input parameter class
Result =
pInParametersClass->SpawnInstance(
0,
&pInParameters
);
// Set the ErrorSourceId parameter
Parameter.vt = VT_UI4;
Parameter.ulVal = ErrorSourceId;
Result =
pInParameters->Put(
L"ErrorSourceId",
0,
&Parameter,
0
);
VariantClear(&Parameter);
// Call the DisableErrorSourceRtn method indirectly by
// calling the IWbemServices::ExecMethod method.
Result =
pIWbemServices->ExecMethod(
ClassName,
MethodName,
0,
NULL,
&pInParameters,
&pOutParameters,
NULL
);
// Get the status from the output parameters object
Result =
pOutParameters->Get(
L"Status",
0,
&Parameter,
NULL,
NULL
);
Status = Parameter.ulval;
VariantClear(&Parameter);
// Free up resources
SysFreeString(ClassName);
SysFreeString(MethodName);
pInParameters->Release();
pInParametersClass->Release();
pClass->Release();
pOutParameters->Release();
Aplikacja trybu użytkownika może ponownie włączyć źródło błędów , wywołując metodę WHEAErrorSourceMethods::EnableErrorSourceRtn. Aby uzyskać więcej informacji na temat włączania źródła błędów, zobacz Włączanie źródła błędów.