Error List Example Using C++
Note This content applies to the Windows Logo Kit (WLK). For the latest information using the new Windows Hardware Certification Kit (HCK), see Windows HCK User's Guide on the Windows Hardware Dev Center.
The following code example shows how error lists are typically used.
CWTTLogger.AddErrorToErrorList(
E_ACCESSDENIED,
WTT_ERROR_TYPE_HRESULT,
WTT_ERROR_LIST_EXPECTED
);
CWTTLogger.CheckResult(
E_ACCESSDENIED,
WTT_ERROR_TYPE_HRESULT,
__WFILE__,
__LINE__,
L"This should pass, and does not log",
NULL
);
CWTTLogger.RemoveErrorFromErrorList(
E_ACCESSDENIED,
WTT_ERROR_TYPE_HRESULT,
WTT_ERROR_LIST_EXPECTED
);
CWTTLogger.CheckResult(
E_ACCESSDENIED,
WTT_ERROR_TYPE_HRESULT,
__WFILE__,
__LINE__,
L"This should fail, and it should log",
NULL
);
When the CWTTLogger::CheckResult method is first called, E_ACCESSDENIED is considered a valid error code, and DTM Logger logs nothing. However, on the second call to CWTTLogger::CheckResult, E_ACCESSDENIED is logged as a failure because it is not in the known error list.
See Also
Code Samples for DTM Logger, Using Error Lists
Build date: 9/14/2012