Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Potentially incorrect HRESULT usage detected (low confidence)
Remarks
This warning is a low-confidence indicator for a function that returns HRESULT, that there's a FALSE
that is either eventually returned, or it's assigned to a variable that is returned.
Code analysis name: HRESULT_USAGE_LOW_CONFIDENCE
Example
The following sample code causes warning C33022:
#include <Windows.h>
#define CHECK_RESULT(X) X ? S_OK : FALSE;
#define RETURN_RESULT(X) return CHECK_RESULT(X)
HRESULT foo()
{
// ......
RETURN_RESULT(FALSE); // C33022
}
These warnings are corrected by using proper HRESULT value:
#include <Windows.h>
#define CHECK_RESULT(X) X ? S_OK : E_FAIL;
#define RETURN_RESULT(X) return CHECK_RESULT(X)
HRESULT foo()
{
// ......
RETURN_RESULT(FALSE); // OK
}