IDSFDevice::StartFaultInjection Method
The StartFaultInjection method requests that a device begin injecting faults into the hardware interface.
Syntax
HRESULT StartFaultInjection(
[in] DSFResourceType ResType,
[in] VARIANT Params,
[out, retval] VARIANT *pvarContext
);
Parameters
ResType [in]
The resource type on which the faults are to be injected.Params [in]
The type of fault injection to be started.pvarContext [out, retval]
The context that must passed into the corresponding IDSFDevice::StopFaultInjection call. This parameter can be NULL.
Return Value
StartFaultInjection returns S_OK if the operation succeeds.
Remarks
The StartFaultInjection method is reserved for future use and is included for completeness.
Examples
The following C++ code example shows how to start and stop fault inject for a DSFDevice object while a test case is been run.
HRESULT CMyDevice::RunPortTest()
{
HRESULT hr = S_OK;
IDSFDevice *piDSFDevice = NULL;
DSFResourceType DSFRes = DSFResourceTypePort;
VARIANT varParam; ::VariantInit(&varParam);
VARIANT varContext; ::VariantInit(&varContext);
// Get the underlying DSFDevice interface
hr = get_DSFDevice(reinterpret_cast<DSFDevice*>(piDSFDevice));
if(!FAILED(hr))
{
// Set the parameters so that the top bit is always set
varParam.vt = VT_BYTE;
varParam.bVal =0x08;
hr = piDSFDevice->StartFaultInjection(DSFRes, varParam, &varContext);
if(FAILED(hr);
goto Exit;
// Run the port input test case
hr = TestPortInput();
if(FAILED(hr))
goto Exit;
// Stop fault injection
hr = piDSFDevice->StopFaultInjection(DSFRes, varContext)
if (FAILED(hr))
goto Exit;
}
Exit:
if (NULL != piDSFDevice)
{
piDSFDevice->Release();
piDSFDevice = NULL;
}
return hr;
}
See Also
Send comments about this topic to Microsoft
Build date: 9/21/2010