Skip to content

Commit

Permalink
Fix Prefast C6101 on Foundation Solution (#4378)
Browse files Browse the repository at this point in the history
  • Loading branch information
kythant committed Apr 30, 2024
1 parent ed41fda commit 8d366d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dev/Deployment/DeploymentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
}
else
{
if ((::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::Feature_DeploymentRepair::IsEnabled()) &&
if ((::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::Feature_DeploymentRepair::IsEnabled()) &&
(isRepair))
{
status = DeploymentStatus::PackageRepairFailed;
Expand Down Expand Up @@ -328,6 +328,7 @@ namespace winrt::Microsoft::Windows::ApplicationModel::WindowsAppRuntime::implem
HRESULT DeploymentManager::VerifyPackage(const std::wstring& packageFamilyName, const PACKAGE_VERSION targetVersion,
__out std::wstring& packageIdentifier) try
{
packageIdentifier = L"";
auto packageFullNames{ FindPackagesByFamily(packageFamilyName) };
bool match{};
for (const auto& packageFullName : packageFullNames)
Expand Down
18 changes: 18 additions & 0 deletions dev/UndockedRegFreeWinRT/typeresolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ namespace UndockedRegFreeWinRT
_COM_Outptr_opt_result_maybenull_ IMetaDataImport2** ppMetaDataImport,
_Out_opt_ mdTypeDef* pmdTypeDef)
{
if (ppMetaDataImport != nullptr)
{
*ppMetaDataImport = nullptr;
}
if (pmdTypeDef != nullptr)
{
*pmdTypeDef = 0;
}
HRESULT hr = S_OK;
Microsoft::WRL::ComPtr<IMetaDataImport2> spMetaDataImport;
MetaDataImportersLRUCache* pMetaDataImporterCache = MetaDataImportersLRUCache::GetMetaDataImportersLRUCacheInstance();
Expand Down Expand Up @@ -213,7 +221,17 @@ namespace UndockedRegFreeWinRT
_COM_Outptr_opt_result_maybenull_ IMetaDataImport2** ppMetaDataImport,
_Out_opt_ mdTypeDef* pmdTypeDef)
{
if (ppMetaDataImport != nullptr)
{
*ppMetaDataImport = nullptr;
}
if (pmdTypeDef != nullptr)
{
*pmdTypeDef = 0;
}

wchar_t szCandidateFileName[MAX_PATH + 1]{};
RETURN_IF_FAILED(WindowsCreateString(L"", 0, phstrMetaDataFilePath));
HRESULT hr{ StringCchCopy(szCandidateFileName, ARRAYSIZE(szCandidateFileName), pszFullName) };
if (SUCCEEDED(hr))
{
Expand Down

0 comments on commit 8d366d9

Please sign in to comment.