From 3f1df0ea92629262f01a6cc09c0aeab0d10ccdd3 Mon Sep 17 00:00:00 2001 From: JordanTheToaster Date: Thu, 5 Dec 2024 06:06:53 +0000 Subject: [PATCH] 3rdparty: Update WIL to v1.0.240803.1 --- 3rdparty/winwil/include/wil/Tracelogging.h | 330 ++++++++++-------- 3rdparty/winwil/include/wil/com.h | 6 +- 3rdparty/winwil/include/wil/common.h | 31 +- 3rdparty/winwil/include/wil/coroutine.h | 10 +- 3rdparty/winwil/include/wil/cppwinrt.h | 2 +- 3rdparty/winwil/include/wil/filesystem.h | 24 +- 3rdparty/winwil/include/wil/resource.h | 46 +-- 3rdparty/winwil/include/wil/result.h | 4 +- 3rdparty/winwil/include/wil/result_macros.h | 97 +++-- .../winwil/include/wil/result_originate.h | 2 +- 3rdparty/winwil/include/wil/safecast.h | 2 +- 3rdparty/winwil/include/wil/windowing.h | 107 +++--- 3rdparty/winwil/include/wil/winrt.h | 10 +- 3rdparty/winwil/include/wil/wistd_config.h | 4 +- .../winwil/include/wil/wistd_type_traits.h | 4 +- 15 files changed, 395 insertions(+), 284 deletions(-) diff --git a/3rdparty/winwil/include/wil/Tracelogging.h b/3rdparty/winwil/include/wil/Tracelogging.h index 9ad0dc21cd..119a9c184a 100644 --- a/3rdparty/winwil/include/wil/Tracelogging.h +++ b/3rdparty/winwil/include/wil/Tracelogging.h @@ -743,7 +743,7 @@ public: __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ _tlgActivityDecl(activity) \ - TraceLoggingWriteActivity(TraceLoggingType::Provider(), (name), _tlgActivityRef(activity).Id(), NULL, __VA_ARGS__); \ + TraceLoggingWriteActivity(TraceLoggingType::Provider(), (name), _tlgActivityRef(activity).Id(), NULL, ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) /// @endcond @@ -1143,10 +1143,10 @@ private: return (m_sharedActivityData ? m_sharedActivityData->LockExclusive() : rwlock_release_exclusive_scope_exit()); } - template - class ActivityData : public _TlgActivityBase, keyword, level> + template + class ActivityData : public _TlgActivityBase, keyword, level> { - using BaseTy = _TlgActivityBase, keyword, level>; + using BaseTy = _TlgActivityBase, keyword, level>; friend BaseTy; void OnStarted() { @@ -1155,7 +1155,7 @@ private: { } - // SFINAE dispatching on presence of ActivityTraceLoggingType::CreateActivityId(_Out_ GUID& childActivityId, _In_opt_ const GUID* relatedActivityId) + // SFINAE dispatching on presence of ActivityTraceLoggingTypeOther::CreateActivityId(_Out_ GUID& childActivityId, _In_opt_ const GUID* relatedActivityId) template auto CreateActivityIdByProviderType(int, _Out_ GUID& childActivityId) -> decltype(ProviderType::CreateActivityId(childActivityId, this->GetRelatedId()), (void)0) @@ -1171,7 +1171,7 @@ private: void CreateActivityId(_Out_ GUID& childActivityId) { - CreateActivityIdByProviderType(0, childActivityId); + CreateActivityIdByProviderType(0, childActivityId); } public: @@ -1221,7 +1221,7 @@ private: static TraceLoggingHProvider Provider() { - return ActivityTraceLoggingType::Provider(); + return ActivityTraceLoggingTypeOther::Provider(); } WI_NODISCARD bool NeedsStopped() const WI_NOEXCEPT @@ -1299,15 +1299,17 @@ private: #define __WI_TraceLoggingWriteStart(activity, name, ...) \ __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ - _tlgActivityDecl(activity) static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword; \ - static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level; \ - static const UINT64 _tlgActivityPrivacyTag = _tlgActivityRef(activity).PrivacyTag; \ + _tlgActivityDecl(activity); \ + using _tlg_Activity_t = wistd::remove_reference_t; \ + static constexpr const UINT64 _tlgActivity_Keyword = _tlg_Activity_t::Keyword; \ + static constexpr const UINT8 _tlgActivity_Level = _tlg_Activity_t::Level; \ + static constexpr const UINT64 _tlgActivityPrivacyTag = _tlg_Activity_t::PrivacyTag; \ static_assert( \ - _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \ + _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingKeyword in TraceLoggingWriteStart. Keywords for START events are " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ static_assert( \ - _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \ + _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingLevel in TraceLoggingWriteStart. The Level for START events is " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ _tlgActivityRef(activity).zInternalStart(); \ @@ -1321,28 +1323,30 @@ private: TraceLoggingLevel(_tlgActivity_Level), \ TelemetryPrivacyDataTag(_tlgActivityPrivacyTag), \ TraceLoggingDescription("~^" _wiltlg_LSTRINGIZE(activity) L"^~"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) #define __WRITE_ACTIVITY_START(EventId, ...) \ __TRACELOGGING_TEST_HOOK_ACTIVITY_START(); \ - __WI_TraceLoggingWriteStart(*this, #EventId, __ACTIVITY_START_PARAMS(), __VA_ARGS__); \ + __WI_TraceLoggingWriteStart(*this, #EventId, __ACTIVITY_START_PARAMS(), ##__VA_ARGS__); \ EnsureWatchingCurrentThread() #define __WI_TraceLoggingWriteStop(activity, name, ...) \ __pragma(warning(push)) __pragma(warning(disable : 4127)) do \ { \ - _tlgActivityDecl(activity) static const UINT64 _tlgActivity_Keyword = _tlgActivityRef(activity).Keyword; \ - static const UINT8 _tlgActivity_Level = _tlgActivityRef(activity).Level; \ - static const UINT64 _tlgActivityPrivacyTag = _tlgActivityRef(activity).PrivacyTag; \ + _tlgActivityDecl(activity); \ + using _tlg_Activity_t = wistd::remove_reference_t; \ + static constexpr const UINT64 _tlgActivity_Keyword = _tlg_Activity_t::Keyword; \ + static constexpr const UINT8 _tlgActivity_Level = _tlg_Activity_t::Level; \ + static constexpr const UINT64 _tlgActivityPrivacyTag = _tlg_Activity_t::PrivacyTag; \ static_assert( \ - _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, __VA_ARGS__)), \ + _tlgActivity_Keyword == (_tlgActivity_Keyword _tlg_FOREACH(_tlgKeywordVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingKeyword in TraceLoggingWriteStop. Keywords for STOP events are " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ static_assert( \ - _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, __VA_ARGS__)), \ + _tlgActivity_Level == (_tlgActivity_Level _tlg_FOREACH(_tlgLevelVal, ##__VA_ARGS__)), \ "Do not use TraceLoggingLevel in TraceLoggingWriteStop. The Level for STOP events is " \ "specified in the activity type, e.g. TraceLoggingActivity."); \ _tlgActivityRef(activity).zInternalStop(); \ @@ -1356,7 +1360,7 @@ private: TraceLoggingLevel(_tlgActivity_Level), \ TelemetryPrivacyDataTag(_tlgActivityPrivacyTag), \ TraceLoggingDescription("~^" _wiltlg_LSTRINGIZE(activity) L"^~"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } \ while (0) \ __pragma(warning(pop)) @@ -1369,23 +1373,23 @@ private: auto& failure = *pFailure; \ if (false, WI_IsAnyFlagSet(Keyword, (MICROSOFT_KEYWORD_TELEMETRY | MICROSOFT_KEYWORD_MEASURES | MICROSOFT_KEYWORD_CRITICAL_DATA))) \ { \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TELEMETRY_FAILURE_PARAMS(failure), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TELEMETRY_FAILURE_PARAMS(failure), ##__VA_ARGS__); \ } \ else \ { \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TRACELOGGING_FAILURE_PARAMS(failure), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_TRACELOGGING_FAILURE_PARAMS(failure), ##__VA_ARGS__); \ } \ } \ else \ { \ __TRACELOGGING_TEST_HOOK_ACTIVITY_STOP(nullptr, GetResult()); \ - __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_PARAMS(GetResult()), __VA_ARGS__); \ + __WI_TraceLoggingWriteStop(*this, #EventId, __ACTIVITY_STOP_PARAMS(GetResult()), ##__VA_ARGS__); \ } \ IgnoreCurrentThread(); // optional params are: KeyWord, Level, PrivacyTags, Options #define __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, ...) \ - class ActivityClassName final : public wil::ActivityBase \ + class ActivityClassName final : public wil::ActivityBase \ { \ protected: \ void StopActivity() WI_NOEXCEPT override \ @@ -1547,13 +1551,13 @@ public: \ #define DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, ...) \ void EventId() \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, ...) \ void EventId() \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, ##__VA_ARGS__); \ } #endif @@ -1562,13 +1566,13 @@ public: \ void EventId(PCSTR correlationVector) \ { \ __WI_TraceLoggingWriteTagged( \ - *this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + *this, #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_CV(EventId, ...) \ void EventId(PCSTR correlationVector) \ { \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #endif @@ -1582,7 +1586,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, VarType1, varName1, ...) \ @@ -1590,7 +1594,7 @@ public: \ void EventId(T1&& varName1) \ { \ __WI_TraceLoggingWriteTagged( \ - *this, #EventId, TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), __VA_ARGS__); \ + *this, #EventId, TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), ##__VA_ARGS__); \ } #endif @@ -1605,7 +1609,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1_CV(EventId, VarType1, varName1, ...) \ @@ -1617,7 +1621,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1632,7 +1636,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM2(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -1644,7 +1648,7 @@ public: \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1660,7 +1664,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM2_CV(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -1673,7 +1677,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1689,7 +1693,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM3(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -1702,7 +1706,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1719,7 +1723,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM3_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -1733,7 +1737,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1751,7 +1755,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM4( \ @@ -1766,7 +1770,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1785,7 +1789,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM4_CV( \ @@ -1801,7 +1805,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1820,7 +1824,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM5( \ @@ -1836,7 +1840,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1856,7 +1860,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM5_CV( \ @@ -1873,7 +1877,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1893,7 +1897,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM6( \ @@ -1910,7 +1914,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1931,7 +1935,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM6_CV( \ @@ -1949,7 +1953,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -1970,7 +1974,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM7( \ @@ -1988,7 +1992,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2010,7 +2014,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM7_CV( \ @@ -2029,7 +2033,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2051,7 +2055,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM8( \ @@ -2070,7 +2074,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2094,7 +2098,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM8_CV( \ @@ -2115,7 +2119,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2158,7 +2162,7 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM9( \ @@ -2198,16 +2202,16 @@ public: \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif #define DEFINE_TAGGED_TRACELOGGING_EVENT_UINT32(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, ##__VA_ARGS__) #define DEFINE_TAGGED_TRACELOGGING_EVENT_BOOL(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, ##__VA_ARGS__) #define DEFINE_TAGGED_TRACELOGGING_EVENT_STRING(EventId, varName, ...) \ - DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, __VA_ARGS__) + DEFINE_TAGGED_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, ##__VA_ARGS__) // Internal MACRO implementation of TraceLogging classes. // Do NOT use these macros directly. @@ -2369,13 +2373,13 @@ public: #define DEFINE_TRACELOGGING_EVENT(EventId, ...) \ static void EventId() \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT(EventId, ...) \ static void EventId() \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, ##__VA_ARGS__); \ } #endif @@ -2384,13 +2388,13 @@ public: static void EventId(PCSTR correlationVector) \ { \ TraceLoggingWrite( \ - TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + TraceLoggingType::Provider(), #EventId, _GENERIC_PARTB_FIELDS_ENABLED, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_CV(EventId, ...) \ static void EventId(PCSTR correlationVector) \ { \ - TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), __VA_ARGS__); \ + TraceLoggingWrite(TraceLoggingType::Provider(), #EventId, TraceLoggingString(correlationVector, "__TlgCV__"), ##__VA_ARGS__); \ } #endif @@ -2404,7 +2408,7 @@ public: #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, VarType1, varName1, ...) \ @@ -2415,7 +2419,7 @@ public: TraceLoggingType::Provider(), \ #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2430,7 +2434,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM1_CV(EventId, VarType1, varName1, ...) \ @@ -2442,7 +2446,7 @@ public: #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2457,7 +2461,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM2(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -2469,7 +2473,7 @@ public: #EventId, \ TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2485,7 +2489,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM2_CV(EventId, VarType1, varName1, VarType2, varName2, ...) \ @@ -2498,7 +2502,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2514,7 +2518,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM3(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -2527,7 +2531,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName1)), _wiltlg_STRINGIZE(varName1)), \ TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2544,7 +2548,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM3_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, ...) \ @@ -2558,7 +2562,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2575,7 +2579,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM4(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, VarType4, varName4, ...) \ @@ -2589,7 +2593,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName2)), _wiltlg_STRINGIZE(varName2)), \ TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2607,7 +2611,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM4_CV(EventId, VarType1, varName1, VarType2, varName2, VarType3, varName3, VarType4, varName4, ...) \ @@ -2622,7 +2626,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2641,7 +2645,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM5( \ @@ -2657,7 +2661,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName3)), _wiltlg_STRINGIZE(varName3)), \ TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2677,7 +2681,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM5_CV( \ @@ -2694,7 +2698,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2714,7 +2718,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM6( \ @@ -2731,7 +2735,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName4)), _wiltlg_STRINGIZE(varName4)), \ TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2752,7 +2756,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM6_CV( \ @@ -2770,7 +2774,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2791,7 +2795,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM7( \ @@ -2809,7 +2813,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName5)), _wiltlg_STRINGIZE(varName5)), \ TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2832,7 +2836,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM7_CV( \ @@ -2852,7 +2856,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2874,7 +2878,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM8( \ @@ -2893,7 +2897,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName6)), _wiltlg_STRINGIZE(varName6)), \ TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2917,7 +2921,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM8_CV( \ @@ -2938,7 +2942,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -2981,7 +2985,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM9( \ @@ -3021,7 +3025,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName7)), _wiltlg_STRINGIZE(varName7)), \ TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -3065,7 +3069,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM9_CV( \ @@ -3106,7 +3110,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingString(correlationVector, "__TlgCV__"), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif @@ -3152,7 +3156,7 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingValue(static_cast(wistd::forward(varName10)), _wiltlg_STRINGIZE(varName10)), \ _GENERIC_PARTB_FIELDS_ENABLED, \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #else #define DEFINE_TRACELOGGING_EVENT_PARAM10( \ @@ -3195,16 +3199,16 @@ public: TraceLoggingValue(static_cast(wistd::forward(varName8)), _wiltlg_STRINGIZE(varName8)), \ TraceLoggingValue(static_cast(wistd::forward(varName9)), _wiltlg_STRINGIZE(varName9)), \ TraceLoggingValue(static_cast(wistd::forward(varName10)), _wiltlg_STRINGIZE(varName10)), \ - __VA_ARGS__); \ + ##__VA_ARGS__); \ } #endif #define DEFINE_TRACELOGGING_EVENT_UINT32(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, UINT32, varName, ##__VA_ARGS__) #define DEFINE_TRACELOGGING_EVENT_BOOL(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, bool, varName, ##__VA_ARGS__) #define DEFINE_TRACELOGGING_EVENT_STRING(EventId, varName, ...) \ - DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, __VA_ARGS__) + DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, PCWSTR, varName, ##__VA_ARGS__) // Declaring a pure TraceLogging class // To declare a tracelogging class, declare your class derived from wil::TraceLoggingProvider, populate the uuid @@ -3244,34 +3248,35 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // within your Tracelogging class using one of the macros below. #define TraceLoggingProviderWrite(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, __VA_ARGS__) + TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TraceLoggingProviderWriteTelemetry(TraceLoggingClassName, EventId, ...) \ TraceLoggingWrite( \ - TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingProviderWriteMeasure(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + TraceLoggingWrite( \ + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingProviderWriteCriticalData(TraceLoggingClassName, EventId, ...) \ TraceLoggingWrite( \ - TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + TraceLoggingClassName::TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) // [Optional] Custom Events // Use these macros to define a Custom Event for a Provider. Use the TraceLoggingClassWrite or TraceLoggingClassWriteTelemetry // from within a custom event to issue the event. Methods will be a no-op (and not be called) if the provider is not // enabled. -#define TraceLoggingClassWrite(EventId, ...) TraceLoggingWrite(TraceLoggingType::Provider(), EventId, __VA_ARGS__) +#define TraceLoggingClassWrite(EventId, ...) TraceLoggingWrite(TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TraceLoggingClassWriteTelemetry(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingClassWriteMeasure(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingClassWriteCriticalData(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) #define DEFINE_EVENT_METHOD(MethodName) \ template \ @@ -3288,6 +3293,16 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // Use these macros to define very simple telemetry events for a Provider. The events can // be TELEMETRY events or TRACELOGGING events. +// To comply with the General Data Protection Regulations (GDPR), all collected Asimov events must +// be tagged with a Privacy Data Type per release and per event instance. Starting with 19H1, +// events will not be uploaded unless they are tagged in code or in DataGrid. Tagging in code is +// preferred and only the "compliant" macro variants (which supply a privacy data type) are +// supported outside of the Windows codebase. +// +// [Microsoft Internal] See also: https://osgwiki.com/wiki/Privacy_Data_Type_-_Tagging_in_Code + +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_TELEMETRY_EVENT(EventId) DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY)) #define DEFINE_TELEMETRY_EVENT_PARAM1(EventId, VarType1, varName1) \ @@ -3413,6 +3428,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_TELEMETRY_EVENT_BOOL(EventId, varName) DEFINE_TELEMETRY_EVENT_PARAM1(EventId, bool, varName) #define DEFINE_TELEMETRY_EVENT_STRING(EventId, varName) DEFINE_TELEMETRY_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_COMPLIANT_TELEMETRY_EVENT(EventId, PrivacyTag) \ DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), TelemetryPrivacyDataTag(PrivacyTag)) @@ -3810,6 +3827,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [Optional] Simple Events // Use these macros to define very simple measure events for a Provider. +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_MEASURES_EVENT(EventId) DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)) #define DEFINE_MEASURES_EVENT_PARAM1(EventId, VarType1, varName1) \ DEFINE_TRACELOGGING_EVENT_PARAM1(EventId, VarType1, varName1, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)) @@ -3934,6 +3953,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_MEASURES_EVENT_BOOL(EventId, varName) DEFINE_MEASURES_EVENT_PARAM1(EventId, bool, varName) #define DEFINE_MEASURES_EVENT_STRING(EventId, varName) DEFINE_MEASURES_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_COMPLIANT_MEASURES_EVENT(EventId, PrivacyTag) \ DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PrivacyTag)) #define DEFINE_COMPLIANT_MEASURES_EVENT_PARAM1(EventId, PrivacyTag, VarType1, varName1) \ @@ -4460,6 +4481,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [Optional] Simple Events // Use these macros to define very simple critical data events for a Provider. +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_CRITICAL_DATA_EVENT(EventId) \ DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA)) #define DEFINE_CRITICAL_DATA_EVENT_PARAM1(EventId, VarType1, varName1) \ @@ -4587,6 +4610,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_CRITICAL_DATA_EVENT_BOOL(EventId, varName) DEFINE_CRITICAL_DATA_EVENT_PARAM1(EventId, bool, varName) #define DEFINE_CRITICAL_DATA_EVENT_STRING(EventId, varName) DEFINE_CRITICAL_DATA_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT(EventId, PrivacyTag) \ DEFINE_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), TelemetryPrivacyDataTag(PrivacyTag)) #define DEFINE_COMPLIANT_CRITICAL_DATA_EVENT_PARAM1(EventId, PrivacyTag, VarType1, varName1) \ @@ -5031,16 +5056,18 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [optional] params are: Options, Keyword, Level, PrivacyTag #define BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, ...) \ - __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, __VA_ARGS__) \ + __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, ##__VA_ARGS__) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level, PrivacyTag +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) #define BEGIN_TRACELOGGING_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::None, 0, Level) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) +#endif #define BEGIN_COMPLIANT_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::None, 0, WINEVENT_LEVEL_VERBOSE, PrivacyTag) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) @@ -5049,12 +5076,14 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define BEGIN_CALLCONTEXT_ACTIVITY_CLASS(ActivityClassName) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) #define BEGIN_CALLCONTEXT_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, 0, Level) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) +#endif #define BEGIN_COMPLIANT_CALLCONTEXT_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, 0, WINEVENT_LEVEL_VERBOSE, PrivacyTag) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) @@ -5063,12 +5092,14 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define BEGIN_TELEMETRY_ACTIVITY_CLASS(ActivityClassName) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_TELEMETRY) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) #define BEGIN_TELEMETRY_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_TELEMETRY, Level) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) +#endif #define BEGIN_COMPLIANT_TELEMETRY_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS( \ ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_TELEMETRY, WINEVENT_LEVEL_VERBOSE, PrivacyTag) \ @@ -5079,12 +5110,14 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define BEGIN_MEASURES_ACTIVITY_CLASS(ActivityClassName) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_MEASURES) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) #define BEGIN_MEASURES_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_MEASURES, Level) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) +#endif #define BEGIN_COMPLIANT_MEASURES_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS( \ ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_MEASURES, WINEVENT_LEVEL_VERBOSE, PrivacyTag) \ @@ -5095,12 +5128,14 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) // [optional] param is: Level +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define BEGIN_CRITICAL_DATA_ACTIVITY_CLASS(ActivityClassName) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_CRITICAL_DATA) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) #define BEGIN_CRITICAL_DATA_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS(ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_CRITICAL_DATA, Level) \ __IMPLEMENT_ACTIVITY_CLASS(ActivityClassName) +#endif #define BEGIN_COMPLIANT_CRITICAL_DATA_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ __BEGIN_TRACELOGGING_ACTIVITY_CLASS( \ ActivityClassName, wil::ActivityOptions::TelemetryOnFailure, MICROSOFT_KEYWORD_CRITICAL_DATA, WINEVENT_LEVEL_VERBOSE, PrivacyTag) \ @@ -5118,8 +5153,9 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // the name (for tracelogging you can give other options) // [optional] params are: Options, Keyword, Level +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define DEFINE_CUSTOM_ACTIVITY(ActivityClassName, ...) \ - BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, __VA_ARGS__) \ + BEGIN_CUSTOM_ACTIVITY_CLASS(ActivityClassName, ##__VA_ARGS__) \ END_ACTIVITY_CLASS() #define DEFINE_TRACELOGGING_ACTIVITY(ActivityClassName) \ @@ -5142,6 +5178,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_TELEMETRY_ACTIVITY_WITH_LEVEL(ActivityClassName, Level) \ BEGIN_TELEMETRY_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ END_ACTIVITY_CLASS() +#endif + #define DEFINE_COMPLIANT_TELEMETRY_ACTIVITY(ActivityClassName, PrivacyTag) \ BEGIN_COMPLIANT_TELEMETRY_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ END_ACTIVITY_CLASS() @@ -5149,12 +5187,15 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") BEGIN_COMPLIANT_TELEMETRY_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, PrivacyTag, Level) \ END_ACTIVITY_CLASS() +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define DEFINE_MEASURES_ACTIVITY(ActivityClassName) \ BEGIN_MEASURES_ACTIVITY_CLASS(ActivityClassName) \ END_ACTIVITY_CLASS() #define DEFINE_MEASURES_ACTIVITY_WITH_LEVEL(ActivityClassName, Level) \ BEGIN_MEASURES_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ END_ACTIVITY_CLASS() +#endif + #define DEFINE_COMPLIANT_MEASURES_ACTIVITY(ActivityClassName, PrivacyTag) \ BEGIN_COMPLIANT_MEASURES_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ END_ACTIVITY_CLASS() @@ -5162,12 +5203,15 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") BEGIN_COMPLIANT_MEASURES_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, PrivacyTag, Level) \ END_ACTIVITY_CLASS() +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY #define DEFINE_CRITICAL_DATA_ACTIVITY(ActivityClassName) \ BEGIN_CRITICAL_DATA_ACTIVITY_CLASS(ActivityClassName) \ END_ACTIVITY_CLASS() #define DEFINE_CRITICAL_DATA_ACTIVITY_WITH_LEVEL(ActivityClassName, Level) \ BEGIN_CRITICAL_DATA_ACTIVITY_CLASS_WITH_LEVEL(ActivityClassName, Level) \ END_ACTIVITY_CLASS() +#endif + #define DEFINE_COMPLIANT_CRITICAL_DATA_ACTIVITY(ActivityClassName, PrivacyTag) \ BEGIN_COMPLIANT_CRITICAL_DATA_ACTIVITY_CLASS(ActivityClassName, PrivacyTag) \ END_ACTIVITY_CLASS() @@ -5190,20 +5234,22 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // TraceLoggingClassWriteTagged or TraceLoggingClassWriteTaggedTelemetry macros from within a custom event // to write the event. -#define TraceLoggingClassWriteTagged(EventId, ...) __WI_TraceLoggingWriteTagged(*this, #EventId, __VA_ARGS__) +#define TraceLoggingClassWriteTagged(EventId, ...) __WI_TraceLoggingWriteTagged(*this, #EventId, ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedTelemetry(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedMeasure(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), ##__VA_ARGS__) #define TraceLoggingClassWriteTaggedCriticalData(EventId, ...) \ - __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), __VA_ARGS__) + __WI_TraceLoggingWriteTagged(*this, #EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), ##__VA_ARGS__) // [Optional] Simple Tagged Events for Activities // Use these methods to define very simple tagged events for a Custom Activity. +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_TAGGED_TELEMETRY_EVENT(EventId) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY)) #define DEFINE_TAGGED_TELEMETRY_EVENT_PARAM1(EventId, VarType1, varName1) \ @@ -5332,6 +5378,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_TAGGED_TELEMETRY_EVENT_BOOL(EventId, varName) DEFINE_TAGGED_TELEMETRY_EVENT_PARAM1(EventId, bool, varName) #define DEFINE_TAGGED_TELEMETRY_EVENT_STRING(EventId, varName) DEFINE_TAGGED_TELEMETRY_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_TAGGED_COMPLIANT_TELEMETRY_EVENT(EventId, PrivacyTag) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), TelemetryPrivacyDataTag(PrivacyTag)) #define DEFINE_TAGGED_COMPLIANT_TELEMETRY_EVENT_PARAM1(EventId, PrivacyTag, VarType1, varName1) \ @@ -5461,6 +5509,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [Optional] Simple Tagged Events for Activities // Use these methods to define very simple tagged measures events for a Custom Activity. +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_TAGGED_MEASURES_EVENT(EventId) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES)) #define DEFINE_TAGGED_MEASURES_EVENT_PARAM1(EventId, VarType1, varName1) \ @@ -5588,6 +5638,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_TAGGED_MEASURES_EVENT_BOOL(EventId, varName) DEFINE_TAGGED_MEASURES_EVENT_PARAM1(EventId, bool, varName) #define DEFINE_TAGGED_MEASURES_EVENT_STRING(EventId, varName) DEFINE_TAGGED_MEASURES_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_TAGGED_COMPLIANT_MEASURES_EVENT(EventId, PrivacyTag) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES), TelemetryPrivacyDataTag(PrivacyTag)) #define DEFINE_TAGGED_COMPLIANT_MEASURES_EVENT_PARAM1(EventId, PrivacyTag, VarType1, varName1) \ @@ -5717,6 +5769,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") // [Optional] Simple Tagged Events for Activities // Use these methods to define very simple tagged CRITICAL_DATA events for a Custom Activity. +#ifndef DISABLE_NONCOMPLIANT_TELEMETRY + #define DEFINE_TAGGED_CRITICAL_DATA_EVENT(EventId) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA)) #define DEFINE_TAGGED_CRITICAL_DATA_EVENT_PARAM1(EventId, VarType1, varName1) \ @@ -5888,6 +5942,8 @@ WIL_WARN_DEPRECATED_1612_PRAGMA("IMPLEMENT_TRACELOGGING_CLASS") #define DEFINE_TAGGED_CRITICAL_DATA_EVENT_STRING(EventId, varName) \ DEFINE_TAGGED_CRITICAL_DATA_EVENT_PARAM1(EventId, PCWSTR, varName) +#endif + #define DEFINE_TAGGED_COMPLIANT_CRITICAL_DATA_EVENT(EventId, PrivacyTag) \ DEFINE_TAGGED_TRACELOGGING_EVENT(EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_CRITICAL_DATA), TelemetryPrivacyDataTag(PrivacyTag)) #define DEFINE_TAGGED_COMPLIANT_CRITICAL_DATA_EVENT_PARAM1(EventId, PrivacyTag, VarType1, varName1) \ @@ -6202,10 +6258,10 @@ public: using TelemetryBase = wil::TraceLoggingProvider; #define TRACELOGGING_WRITE_EVENT(TraceLoggingClassName, EventId, ...) \ - TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, __VA_ARGS__) + TraceLoggingWrite(TraceLoggingClassName::TraceLoggingType::Provider(), EventId, ##__VA_ARGS__) #define TELEMETRY_WRITE_EVENT(EventId, ...) \ - TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), __VA_ARGS__) + TraceLoggingWrite(TraceLoggingType::Provider(), EventId, TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY), ##__VA_ARGS__) #define DEFINE_TAGGED_EVENT_METHOD(MethodName) \ public: \ @@ -6318,14 +6374,14 @@ namespace details const wchar_t* strAfterNamespace = GetClassStringPointer(node->className); size_t classStrLen = wcslen(strAfterNamespace ? strAfterNamespace : node->className); - totalApiListLength += (classStrLen + wcslen(node->apiName) + 1); // We add 1 to account for the comma delimeter + totalApiListLength += (classStrLen + wcslen(node->apiName) + 1); // We add 1 to account for the comma delimiter if (node->specialization) { - totalSpecializationsLength += strlen(node->specialization) + 1; // We add 1 to account for the comma delimeter + totalSpecializationsLength += strlen(node->specialization) + 1; // We add 1 to account for the comma delimiter } else { - totalSpecializationsLength += 2; // '-' plus comma delimeter + totalSpecializationsLength += 2; // '-' plus comma delimiter } numCounts++; }); @@ -6546,15 +6602,15 @@ namespace details #else m_fireEventDelay = __TRACELOGGING_TEST_HOOK_API_TELEMETRY_EVENT_DELAY_MS; #endif - m_fireEventThreadPoolTimer.reset(::CreateThreadpoolTimer( - [](PTP_CALLBACK_INSTANCE, PVOID, PTP_TIMER) { - FireEvent(); - }, - nullptr, - nullptr)); + m_fireEventThreadPoolTimer.reset(::CreateThreadpoolTimer(&FireEventCallback, nullptr, nullptr)); ScheduleFireEventCallback(); } + static void __stdcall FireEventCallback(PTP_CALLBACK_INSTANCE, PVOID, PTP_TIMER) + { + FireEvent(); + } + ~ApiTelemetryLogger() WI_NOEXCEPT override { FireEvent(); @@ -6634,9 +6690,9 @@ namespace details #define __WI_LOG_API_USE1(apiName) __WI_LOG_CLASS_API_USE3(InternalGetRuntimeClassName(), apiName, nullptr) /// @endcond -#define WI_LOG_CLASS_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_CLASS_API_USE, __VA_ARGS__) +#define WI_LOG_CLASS_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_CLASS_API_USE, ##__VA_ARGS__) -#define WI_LOG_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_API_USE, __VA_ARGS__) +#define WI_LOG_API_USE(...) WI_MACRO_DISPATCH(__WI_LOG_API_USE, ##__VA_ARGS__) #ifdef __clang__ #pragma clang diagnostic pop diff --git a/3rdparty/winwil/include/wil/com.h b/3rdparty/winwil/include/wil/com.h index 5d0e289d78..7438c0a839 100644 --- a/3rdparty/winwil/include/wil/com.h +++ b/3rdparty/winwil/include/wil/com.h @@ -2398,7 +2398,7 @@ RETURN_IF_FAILED(wil::stream_seek_nothrow(source, LLONG_MAX, STREAM_SEEK_CUR)); @param stream The stream to seek @param offset The position, in bytes from the current position, to seek @param from The starting point from which to seek, from the STREAM_SEEK_* set of values -@param value Optionally recieves the new absolute position from the stream +@param value Optionally receives the new absolute position from the stream */ inline HRESULT stream_seek_nothrow(_In_ IStream* stream, long long offset, unsigned long from, _Out_opt_ unsigned long long* value = nullptr) { @@ -2418,7 +2418,7 @@ RETURN_HR(wil::stream_set_position_nothrow(source, 16)); ~~~~ @param stream The stream whose size is to be returned in `value` @param offset The position, in bytes from the start of the stream, to seek to -@param value Optionally recieves the new absolute position from the stream +@param value Optionally receives the new absolute position from the stream */ inline HRESULT stream_set_position_nothrow(_In_ IStream* stream, unsigned long long offset, _Out_opt_ unsigned long long* value = nullptr) { @@ -2888,7 +2888,7 @@ if (wcscmp(content.get(), L"waffles") == 0) @endcode @param source The stream from which to read a string @param options Controls the behavior when reading a zero-length string -@return An non-null string (but possibly zero lengh) string read from `source` +@return An non-null string (but possibly zero length) string read from `source` */ inline wil::unique_cotaskmem_string stream_read_string(_In_ ISequentialStream* source, empty_string_options options = empty_string_options::returns_empty) { diff --git a/3rdparty/winwil/include/wil/common.h b/3rdparty/winwil/include/wil/common.h index b0abf8f43a..30161999aa 100644 --- a/3rdparty/winwil/include/wil/common.h +++ b/3rdparty/winwil/include/wil/common.h @@ -526,7 +526,7 @@ to be able to layer additional functionality into other libraries by their mere of initialization should be used whenever they are available. ~~~~ #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -WI_HEADER_INITITALIZATION_FUNCTION(InitializeDesktopFamilyApis, [] +WI_HEADER_INITIALIZATION_FUNCTION(InitializeDesktopFamilyApis, [] { g_pfnGetModuleName = GetCurrentModuleName; g_pfnFailFastInLoaderCallout = FailFastInLoaderCallout; @@ -537,16 +537,16 @@ WI_HEADER_INITITALIZATION_FUNCTION(InitializeDesktopFamilyApis, [] The above example is used within WIL to decide whether or not the library containing WIL is allowed to use desktop APIs. Building this functionality as `#IFDEF`s within functions would create ODR violations, whereas doing it with global function pointers and header initialization allows a runtime determination. */ -#define WI_HEADER_INITITALIZATION_FUNCTION(name, fn) +#define WI_HEADER_INITIALIZATION_FUNCTION(name, fn) #elif defined(_M_IX86) -#define WI_HEADER_INITITALIZATION_FUNCTION(name, fn) \ +#define WI_HEADER_INITIALIZATION_FUNCTION(name, fn) \ extern "C" \ { \ __declspec(selectany) unsigned char g_header_init_##name = static_cast(fn()); \ } \ __pragma(comment(linker, "/INCLUDE:_g_header_init_" #name)) #elif defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64) -#define WI_HEADER_INITITALIZATION_FUNCTION(name, fn) \ +#define WI_HEADER_INITIALIZATION_FUNCTION(name, fn) \ extern "C" \ { \ __declspec(selectany) unsigned char g_header_init_##name = static_cast(fn()); \ @@ -556,6 +556,9 @@ doing it with global function pointers and header initialization allows a runtim #error linker pragma must include g_header_init variation #endif +// Keep the misspelled name for backward compatibility. +#define WI_HEADER_INITITALIZATION_FUNCTION(name, fn) WI_HEADER_INITIALIZATION_FUNCTION(name, fn) + /** All Windows Implementation Library classes and functions are located within the "wil" namespace. The 'wil' namespace is an intentionally short name as the intent is for code to be able to reference the namespace directly (example: `wil::srwlock lock;`) without a using statement. Resist adding a using @@ -687,32 +690,32 @@ boolean, BOOLEAN, and classes with an explicit bool cast. @param val The logical bool expression @return A C++ bool representing the evaluation of `val`. */ template -_Post_satisfies_(return == static_cast(val)) __forceinline constexpr bool verify_bool(const T& val) +_Post_satisfies_(return == static_cast(val)) __forceinline constexpr bool verify_bool(const T& val) WI_NOEXCEPT { return static_cast(val); } template -__forceinline constexpr bool verify_bool(T /*val*/) +__forceinline constexpr bool verify_bool(T /*val*/) WI_NOEXCEPT { static_assert(!wistd::is_same::value, "Wrong Type: bool/BOOL/BOOLEAN/boolean expected"); return false; } template <> -_Post_satisfies_(return == val) __forceinline constexpr bool verify_bool(bool val) +_Post_satisfies_(return == val) __forceinline constexpr bool verify_bool(bool val) WI_NOEXCEPT { return val; } template <> -_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(int val) +_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(int val) WI_NOEXCEPT { return (val != 0); } template <> -_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(unsigned char val) +_Post_satisfies_(return == (val != 0)) __forceinline constexpr bool verify_bool(unsigned char val) WI_NOEXCEPT { return (val != 0); } @@ -723,7 +726,7 @@ accept any `int` value as long as that is the underlying typedef behind `BOOL`. @param val The Win32 BOOL returning expression @return A Win32 BOOL representing the evaluation of `val`. */ template -_Post_satisfies_(return == val) __forceinline constexpr int verify_BOOL(T val) +_Post_satisfies_(return == val) __forceinline constexpr int verify_BOOL(T val) WI_NOEXCEPT { // Note: Written in terms of 'int' as BOOL is actually: typedef int BOOL; static_assert((wistd::is_same::value), "Wrong Type: BOOL expected"); @@ -752,7 +755,7 @@ RETURN_HR_IF(static_cast(UIA_E_NOTSUPPORTED), (patternId != UIA_DragPat @param hr The HRESULT returning expression @return An HRESULT representing the evaluation of `val`. */ template -_Post_satisfies_(return == hr) inline constexpr long verify_hresult(T hr) +_Post_satisfies_(return == hr) inline constexpr long verify_hresult(T hr) WI_NOEXCEPT { // Note: Written in terms of 'long' as HRESULT is actually: typedef _Return_type_success_(return >= 0) long HRESULT static_assert(wistd::is_same::value, "Wrong Type: HRESULT expected"); @@ -781,7 +784,7 @@ NT_RETURN_IF_FALSE(static_cast(STATUS_NOT_SUPPORTED), (dispatch->Versi @param status The NTSTATUS returning expression @return An NTSTATUS representing the evaluation of `val`. */ template -_Post_satisfies_(return == status) inline long verify_ntstatus(T status) +_Post_satisfies_(return == status) inline long verify_ntstatus(T status) WI_NOEXCEPT { // Note: Written in terms of 'long' as NTSTATUS is actually: typedef _Return_type_success_(return >= 0) long NTSTATUS static_assert(wistd::is_same::value, "Wrong Type: NTSTATUS expected"); @@ -795,7 +798,7 @@ commonly used when manipulating Win32 error codes. @param error The Win32 error code returning expression @return An Win32 error code representing the evaluation of `error`. */ template -_Post_satisfies_(return == error) inline T verify_win32(T error) +_Post_satisfies_(return == error) inline T verify_win32(T error) WI_NOEXCEPT { // Note: Win32 error code are defined as 'long' (#define ERROR_SUCCESS 0L), but are more frequently used as DWORD (unsigned // long). This accept both types. @@ -810,7 +813,7 @@ _Post_satisfies_(return == error) inline T verify_win32(T error) // Implementation details for macros and helper functions... do not use directly. namespace details { -// Use size-specific casts to avoid sign extending numbers -- avoid warning C4310: cast truncates constant value + // Use size-specific casts to avoid sign extending numbers -- avoid warning C4310: cast truncates constant value #define __WI_MAKE_UNSIGNED(val) \ (__pragma(warning(push)) __pragma(warning(disable : 4310 4309))( \ sizeof(val) == 1 ? static_cast(val) \ diff --git a/3rdparty/winwil/include/wil/coroutine.h b/3rdparty/winwil/include/wil/coroutine.h index 0f080309e4..6ce9a058fa 100644 --- a/3rdparty/winwil/include/wil/coroutine.h +++ b/3rdparty/winwil/include/wil/coroutine.h @@ -191,7 +191,7 @@ struct com_task; /// @cond namespace wil::details::coro { -// task and com_task are convertable to each other. However, not +// task and com_task are convertible to each other. However, not // all consumers of this header have COM enabled. Support for saving // COM thread-local error information and restoring it on the resuming // thread is enabled using these function pointers. If COM is not @@ -764,8 +764,8 @@ inline void __stdcall DestroyRestrictedErrorInformation(_In_ void* restricted_er struct apartment_info { - APTTYPE aptType; - APTTYPEQUALIFIER aptTypeQualifier; + APTTYPE aptType{}; + APTTYPEQUALIFIER aptTypeQualifier{}; void load() { @@ -814,7 +814,7 @@ struct apartment_resumer __WI_COROUTINE_NAMESPACE::coroutine_handle<> waiter; wil::com_ptr context{nullptr}; - apartment_info info; + apartment_info info{}; HRESULT resume_result = S_OK; void capture_context(__WI_COROUTINE_NAMESPACE::coroutine_handle<> handle) @@ -925,7 +925,7 @@ auto task_base::resume_same_apartment() && noexcept // This section is lit up when COM headers are available. Initialize the global function // pointers such that error information can be saved and restored across thread boundaries. -WI_HEADER_INITITALIZATION_FUNCTION(CoroutineRestrictedErrorInitialize, [] { +WI_HEADER_INITIALIZATION_FUNCTION(CoroutineRestrictedErrorInitialize, [] { ::wil::details::coro::g_pfnCaptureRestrictedErrorInformation = ::wil::details::coro::CaptureRestrictedErrorInformation; ::wil::details::coro::g_pfnRestoreRestrictedErrorInformation = ::wil::details::coro::RestoreRestrictedErrorInformation; ::wil::details::coro::g_pfnDestroyRestrictedErrorInformation = ::wil::details::coro::DestroyRestrictedErrorInformation; diff --git a/3rdparty/winwil/include/wil/cppwinrt.h b/3rdparty/winwil/include/wil/cppwinrt.h index b26dd48b53..43570d74f6 100644 --- a/3rdparty/winwil/include/wil/cppwinrt.h +++ b/3rdparty/winwil/include/wil/cppwinrt.h @@ -255,7 +255,7 @@ namespace details { #ifndef CPPWINRT_SUPPRESS_STATIC_INITIALIZERS WI_ODR_PRAGMA("CPPWINRT_SUPPRESS_STATIC_INITIALIZERS", "0") - WI_HEADER_INITITALIZATION_FUNCTION(WilInitialize_CppWinRT, [] { + WI_HEADER_INITIALIZATION_FUNCTION(WilInitialize_CppWinRT, [] { ::wil::WilInitialize_CppWinRT(); return 1; }); diff --git a/3rdparty/winwil/include/wil/filesystem.h b/3rdparty/winwil/include/wil/filesystem.h index fbad2294b3..85fbb207f4 100644 --- a/3rdparty/winwil/include/wil/filesystem.h +++ b/3rdparty/winwil/include/wil/filesystem.h @@ -476,7 +476,7 @@ next_entry_offset_iterator create_next_entry_offset_iterator(T* p) enum class FolderChangeEvent : DWORD { - ChangesLost = 0, // requies special handling, reset state as events were lost + ChangesLost = 0, // requires special handling, reset state as events were lost Added = FILE_ACTION_ADDED, Removed = FILE_ACTION_REMOVED, Modified = FILE_ACTION_MODIFIED, @@ -1122,9 +1122,9 @@ struct file_and_error_result DWORD last_error{}; }; -/** Non-throwing open existing using OPEN_EXISTING. +/** Non-throwing open existing using OPEN_EXISTING, returns handle and error code. ~~~ -auto handle = wil::try_open_file(filePath.c_str()); +auto [handle, error] = wil::try_open_file(filePath.c_str()); ~~~ */ inline file_and_error_result try_open_file( @@ -1150,7 +1150,7 @@ inline wil::unique_hfile open_file( DWORD dwDesiredAccess = GENERIC_READ, DWORD dwShareMode = FILE_SHARE_READ, DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, - bool inheritHandle = false) noexcept + bool inheritHandle = false) { auto result = try_open_file(path, dwDesiredAccess, dwShareMode, dwFlagsAndAttributes, inheritHandle); THROW_WIN32_IF(result.last_error, !result.file.is_valid()); @@ -1173,7 +1173,7 @@ namespace details /** create using CREATE_NEW, returns handle and error code. ~~~ -auto [handle, error = wil::try_create_new_file(filePath.c_str()); +auto [handle, error] = wil::try_create_new_file(filePath.c_str()); ~~~ */ inline file_and_error_result try_create_new_file( @@ -1189,7 +1189,7 @@ inline file_and_error_result try_create_new_file( /** create using OPEN_ALWAYS, returns handle and error code. ~~~ -auto [handle, error = wil::try_open_or_create_file(filePath.c_str()); +auto [handle, error] = wil::try_open_or_create_file(filePath.c_str()); ~~~ */ inline file_and_error_result try_open_or_create_file( @@ -1205,7 +1205,7 @@ inline file_and_error_result try_open_or_create_file( /** create using CREATE_ALWAYS, returns handle and error code. ~~~ -auto [handle, error = wil::try_open_or_truncate_existing_file(filePath.c_str()); +auto [handle, error] = wil::try_open_or_truncate_existing_file(filePath.c_str()); ~~~ */ inline file_and_error_result try_open_or_truncate_existing_file( @@ -1221,7 +1221,7 @@ inline file_and_error_result try_open_or_truncate_existing_file( /** create using TRUNCATE_EXISTING, returns handle and error code. ~~~ -auto [handle, error = wil::try_truncate_existing_file(filePath.c_str()); +auto [handle, error] = wil::try_truncate_existing_file(filePath.c_str()); ~~~ */ inline file_and_error_result try_truncate_existing_file( @@ -1247,7 +1247,7 @@ inline wil::unique_hfile create_new_file( DWORD dwShareMode = FILE_SHARE_READ, LPSECURITY_ATTRIBUTES lpSecurityAttributes = nullptr, DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, - HANDLE hTemplateFile = nullptr) noexcept + HANDLE hTemplateFile = nullptr) { auto result = try_create_new_file(path, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile); THROW_WIN32_IF(result.last_error, !result.file.is_valid()); @@ -1265,7 +1265,7 @@ inline wil::unique_hfile open_or_create_file( DWORD dwShareMode = FILE_SHARE_READ, LPSECURITY_ATTRIBUTES lpSecurityAttributes = nullptr, DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, - HANDLE hTemplateFile = nullptr) noexcept + HANDLE hTemplateFile = nullptr) { auto result = try_open_or_create_file(path, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile); THROW_WIN32_IF(result.last_error, !result.file.is_valid()); @@ -1283,7 +1283,7 @@ inline wil::unique_hfile open_or_truncate_existing_file( DWORD dwShareMode = FILE_SHARE_READ, LPSECURITY_ATTRIBUTES lpSecurityAttributes = nullptr, DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, - HANDLE hTemplateFile = nullptr) noexcept + HANDLE hTemplateFile = nullptr) { auto result = try_open_or_truncate_existing_file( path, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile); @@ -1302,7 +1302,7 @@ inline wil::unique_hfile truncate_existing_file( DWORD dwShareMode = FILE_SHARE_READ, LPSECURITY_ATTRIBUTES lpSecurityAttributes = nullptr, DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL, - HANDLE hTemplateFile = nullptr) noexcept + HANDLE hTemplateFile = nullptr) { auto result = try_truncate_existing_file(path, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlagsAndAttributes, hTemplateFile); diff --git a/3rdparty/winwil/include/wil/resource.h b/3rdparty/winwil/include/wil/resource.h index cecaf55fd5..1295212ba0 100644 --- a/3rdparty/winwil/include/wil/resource.h +++ b/3rdparty/winwil/include/wil/resource.h @@ -27,10 +27,10 @@ // stdint.h and intsafe.h have conflicting definitions, so it's not safe to include either to pick up our dependencies, // so the definitions we need are copied below #ifdef _WIN64 -#define __WI_SIZE_MAX 0xffffffffffffffffui64 // UINT64_MAX -#else /* _WIN64 */ -#define __WI_SIZE_MAX 0xffffffffui32 // UINT32_MAX -#endif /* _WIN64 */ +#define __WI_SIZE_MAX 0xffffffffffffffffULL // UINT64_MAX +#else /* _WIN64 */ +#define __WI_SIZE_MAX 0xffffffffUL // UINT32_MAX +#endif /* _WIN64 */ /// @endcond // Forward declaration @@ -721,7 +721,7 @@ class com_ptr_t; // forward namespace details { // The first two attach_to_smart_pointer() overloads are ambiguous when passed a com_ptr_t. - // To solve that use this functions return type to elminate the reset form for com_ptr_t. + // To solve that use this functions return type to eliminate the reset form for com_ptr_t. template wistd::false_type use_reset(wil::com_ptr_t*) { @@ -1025,7 +1025,7 @@ struct empty_deleter }; /** unique_any_array_ptr is a RAII type for managing conformant arrays that need to be freed and have elements that may need to be -freed. The intented use for this RAII type would be to capture out params from API like IPropertyValue::GetStringArray. This class +freed. The intended use for this RAII type would be to capture out params from API like IPropertyValue::GetStringArray. This class also maintains the size of the array, so it can iterate over the members and deallocate them before it deallocates the base array pointer. @@ -2892,6 +2892,7 @@ typedef unique_any_t, err_exception_policy>> unique_event; #endif +#ifndef WIL_NO_SLIM_EVENT #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ ((_WIN32_WINNT >= _WIN32_WINNT_WIN8) || (__WIL_RESOURCE_ENABLE_QUIRKS && (_WIN32_WINNT >= _WIN32_WINNT_WIN7))) enum class SlimEventType @@ -2973,13 +2974,13 @@ public: return !!ReadAcquire(&m_isSignaled); } - bool wait(DWORD timeoutMiliseconds) WI_NOEXCEPT + bool wait(DWORD timeoutMilliseconds) WI_NOEXCEPT { - if (timeoutMiliseconds == 0) + if (timeoutMilliseconds == 0) { return TryAcquireEvent(); } - else if (timeoutMiliseconds == INFINITE) + else if (timeoutMilliseconds == INFINITE) { return wait(); } @@ -2991,12 +2992,12 @@ public: while (!TryAcquireEvent()) { - if (elapsedTimeMilliseconds >= timeoutMiliseconds) + if (elapsedTimeMilliseconds >= timeoutMilliseconds) { return false; } - DWORD newTimeout = static_cast(timeoutMiliseconds - elapsedTimeMilliseconds); + DWORD newTimeout = static_cast(timeoutMilliseconds - elapsedTimeMilliseconds); if (!WaitForSignal(newTimeout)) { @@ -3039,10 +3040,10 @@ private: } } - bool WaitForSignal(DWORD timeoutMiliseconds) WI_NOEXCEPT + bool WaitForSignal(DWORD timeoutMilliseconds) WI_NOEXCEPT { LONG falseValue = FALSE; - BOOL waitResult = WaitOnAddress(&m_isSignaled, &falseValue, sizeof(m_isSignaled), timeoutMiliseconds); + BOOL waitResult = WaitOnAddress(&m_isSignaled, &falseValue, sizeof(m_isSignaled), timeoutMilliseconds); __FAIL_FAST_ASSERT__(waitResult || ::GetLastError() == ERROR_TIMEOUT); return !!waitResult; } @@ -3060,6 +3061,7 @@ using slim_event_manual_reset = slim_event_t; using slim_event = slim_event_auto_reset; #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && (_WIN32_WINNT >= _WIN32_WINNT_WIN8) +#endif // WIL_NO_SLIM_EVENT typedef unique_any mutex_release_scope_exit; @@ -4731,7 +4733,7 @@ inline unique_hstring make_unique_string_nothrow( _When_((source != nullptr) && length == static_cast(-1), _In_z_) PCWSTR source, size_t length) WI_NOEXCEPT { - WI_ASSERT(source != nullptr); // the HSTRING version of this function does not suport this case + WI_ASSERT(source != nullptr); // the HSTRING version of this function does not support this case if (length == static_cast(-1)) { length = wcslen(source); @@ -5218,7 +5220,7 @@ struct cert_context_t } /** A wrapper around CertEnumCertificatesInStore. - CertEnumCertificatesInStore takes ownership of its second paramter in an unclear fashion, + CertEnumCertificatesInStore takes ownership of its second parameter in an unclear fashion, making it error-prone to use in combination with unique_cert_context. This wrapper helps manage the resource correctly while ensuring the GetLastError state set by CertEnumCertificatesInStore. is not lost. See MSDN for more information on `CertEnumCertificatesInStore`. @@ -6264,7 +6266,7 @@ using wdf_wait_lock_release_scope_exit = using unique_wdf_device_init = unique_any; #endif -inline WI_NODISCARD _IRQL_requires_max_(PASSIVE_LEVEL) +WI_NODISCARD inline _IRQL_requires_max_(PASSIVE_LEVEL) _Acquires_lock_(lock) wdf_wait_lock_release_scope_exit acquire_wdf_wait_lock(WDFWAITLOCK lock) WI_NOEXCEPT { @@ -6272,7 +6274,7 @@ wdf_wait_lock_release_scope_exit acquire_wdf_wait_lock(WDFWAITLOCK lock) WI_NOEX return wdf_wait_lock_release_scope_exit(lock); } -inline WI_NODISCARD _IRQL_requires_max_(APC_LEVEL) +WI_NODISCARD inline _IRQL_requires_max_(APC_LEVEL) _When_(return, _Acquires_lock_(lock)) wdf_wait_lock_release_scope_exit try_acquire_wdf_wait_lock(WDFWAITLOCK lock) WI_NOEXCEPT { @@ -6291,7 +6293,7 @@ wdf_wait_lock_release_scope_exit try_acquire_wdf_wait_lock(WDFWAITLOCK lock) WI_ using wdf_spin_lock_release_scope_exit = unique_any; -inline WI_NODISCARD _IRQL_requires_max_(DISPATCH_LEVEL) +WI_NODISCARD inline _IRQL_requires_max_(DISPATCH_LEVEL) _IRQL_raises_(DISPATCH_LEVEL) _Acquires_lock_(lock) wdf_spin_lock_release_scope_exit acquire_wdf_spin_lock(WDFSPINLOCK lock) WI_NOEXCEPT @@ -6507,7 +6509,7 @@ private: // function only if the call-site source location is obtained from elsewhere (i.e., plumbed // through other abstractions). template -inline WI_NODISCARD unique_wdf_object_reference wdf_object_reference_increment( +WI_NODISCARD inline unique_wdf_object_reference wdf_object_reference_increment( wdf_object_t wdfObject, PVOID tag, LONG lineNumber, PCSTR fileName) WI_NOEXCEPT { // Parameter is incorrectly marked as non-const, so the const-cast is required. @@ -6516,7 +6518,7 @@ inline WI_NODISCARD unique_wdf_object_reference wdf_object_referen } template -inline WI_NODISCARD unique_wdf_object_reference wdf_object_reference_increment( +WI_NODISCARD inline unique_wdf_object_reference wdf_object_reference_increment( const wil::unique_wdf_any& wdfObject, PVOID tag, LONG lineNumber, PCSTR fileName) WI_NOEXCEPT { return wdf_object_reference_increment(wdfObject.get(), tag, lineNumber, fileName); @@ -7451,7 +7453,7 @@ namespace details { // Only those lock types specialized by lock_proof_traits will allow either a write_lock_required or // read_lock_required to be constructed. The allows_exclusive value indicates if the type represents an exclusive, - // write-safe lock aquisition, or a shared, read-only lock acquisition. + // write-safe lock acquisition, or a shared, read-only lock acquisition. template struct lock_proof_traits { @@ -7480,7 +7482,7 @@ another function that requires them. These types are implicitly convertible from various lock holding types, enabling callers to provide them as proof of the lock that they hold. -The following example is intentially contrived to demonstrate multiple use cases: +The following example is intentionally contrived to demonstrate multiple use cases: - Methods that require only shared/read access - Methods that require only exclusive write access - Methods that pass their proof-of-lock to a helper diff --git a/3rdparty/winwil/include/wil/result.h b/3rdparty/winwil/include/wil/result.h index af63f30efe..154a4d42ad 100644 --- a/3rdparty/winwil/include/wil/result.h +++ b/3rdparty/winwil/include/wil/result.h @@ -435,7 +435,7 @@ namespace details_abi private: struct Node { - DWORD threadId = ULONG_MAX; + DWORD threadId = 0xffffffff; // MAXDWORD Node* pNext = nullptr; T value{}; }; @@ -1169,7 +1169,7 @@ namespace details __declspec(selectany)::wil::details_abi::ProcessLocalStorage<::wil::details_abi::ProcessLocalData> g_processLocalData("WilError_03"); __declspec(selectany)::wil::details_abi::ThreadLocalStorage g_threadFailureCallbacks; - WI_HEADER_INITITALIZATION_FUNCTION(InitializeResultHeader, [] { + WI_HEADER_INITIALIZATION_FUNCTION(InitializeResultHeader, [] { g_pfnGetContextAndNotifyFailure = GetContextAndNotifyFailure; ::wil::details_abi::g_pProcessLocalData = &g_processLocalData; g_pThreadFailureCallbacks = &g_threadFailureCallbacks; diff --git a/3rdparty/winwil/include/wil/result_macros.h b/3rdparty/winwil/include/wil/result_macros.h index d01a1649f3..59a208d005 100644 --- a/3rdparty/winwil/include/wil/result_macros.h +++ b/3rdparty/winwil/include/wil/result_macros.h @@ -93,7 +93,7 @@ typedef _Return_type_success_(return >= 0) LONG NTSTATUS; #endif #ifndef __NTSTATUS_FROM_WIN32 #define __NTSTATUS_FROM_WIN32(x) \ - ((NTSTATUS)(x) <= 0 ? ((NTSTATUS)(x)) : ((NTSTATUS)(((x)&0x0000FFFF) | (FACILITY_WIN32 << 16) | ERROR_SEVERITY_ERROR))) + ((NTSTATUS)(x) <= 0 ? ((NTSTATUS)(x)) : ((NTSTATUS)(((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | ERROR_SEVERITY_ERROR))) #endif #ifndef WIL_AllocateMemory @@ -757,6 +757,14 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0") return __hr; \ } \ __WI_SUPPRESS_4127_E while ((void)0, 0) +#define __RETURN_HR_FAIL_SUPPRESS_TELEMETRY(hr, str) \ + __WI_SUPPRESS_4127_S do \ + { \ + const HRESULT __hr = (hr); \ + __R_FN(Return_HrSuppressTelemetry)(__R_INFO(str) __hr); \ + return __hr; \ + } \ + __WI_SUPPRESS_4127_E while ((void)0, 0) #define __RETURN_HR_FAIL_NOFILE(hr, str) \ __WI_SUPPRESS_4127_S do \ { \ @@ -1097,6 +1105,21 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0") } \ } while ((void)0, 0) +// Always logs failed HR, if expected, telemetry will be called with 'alreadyReported' +#define RETURN_IF_FAILED_SUPPRESS_TELEMETRY_IF_EXPECTED(hr, hrExpected, ...) \ + do \ + { \ + const auto __hrRet = wil::verify_hresult(hr); \ + if (FAILED(__hrRet)) \ + { \ + if ((__hrRet == wil::verify_hresult(hrExpected)) WI_FOREACH(__WI_OR_IS_EXPECTED_HRESULT, ##__VA_ARGS__)) \ + { \ + __RETURN_HR_FAIL_SUPPRESS_TELEMETRY(__hrRet, #hr); \ + } \ + __RETURN_HR_FAIL(__hrRet, #hr); \ + } \ + } while ((void)0, 0) + //***************************************************************************** // Macros for logging failures (ignore or pass-through) //***************************************************************************** @@ -1267,7 +1290,7 @@ WI_ODR_PRAGMA("WIL_FreeMemory", "0") if (!wil::verify_bool(condition)) \ { \ WI_ASSERT_FAIL(#condition); \ - __RFF_FN(FailFast_Unexpected)(__RFF_INFO_ONLY(#condition)) \ + __RFF_FN(FailFast_Unexpected)(__RFF_INFO_ONLY(#condition)); \ } \ } while (0, 0) #define WI_FAIL_FAST_ASSERT_MSG(condition, msg) \ @@ -1738,7 +1761,7 @@ inline HRESULT GetFailureLogString( _Pre_satisfies_(cchDest > 0) _In_ size_t cchDest, _In_ FailureInfo const& failure) WI_NOEXCEPT { - // This function was lenient to empty strings at one point and some callers became dependent on this beahvior + // This function was lenient to empty strings at one point and some callers became dependent on this behavior if ((cchDest == 0) || (pszDest == nullptr)) { return S_OK; @@ -2155,6 +2178,7 @@ namespace details _Pre_satisfies_(debugStringSizeChars > 0) size_t debugStringSizeChars, _Out_writes_(callContextStringSizeChars) _Post_z_ PSTR callContextString, _Pre_satisfies_(callContextStringSizeChars > 0) size_t callContextStringSizeChars, + FailureFlags flags, _Out_ FailureInfo* failure) WI_NOEXCEPT; __declspec(noinline) inline void ReportFailure( @@ -2168,12 +2192,13 @@ namespace details __R_FN_PARAMS_FULL, const ResultStatus& resultPair, _In_opt_ PCWSTR message = nullptr, - ReportFailureOptions options = ReportFailureOptions::None); + ReportFailureOptions options = ReportFailureOptions::None, + FailureFlags flags = FailureFlags::None); template inline void ReportFailure_ReplaceMsg(__R_FN_PARAMS_FULL, HRESULT hr, _Printf_format_string_ PCSTR formatString, ...); __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, FailureType type, HRESULT hr); template - __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr); + __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags flags = FailureFlags::None); template __declspec(noinline) inline HRESULT ReportFailure_CaughtException(__R_FN_PARAMS_FULL, SupportedExceptions supported = SupportedExceptions::Default); @@ -2745,7 +2770,7 @@ namespace details { status = ((NTSTATUS)(hr) <= 0 ? ((NTSTATUS)(hr)) - : ((NTSTATUS)(((hr)&0x0000FFFF) | (FACILITY_SSPI << 16) | ERROR_SEVERITY_ERROR))); + : ((NTSTATUS)(((hr) & 0x0000FFFF) | (FACILITY_SSPI << 16) | ERROR_SEVERITY_ERROR))); } else { @@ -2826,8 +2851,8 @@ namespace details // NOTE: The following two functions are unfortunate copies of strsafe.h functions that have been copied to reduce the friction associated with using // Result.h and ResultException.h in a build that does not have WINAPI_PARTITION_DESKTOP defined (where these are conditionally enabled). - static STRSAFEAPI WilStringLengthWorkerA( - _In_reads_or_z_(cchMax) STRSAFE_PCNZCH psz, + inline HRESULT WilStringLengthWorkerA( + _In_reads_or_z_(cchMax) PCNZCH psz, _In_ _In_range_(<=, STRSAFE_MAX_CCH) size_t cchMax, _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=, _String_length_(psz)) size_t* pcchLength) { @@ -2858,8 +2883,8 @@ namespace details } _Must_inspect_result_ - STRSAFEAPI StringCchLengthA( - _In_reads_or_z_(cchMax) STRSAFE_PCNZCH psz, + inline HRESULT StringCchLengthA( + _In_reads_or_z_(cchMax) PCNZCH psz, _In_ _In_range_(1, STRSAFE_MAX_CCH) size_t cchMax, _Out_opt_ _Deref_out_range_(<, cchMax) _Deref_out_range_(<=, _String_length_(psz)) size_t* pcchLength) { @@ -2880,8 +2905,8 @@ namespace details } #pragma warning(pop) - _Post_satisfies_(cchDest > 0 && cchDest <= cchMax) static STRSAFEAPI - WilStringValidateDestA(_In_reads_opt_(cchDest) STRSAFE_PCNZCH /*pszDest*/, _In_ size_t cchDest, _In_ const size_t cchMax) + _Post_satisfies_(cchDest > 0 && cchDest <= cchMax) inline HRESULT + WilStringValidateDestA(_In_reads_opt_(cchDest) PCNZCH /*pszDest*/, _In_ size_t cchDest, _In_ const size_t cchMax) { HRESULT hr = S_OK; if ((cchDest == 0) || (cchDest > cchMax)) @@ -2891,7 +2916,7 @@ namespace details return hr; } - static STRSAFEAPI WilStringVPrintfWorkerA( + inline HRESULT WilStringVPrintfWorkerA( _Out_writes_(cchDest) _Always_(_Post_z_) STRSAFE_LPSTR pszDest, _In_ _In_range_(1, STRSAFE_MAX_CCH) size_t cchDest, _Always_(_Out_opt_ _Deref_out_range_(<=, cchDest - 1)) size_t* pcchNewDestLength, @@ -2948,7 +2973,7 @@ namespace details return hr; } - __inline HRESULT StringCchPrintfA( + inline HRESULT StringCchPrintfA( _Out_writes_(cchDest) _Always_(_Post_z_) STRSAFE_LPSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ STRSAFE_LPCSTR pszFormat, @@ -3080,7 +3105,7 @@ namespace details { #ifndef RESULT_SUPPRESS_STATIC_INITIALIZERS #if !defined(BUILD_WINDOWS) || defined(WIL_SUPPRESS_PRIVATE_API_USE) - WI_HEADER_INITITALIZATION_FUNCTION(WilInitialize_ResultMacros_DesktopOrSystem_SuppressPrivateApiUse, [] { + WI_HEADER_INITIALIZATION_FUNCTION(WilInitialize_ResultMacros_DesktopOrSystem_SuppressPrivateApiUse, [] { ::wil::WilInitialize_ResultMacros_DesktopOrSystem_SuppressPrivateApiUse(); return 1; }); @@ -3091,7 +3116,7 @@ namespace details #else // !WINAPI_PARTITION_DESKTOP, !WINAPI_PARTITION_SYSTEM, explicitly assume these modules can direct link namespace details { - WI_HEADER_INITITALIZATION_FUNCTION(WilInitialize_ResultMacros_AppOnly, [] { + WI_HEADER_INITIALIZATION_FUNCTION(WilInitialize_ResultMacros_AppOnly, [] { g_pfnRaiseFailFastException = ::RaiseFailFastException; return 1; }); @@ -3869,7 +3894,7 @@ namespace details } #if !defined(RESULT_SUPPRESS_STATIC_INITIALIZERS) - WI_HEADER_INITITALIZATION_FUNCTION(InitializeWinRt, [] { + WI_HEADER_INITIALIZATION_FUNCTION(InitializeWinRt, [] { g_pfnResultFromCaughtException_WinRt = ResultFromCaughtException_WinRt; g_pfnResultFromKnownExceptions_WinRt = ResultFromKnownExceptions_WinRt; g_pfnThrowPlatformException = ThrowPlatformException; @@ -4124,7 +4149,7 @@ namespace details } } - WI_HEADER_INITITALIZATION_FUNCTION(InitializeResultExceptions, [] { + WI_HEADER_INITIALIZATION_FUNCTION(InitializeResultExceptions, [] { g_pfnRunFunctorWithExceptionFilter = RunFunctorWithExceptionFilter; g_pfnRethrow = Rethrow; g_pfnThrowResultException = ThrowResultExceptionInternal; @@ -4320,6 +4345,7 @@ namespace details _Pre_satisfies_(debugStringSizeChars > 0) size_t debugStringSizeChars, _Out_writes_(callContextStringSizeChars) _Post_z_ PSTR callContextString, _Pre_satisfies_(callContextStringSizeChars > 0) size_t callContextStringSizeChars, + FailureFlags flags, _Out_ FailureInfo* failure) WI_NOEXCEPT { debugString[0] = L'\0'; @@ -4360,7 +4386,7 @@ namespace details }; failure->type = type; - failure->flags = FailureFlags::None; + failure->flags = flags; WI_SetFlagIf(failure->flags, FailureFlags::NtStatus, resultPair.kind == ResultStatus::Kind::NtStatus); failure->failureId = ::InterlockedIncrementNoFence(&s_failureId); failure->pszMessage = ((message != nullptr) && (message[0] != L'\0')) ? message : nullptr; @@ -4501,7 +4527,8 @@ namespace details } template - inline __declspec(noinline) void ReportFailure_Return(__R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + inline __declspec(noinline) void ReportFailure_Return( + __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options, FailureFlags flags) { bool needPlatformException = ((T == FailureType::Exception) && WI_IsFlagClear(options, ReportFailureOptions::MayRethrow) && @@ -4522,6 +4549,7 @@ namespace details ARRAYSIZE(debugString), callContextString, ARRAYSIZE(callContextString), + flags, &failure); if (WI_IsFlagSet(failure.flags, FailureFlags::RequestFailFast)) @@ -4531,9 +4559,10 @@ namespace details } template - inline __declspec(noinline) void ReportFailure_Base(__R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + inline __declspec(noinline) void ReportFailure_Base( + __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options, FailureFlags flags) { - ReportFailure_Return(__R_FN_CALL_FULL, resultPair, message, options); + ReportFailure_Return(__R_FN_CALL_FULL, resultPair, message, options, flags); } template @@ -4559,6 +4588,7 @@ namespace details ARRAYSIZE(debugString), callContextString, ARRAYSIZE(callContextString), + FailureFlags::None, &failure); __WI_SUPPRESS_4127_S if ((T == FailureType::FailFast) || WI_IsFlagSet(failure.flags, FailureFlags::RequestFailFast)) @@ -4587,14 +4617,14 @@ namespace details template <> inline __declspec(noinline) RESULT_NORETURN void ReportFailure_Base( - __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options, FailureFlags) { ReportFailure_NoReturn(__R_FN_CALL_FULL, resultPair, message, options); } template <> inline __declspec(noinline) RESULT_NORETURN void ReportFailure_Base( - __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options) + __R_FN_PARAMS_FULL, const ResultStatus& resultPair, PCWSTR message, ReportFailureOptions options, FailureFlags) { ReportFailure_NoReturn(__R_FN_CALL_FULL, resultPair, message, options); } @@ -4764,19 +4794,22 @@ namespace details } template - __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr) + __declspec(noinline) inline void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags flags) { - ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); + ReportFailure_Base( + __R_FN_CALL_FULL, ResultStatus::FromResult(hr), nullptr /*message*/, ReportFailureOptions::None /*options*/, flags); } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } template <> - __declspec(noinline) inline RESULT_NORETURN void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr) + __declspec(noinline) inline RESULT_NORETURN + void ReportFailure_Hr(__R_FN_PARAMS_FULL, HRESULT hr, FailureFlags) { ReportFailure_Base(__R_FN_CALL_FULL, ResultStatus::FromResult(hr)); } @@ -5182,6 +5215,7 @@ namespace details ARRAYSIZE(debugString), callContextString, ARRAYSIZE(callContextString), + FailureFlags::None, &failure); if (WI_IsFlagSet(failure.flags, FailureFlags::RequestFailFast)) @@ -5228,6 +5262,13 @@ namespace details wil::details::ReportFailure_Hr(__R_DIRECT_FN_CALL hr); } + __R_DIRECT_METHOD(void, Return_HrSuppressTelemetry)(__R_DIRECT_FN_PARAMS HRESULT hr) WI_NOEXCEPT + { + __R_FN_LOCALS; + const FailureFlags flags = FailureFlags::RequestSuppressTelemetry; + wil::details::ReportFailure_Hr(__R_DIRECT_FN_CALL hr, flags); + } + _Success_(true) _Translates_Win32_to_HRESULT_(err) __R_DIRECT_METHOD(HRESULT, Return_Win32)(__R_DIRECT_FN_PARAMS DWORD err) WI_NOEXCEPT diff --git a/3rdparty/winwil/include/wil/result_originate.h b/3rdparty/winwil/include/wil/result_originate.h index 56df54e8d2..5eaa7e7aa1 100644 --- a/3rdparty/winwil/include/wil/result_originate.h +++ b/3rdparty/winwil/include/wil/result_originate.h @@ -122,7 +122,7 @@ namespace details } // namespace wil // Automatically call RoOriginateError upon error origination by including this file -WI_HEADER_INITITALIZATION_FUNCTION(ResultStowedExceptionInitialize, [] { +WI_HEADER_INITIALIZATION_FUNCTION(ResultStowedExceptionInitialize, [] { ::wil::SetOriginateErrorCallback(::wil::details::RaiseRoOriginateOnWilExceptions); ::wil::SetFailfastWithContextCallback(::wil::details::FailfastWithContextCallback); return 1; diff --git a/3rdparty/winwil/include/wil/safecast.h b/3rdparty/winwil/include/wil/safecast.h index 0aa7c142fe..62af9c3eda 100644 --- a/3rdparty/winwil/include/wil/safecast.h +++ b/3rdparty/winwil/include/wil/safecast.h @@ -106,7 +106,7 @@ namespace details wistd::is_same::value || wistd::is_same::value || wistd::is_same::value || wistd::is_same::value || wistd::is_same::value || wistd::is_same::value; - // True when either type is potentialy variably sized (e.g. size_t, ptrdiff_t) + // True when either type is potentially variably sized (e.g. size_t, ptrdiff_t) template constexpr bool is_potentially_variably_sized_cast_v = is_potentially_variably_sized_type_v || is_potentially_variably_sized_type_v; diff --git a/3rdparty/winwil/include/wil/windowing.h b/3rdparty/winwil/include/wil/windowing.h index 6e83956331..ca9da1fa98 100644 --- a/3rdparty/winwil/include/wil/windowing.h +++ b/3rdparty/winwil/include/wil/windowing.h @@ -24,19 +24,64 @@ namespace details { }; + template + BOOL __stdcall EnumWindowsCallbackNoThrow(HWND hwnd, LPARAM lParam) + { + auto pCallback = reinterpret_cast(lParam); +#ifdef __cpp_if_constexpr + using result_t = decltype((*pCallback)(hwnd)); + if constexpr (wistd::is_void_v) + { + (*pCallback)(hwnd); + return TRUE; + } + else if constexpr (wistd::is_same_v) + { + // NB: this works for both HRESULT and NTSTATUS as both S_OK and ERROR_SUCCESS are 0 + return (S_OK == (*pCallback)(hwnd)) ? TRUE : FALSE; + } + else if constexpr (std::is_same_v) + { + return (*pCallback)(hwnd) ? TRUE : FALSE; + } + else + { + static_assert(details::always_false::value, "Callback must return void, bool, or HRESULT"); + } +#else + return (*pCallback)(hwnd); +#endif + } + template void DoEnumWindowsNoThrow(TEnumApi&& enumApi, TCallback&& callback) noexcept { - auto enumproc = [](HWND hwnd, LPARAM lParam) -> BOOL { - auto pCallback = reinterpret_cast(lParam); + enumApi(EnumWindowsCallbackNoThrow, reinterpret_cast(&callback)); + } + +#ifdef WIL_ENABLE_EXCEPTIONS + template + struct EnumWindowsCallbackData + { + std::exception_ptr exception; + TCallback* pCallback; + }; + + template + BOOL __stdcall EnumWindowsCallback(HWND hwnd, LPARAM lParam) + { + auto pCallbackData = reinterpret_cast*>(lParam); + try + { + auto pCallback = pCallbackData->pCallback; #ifdef __cpp_if_constexpr using result_t = decltype((*pCallback)(hwnd)); - if constexpr (wistd::is_void_v) + if constexpr (std::is_void_v) { (*pCallback)(hwnd); return TRUE; } - else if constexpr (wistd::is_same_v) + else if constexpr (std::is_same_v) { // NB: this works for both HRESULT and NTSTATUS as both S_OK and ERROR_SUCCESS are 0 return (S_OK == (*pCallback)(hwnd)) ? TRUE : FALSE; @@ -52,55 +97,19 @@ namespace details #else return (*pCallback)(hwnd); #endif - }; - enumApi(enumproc, reinterpret_cast(&callback)); - } + } + catch (...) + { + pCallbackData->exception = std::current_exception(); + return FALSE; + } + }; -#ifdef WIL_ENABLE_EXCEPTIONS template void DoEnumWindows(TEnumApi&& enumApi, TCallback&& callback) { - struct - { - std::exception_ptr exception; - TCallback* pCallback; - } callbackData = {nullptr, &callback}; - auto enumproc = [](HWND hwnd, LPARAM lParam) -> BOOL { - auto pCallbackData = reinterpret_cast(lParam); - try - { - auto pCallback = pCallbackData->pCallback; -#ifdef __cpp_if_constexpr - using result_t = decltype((*pCallback)(hwnd)); - if constexpr (std::is_void_v) - { - (*pCallback)(hwnd); - return TRUE; - } - else if constexpr (std::is_same_v) - { - // NB: this works for both HRESULT and NTSTATUS as both S_OK and ERROR_SUCCESS are 0 - return (S_OK == (*pCallback)(hwnd)) ? TRUE : FALSE; - } - else if constexpr (std::is_same_v) - { - return (*pCallback)(hwnd) ? TRUE : FALSE; - } - else - { - static_assert(details::always_false::value, "Callback must return void, bool, or HRESULT"); - } -#else - return (*pCallback)(hwnd); -#endif - } - catch (...) - { - pCallbackData->exception = std::current_exception(); - return FALSE; - } - }; - enumApi(enumproc, reinterpret_cast(&callbackData)); + EnumWindowsCallbackData callbackData = {nullptr, &callback}; + enumApi(EnumWindowsCallback, reinterpret_cast(&callbackData)); if (callbackData.exception) { std::rethrow_exception(callbackData.exception); diff --git a/3rdparty/winwil/include/wil/winrt.h b/3rdparty/winwil/include/wil/winrt.h index 077983cc8e..ae5e59c488 100644 --- a/3rdparty/winwil/include/wil/winrt.h +++ b/3rdparty/winwil/include/wil/winrt.h @@ -271,7 +271,7 @@ struct TwoPhaseHStringConstructor return TwoPhaseHStringConstructor{characterLength}; } - //! Returns the HSTRING after it has been populated like Detatch() or release(); be sure to put this in a RAII type to manage + //! Returns the HSTRING after it has been populated like Detach() or release(); be sure to put this in a RAII type to manage //! its lifetime. HSTRING Promote() { @@ -1700,8 +1700,8 @@ hr = run_when_complete_nothrow(getFileOp.Get(), [](HRESULT hr, ISt ~~~ */ -//! Run a fuction when an async operation completes. Use Microsoft::WRL::FtmBase for TAgility to make the completion handler agile -//! and run on the async thread. +//! Run a function when an async operation completes. Use Microsoft::WRL::FtmBase for TAgility to make the completion handler +//! agile and run on the async thread. template HRESULT run_when_complete_nothrow(_In_ ABI::Windows::Foundation::IAsyncAction* operation, TFunc&& func) WI_NOEXCEPT { @@ -1727,8 +1727,8 @@ HRESULT run_when_complete_nothrow(_In_ ABI::Windows::Foundation::IAsyncActionWit } #ifdef WIL_ENABLE_EXCEPTIONS -//! Run a fuction when an async operation completes. Use Microsoft::WRL::FtmBase for TAgility to make the completion handler agile -//! and run on the async thread. +//! Run a function when an async operation completes. Use Microsoft::WRL::FtmBase for TAgility to make the completion handler +//! agile and run on the async thread. template void run_when_complete(_In_ ABI::Windows::Foundation::IAsyncAction* operation, TFunc&& func) { diff --git a/3rdparty/winwil/include/wil/wistd_config.h b/3rdparty/winwil/include/wil/wistd_config.h index dc2bf73f40..42dff16d5d 100644 --- a/3rdparty/winwil/include/wil/wistd_config.h +++ b/3rdparty/winwil/include/wil/wistd_config.h @@ -33,7 +33,7 @@ // and non-exception based code should utilize this functionality. // This header mimics libc++'s '__config' header to the extent necessary to get the wistd::* definitions compiling. Note -// that this has a few key differences since libc++'s MSVC compatability is currently not functional and a bit behind +// that this has a few key differences since libc++'s MSVC compatibility is currently not functional and a bit behind #ifndef _WISTD_CONFIG_H_ #define _WISTD_CONFIG_H_ @@ -130,7 +130,7 @@ #define __WI_CLANG_DISABLE_WARNING(warning) #endif -// NOTE: MSVC, which is what we primarily target, is severly underrepresented in libc++ and checks such as +// NOTE: MSVC, which is what we primarily target, is severely underrepresented in libc++ and checks such as // __has_feature(...) are always false for MSVC, even when the feature being tested _is_ present in MSVC. Therefore, we // instead modify all checks to be __WI_HAS_FEATURE_IS_UNION, etc., which provides the correct value for MSVC and falls // back to the __has_feature(...), etc. value otherwise. We intentionally leave '__has_feature', etc. undefined for MSVC diff --git a/3rdparty/winwil/include/wil/wistd_type_traits.h b/3rdparty/winwil/include/wil/wistd_type_traits.h index 2656aba20e..40cba991ca 100644 --- a/3rdparty/winwil/include/wil/wistd_type_traits.h +++ b/3rdparty/winwil/include/wil/wistd_type_traits.h @@ -1946,7 +1946,7 @@ struct __numeric_type // __promote -template ::value&& __numeric_type<_A2>::value&& __numeric_type<_A3>::value> +template ::value && __numeric_type<_A2>::value && __numeric_type<_A3>::value> class __promote_imp { public: @@ -4775,7 +4775,7 @@ struct underlying_type { static_assert( _Support, - "The underyling_type trait requires compiler " + "The underlying_type trait requires compiler " "support. Either no such support exists or " "libc++ does not know how to use it."); };