update wil to 0b2d6c2d822bb301e7558a14ee66d567c14f5dc7

This commit is contained in:
Shawn Hoffman 2023-02-22 13:12:56 -08:00
commit 69c335ca8c
66 changed files with 14776 additions and 2507 deletions

View file

@ -1,7 +1,10 @@
#include <wil/com.h>
#include <wil/result.h>
#if (NTDDI_VERSION >= NTDDI_WIN8)
#include <wil/result_originate.h>
#endif
#include <roerrorapi.h>
@ -323,7 +326,7 @@ TEST_CASE("ResultTests::ExceptionHandling", "[result]")
RETURN_CAUGHT_EXCEPTION_EXPECTED();
}
}();
REQUIRE(failures.size() == 0);
REQUIRE(failures.empty());
REQUIRE(hr == E_OUTOFMEMORY);
}
failures.clear();
@ -339,7 +342,7 @@ TEST_CASE("ResultTests::ExceptionHandling", "[result]")
{
throw std::bad_alloc();
});
REQUIRE(failures.size() == 0);
REQUIRE(failures.empty());
REQUIRE(hr == E_OUTOFMEMORY);
}
failures.clear();
@ -436,16 +439,16 @@ void ExceptionHandlingCompilationTest()
try { try { throw std::bad_alloc(); } catch (...) { THROW_NORMALIZED_CAUGHT_EXCEPTION(); } } catch (...) {}
try { try { throw std::bad_alloc(); } catch (...) { THROW_NORMALIZED_CAUGHT_EXCEPTION_MSG("train: %d", 42); } } catch (...) {}
HRESULT hr = wil::ResultFromExceptionDebug(WI_DIAGNOSTICS_INFO, wil::SupportedExceptions::All, [&]
wil::ResultFromExceptionDebug(WI_DIAGNOSTICS_INFO, wil::SupportedExceptions::All, [&]
{
THROW_HR(E_FAIL);
});
hr = wil::ResultFromException(WI_DIAGNOSTICS_INFO, wil::SupportedExceptions::None, [&]
wil::ResultFromException(WI_DIAGNOSTICS_INFO, wil::SupportedExceptions::None, [&]
{
});
hr = wil::ResultFromException([&]
wil::ResultFromException([&]
{
});
@ -479,7 +482,7 @@ TEST_CASE("ResultTests::ErrorMacros", "[result]")
}
// The originate helper isn't compatible with CX so don't test it in that mode.
#ifndef __cplusplus_winrt
#if !defined(__cplusplus_winrt) && (NTDDI_VERSION >= NTDDI_WIN8)
TEST_CASE("ResultTests::NoOriginationByDefault", "[result]")
{
::wil::SetOriginateErrorCallback(nullptr);
@ -572,4 +575,17 @@ TEST_CASE("ResultTests::AutomaticOriginationOnFailure", "[result]")
}();
REQUIRE(S_FALSE == GetRestrictedErrorInfo(&restrictedErrorInformation));
}
#endif // __cplusplus_winrt
#endif
TEST_CASE("ResultTests::ReportDoesNotChangeLastError", "[result]")
{
decltype(wil::details::g_pfnLoggingCallback) oopsie = [](wil::FailureInfo const&) noexcept
{
::SetLastError(ERROR_ABANDON_HIBERFILE);
};
auto swap = witest::AssignTemporaryValue(&wil::details::g_pfnLoggingCallback, oopsie);
::SetLastError(ERROR_ABIOS_ERROR);
LOG_IF_WIN32_BOOL_FALSE(FALSE);
REQUIRE(::GetLastError() == ERROR_ABIOS_ERROR);
}