오류 원본을 사용하지 않도록 설정
사용자 모드 애플리케이션은 WHEAErrorSourceMethods::D isableErrorSourceRtn 메서드를 호출하여 오류 원본을 사용하지 않도록 설정할 수 있습니다.
참고
WheaErrSrcTypeMCE, WheaErrSrcTypeNMI, WheaErrSrcTypeINIT, WheaErrSrcTypeBOOT
다음 코드 예제에서는 오류 원본을 사용하지 않도록 설정하는 방법을 보여줍니다.
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();
사용자 모드 애플리케이션은 WHEAErrorSourceMethods::EnableErrorSourceRtn 메서드를 호출하여 오류 원본을 다시 사용하도록 설정할 수 있습니다. 오류 원본을 사용하도록 설정하는 방법에 대한 자세한 내용은 오류 원본 사용을 참조하세요.