Enable Audit Mode for WinRTUtils (#3923)
## Summary of the Pull Request Turns on Audit for WinRTUtils, fixes audit failures. ## PR Checklist * [x] I work here * [x] Still builds * [x] Am core contributor. ## Validation Steps Performed Built it.
This commit is contained in:
parent
c227066a82
commit
9cae3c439e
|
@ -1229,7 +1229,8 @@ Global
|
|||
{48D21369-3D7B-4431-9967-24E81292CF63}.Release|x86.Build.0 = Release|Win32
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|Any CPU.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|ARM64.ActiveCfg = Release|ARM64
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.ActiveCfg = Release|x64
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.ActiveCfg = AuditMode|x64
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x64.Build.0 = AuditMode|x64
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.AuditMode|x86.ActiveCfg = Release|Win32
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
|
|
|
@ -76,7 +76,8 @@ static void EnsureAllResourcesArePresent(const ScopedResourceLoader& loader)
|
|||
|
||||
#endif
|
||||
|
||||
static ScopedResourceLoader GetLibraryResourceLoader() UTILS_NONDEBUG_NOEXCEPT
|
||||
static ScopedResourceLoader GetLibraryResourceLoader()
|
||||
try
|
||||
{
|
||||
ScopedResourceLoader loader{ g_WinRTUtilsLibraryResourceScope };
|
||||
#ifdef _DEBUG
|
||||
|
@ -84,9 +85,12 @@ static ScopedResourceLoader GetLibraryResourceLoader() UTILS_NONDEBUG_NOEXCEPT
|
|||
#endif
|
||||
return loader;
|
||||
}
|
||||
CATCH_FAIL_FAST()
|
||||
|
||||
winrt::hstring GetLibraryResourceString(const std::wstring_view key) UTILS_NONDEBUG_NOEXCEPT
|
||||
winrt::hstring GetLibraryResourceString(const std::wstring_view key)
|
||||
try
|
||||
{
|
||||
static auto loader{ GetLibraryResourceLoader() };
|
||||
return loader.GetLocalizedString(key);
|
||||
}
|
||||
CATCH_FAIL_FAST()
|
||||
|
|
|
@ -17,7 +17,7 @@ ScopedResourceLoader::ScopedResourceLoader(const std::wstring_view resourceLocat
|
|||
// - Gets the resource map associated with the scoped resource subcompartment.
|
||||
// Return Value:
|
||||
// - the resource map associated with the scoped resource subcompartment.
|
||||
ResourceMap ScopedResourceLoader::GetResourceMap() const
|
||||
ResourceMap ScopedResourceLoader::GetResourceMap() const noexcept
|
||||
{
|
||||
return _resourceMap;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class ScopedResourceLoader
|
|||
{
|
||||
public:
|
||||
ScopedResourceLoader(const std::wstring_view resourceLocatorBase);
|
||||
winrt::Windows::ApplicationModel::Resources::Core::ResourceMap GetResourceMap() const;
|
||||
winrt::Windows::ApplicationModel::Resources::Core::ResourceMap GetResourceMap() const noexcept;
|
||||
winrt::hstring GetLocalizedString(const std::wstring_view resourceName) const;
|
||||
bool HasResourceWithName(const std::wstring_view resourceName) const;
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ namespace Microsoft::Console::Utils
|
|||
return pRes->resourceKey; \
|
||||
}())
|
||||
#define RS_(x) GetLibraryResourceString(USES_RESOURCE(x))
|
||||
#define UTILS_NONDEBUG_NOEXCEPT
|
||||
|
||||
#else // _DEBUG
|
||||
|
||||
|
@ -57,11 +56,10 @@ namespace Microsoft::Console::Utils
|
|||
|
||||
#define USES_RESOURCE(x) (x)
|
||||
#define RS_(x) GetLibraryResourceString((x))
|
||||
#define UTILS_NONDEBUG_NOEXCEPT noexcept
|
||||
|
||||
#endif
|
||||
|
||||
#define UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(x) \
|
||||
__declspec(selectany) extern const wchar_t* g_WinRTUtilsLibraryResourceScope{ (x) };
|
||||
|
||||
winrt::hstring GetLibraryResourceString(const std::wstring_view key) UTILS_NONDEBUG_NOEXCEPT;
|
||||
winrt::hstring GetLibraryResourceString(const std::wstring_view key);
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
<CodeAnalysisRuleSet>$(SolutionDir)\src\StaticAnalysis.ruleset</CodeAnalysisRuleSet>
|
||||
<EnableCppCoreCheck>true</EnableCppCoreCheck>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<CAExcludePath>$(SolutionDir)\dep</CAExcludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='AuditMode'">
|
||||
<ClCompile>
|
||||
|
|
Loading…
Reference in a new issue