Display error message in case of Loading Package Failed (#279)

* Call api with signature skip

* Moved call to installUI

* Check with error codes

* Propagate errors to UI

* comment

* More changes to errors

* Update more strings

* Move call for checkbox and install button

* TDF wrong error message

* Updated handler error messages and localized

* Localize strings returned by handler separate lib and exe

* Remove extra string added for remove package

* Install cancel

* Space
This commit is contained in:
jyvenugo 2019-12-10 16:53:29 -08:00 коммит произвёл GitHub
Родитель f0483f413b
Коммит 00c63da103
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
18 изменённых файлов: 176 добавлений и 59 удалений

Просмотреть файл

@ -17,6 +17,7 @@ HRESULT AddRemovePrograms::ExecuteForAddRequest()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}

Просмотреть файл

@ -63,6 +63,7 @@ HRESULT Extractor::ExtractFootprintFiles()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}
@ -109,6 +110,7 @@ HRESULT Extractor::ExtractPayloadFiles()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}
ComPtr<IAppxFile> file;

Просмотреть файл

@ -162,6 +162,7 @@ HRESULT FileTypeAssociation::ProcessFtaForAdd(Fta& fta)
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}

Просмотреть файл

@ -17,6 +17,8 @@
#include "Util.hpp"
#include "msixmgrLogger.hpp"
#include "MsixErrors.hpp"
// MSIXWindows.hpp defines NOMINMAX and undefines min and max because we want to use std::min/std::max from <algorithm>
// GdiPlus.h requires a definiton for min and max. We can't use namespace std because c++17 defines std::byte, which conflicts with ::byte
#define max std::max
@ -26,7 +28,6 @@
using namespace std;
using namespace MsixCoreLib;
static const int g_width = 500; // width of window
static const int g_height = 400; // height of window
@ -52,11 +53,24 @@ HRESULT UI::DrawPackageInfo(HWND hWnd, RECT windowRect)
}
else
{
std::wstringstream wstringstream;
wstringstream << L"Failed getting package information with: 0x" << std::hex << m_loadingPackageInfoCode;
auto g_messageText = wstringstream.str();
ChangeText(hWnd, GetStringResource(IDS_STRING_LOADING_PACKAGE_ERROR), g_messageText);
ShowWindow(g_checkboxHWnd, SW_HIDE); //Hide launch checkbox
ShowWindow(g_buttonHWnd, SW_HIDE); //Hide install button
if (m_packageInfo != nullptr) //Valid package, display package information
{
auto displayText = m_displayName + L" " + GetStringResource(IDS_STRING_LOADING_PACKAGE_ERROR);
auto messageText = GetStringResource(IDS_STRING_PUBLISHER) + m_publisherCommonName + L"\n" + GetStringResource(IDS_STRING_VERSION) + m_version;
ChangeText(hWnd, displayText, messageText, m_logoStream.get());
}
else // Invalid package, no package information
{
auto displayText = GetStringResource(IDS_STRING_LOADING_PACKAGE_OPEN_ERROR);
ChangeText(hWnd, displayText, L"");;
}
DisplayError(m_loadingPackageInfoCode);
}
return S_OK;
}
@ -319,7 +333,39 @@ HRESULT UI::ParseInfoFromPackage()
{
case InstallUIAdd:
{
RETURN_IF_FAILED(m_packageManager->GetMsixPackageInfo(m_path, m_packageInfo));
HRESULT hrGetMsixPackageInfo = m_packageManager->GetMsixPackageInfo(m_path, m_packageInfo, MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_FULL);
if (hrGetMsixPackageInfo == static_cast<HRESULT>(MSIX::Error::MissingAppxSignatureP7X))
{
TraceLoggingWrite(g_MsixUITraceLoggingProvider,
"Error - Signature missing from package, calling api again with signature skip validation parameter",
TraceLoggingLevel(WINEVENT_LEVEL_WARNING),
TraceLoggingValue(hrGetMsixPackageInfo, "HR"));
RETURN_IF_FAILED(m_packageManager->GetMsixPackageInfo(m_path, m_packageInfo, MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPSIGNATURE));
m_displayErrorString = GetStringResource(IDS_STRING_SIG_MISSING_ERROR);
return static_cast<HRESULT>(MSIX::Error::MissingAppxSignatureP7X);
}
else if (hrGetMsixPackageInfo == static_cast<HRESULT>(MSIX::Error::CertNotTrusted))
{
TraceLoggingWrite(g_MsixUITraceLoggingProvider,
"Error - Certificate is not trusted, calling api again with signature skip validation parameter",
TraceLoggingLevel(WINEVENT_LEVEL_WARNING),
TraceLoggingValue(hrGetMsixPackageInfo, "HR"));
RETURN_IF_FAILED(m_packageManager->GetMsixPackageInfo(m_path, m_packageInfo, MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPSIGNATURE));
m_displayErrorString = GetStringResource(IDS_STRING_ROOT_SIG_UNTRUSTED_ERROR);
return static_cast<HRESULT>(MSIX::Error::CertNotTrusted);
}
else
{
TraceLoggingWrite(g_MsixUITraceLoggingProvider,
"Error - Unable to open package.",
TraceLoggingLevel(WINEVENT_LEVEL_WARNING),
TraceLoggingValue(hrGetMsixPackageInfo, "HR"));
m_displayErrorString = GetStringResource(IDS_STRING_CANNOT_OPEN_PACKAGE_ERROR);
RETURN_IF_FAILED(hrGetMsixPackageInfo);
}
}
break;
case InstallUIRemove:
@ -332,23 +378,30 @@ HRESULT UI::ParseInfoFromPackage()
}
}
// Obtain publisher name
m_publisherCommonName = m_packageInfo->GetPublisherDisplayName();
// Obtain version number
m_version = m_packageInfo->GetVersion();
//Obtain the number of files
m_displayName = m_packageInfo->GetDisplayName();
m_logoStream = std::move(m_packageInfo->GetLogo());
//Obtain package capabilities
m_capabilities = m_packageInfo->GetCapabilities();
m_loadedPackageInfo = true;
return S_OK;
}
void UI::SetDisplayInfo()
{
if (m_packageInfo != nullptr)
{
// Obtain publisher name
m_publisherCommonName = m_packageInfo->GetPublisherDisplayName();
// Obtain version number
m_version = m_packageInfo->GetVersion();
//Obtain the number of files
m_displayName = m_packageInfo->GetDisplayName();
m_logoStream = std::move(m_packageInfo->GetLogo());
//Obtain package capabilities
m_capabilities = m_packageInfo->GetCapabilities();
m_loadedPackageInfo = true;
}
}
HRESULT UI::ShowUI()
{
// Free the console that we started with
@ -365,6 +418,7 @@ HRESULT UI::ShowUI()
void UI::PreprocessRequest()
{
m_loadingPackageInfoCode = ParseInfoFromPackage();
SetDisplayInfo();
if (FAILED(m_loadingPackageInfoCode))
{
return;
@ -587,18 +641,22 @@ BOOL UI::ChangeText(HWND parentHWnd, std::wstring displayName, std::wstring mess
graphics.DrawString(displayName.c_str(), -1, &displayNameFont, layoutRect, &format, &textBrush);
layoutRect.Y += 40;
graphics.DrawString(messageText.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
std::wstring capabilitiesHeading = GetStringResource(IDS_STRING_CAPABILITIES);
layoutRect.Y += 40;
graphics.DrawString(capabilitiesHeading.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
layoutRect.Y += 17;
if (m_capabilities.size() > 0)
if (!messageText.empty())
{
std::wstring capabilityString = L"\x2022 " + GetStringResource(IDS_RUNFULLTRUST_CAPABILITY);
graphics.DrawString(capabilityString.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
layoutRect.Y += 20;
graphics.DrawString(messageText.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
std::wstring capabilitiesHeading = GetStringResource(IDS_STRING_CAPABILITIES);
layoutRect.Y += 40;
graphics.DrawString(capabilitiesHeading.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
layoutRect.Y += 17;
if (m_capabilities.size() > 0)
{
std::wstring capabilityString = L"\x2022 " + GetStringResource(IDS_RUNFULLTRUST_CAPABILITY);
graphics.DrawString(capabilityString.c_str(), -1, &messageFont, layoutRect, &format, &textBrush);
layoutRect.Y += 20;
}
}
if (logoStream != nullptr)
@ -709,6 +767,34 @@ void UI::ButtonClicked()
break;
case InstallationStep::InstallationStepError:
{
g_installing = false;
ShowWindow(g_percentageTextHWnd, SW_HIDE);
ShowWindow(g_staticPercentText, SW_HIDE);
ShowWindow(g_progressHWnd, SW_HIDE);
ShowWindow(g_checkboxHWnd, SW_HIDE);
ShowWindow(g_CancelbuttonHWnd, SW_HIDE);
if(sender.GetHResultTextCode() == HRESULT_FROM_WIN32(ERROR_INSTALL_PREREQUISITE_FAILED))
{
m_displayErrorString = GetStringResource(IDS_STRING_INVALID_TDF_ERROR);
}
else if (sender.GetHResultTextCode() == HRESULT_FROM_WIN32(ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE))
{
m_displayErrorString = GetStringResource(IDS_STRING_INVALID_ARCHITECTURE_ERROR);
}
else if (sender.GetHResultTextCode() == HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_DOWNGRADE))
{
m_displayErrorString = GetStringResource(IDS_STRING_PACKAGE_DOWNGRADE_ERROR);
}
else if (sender.GetHResultTextCode() == HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT))
{
m_displayErrorString = GetStringResource(IDS_STRING_USER_CANCELLED_INSTALL_ERROR);
}
else
{
m_displayErrorString = GetStringResource(IDS_STRING_GENERIC_INSTALL_FAILED_ERROR);
}
DisplayError(sender.GetHResultTextCode());
}
break;
@ -734,19 +820,12 @@ void UI::UpdateDisplayPercent(float displayPercent)
}
void UI::DisplayError(HRESULT hr)
{
g_installing = false;
ShowWindow(g_percentageTextHWnd, SW_HIDE);
ShowWindow(g_staticPercentText, SW_HIDE);
ShowWindow(g_progressHWnd, SW_HIDE);
ShowWindow(g_checkboxHWnd, SW_HIDE);
ShowWindow(g_CancelbuttonHWnd, SW_HIDE);
{
//Show Error Window
ShowWindow(g_staticErrorTextHWnd, SW_SHOW);
ShowWindow(g_staticErrorDescHWnd, SW_SHOW);
std::wstringstream errorDescription;
errorDescription << GetStringResource(IDS_STRING_ERROR_MSG) << std::hex << hr << ".";
errorDescription << std::hex << L"0x" << hr << L" - " << m_displayErrorString;
SetWindowText(g_staticErrorDescHWnd, errorDescription.str().c_str());
}

Просмотреть файл

@ -70,6 +70,7 @@ private:
std::unique_ptr<IStream> m_logoStream;
std::wstring m_version = L"";
std::vector<std::wstring> m_capabilities;
std::wstring m_displayErrorString = L"";
bool m_loadedPackageInfo = false;
HRESULT m_loadingPackageInfoCode = 0;
@ -190,5 +191,7 @@ public:
HRESULT ShowUI();
void SetDisplayInfo();
void CloseUI();
};

Просмотреть файл

@ -176,7 +176,8 @@ HRESULT MsixRequest::ProcessAddRequest()
}
if (FAILED(hr) && currentHandler.errorMode != IgnoreAndProcessNextHandler)
{
m_msixResponse->SetErrorStatus(hr, L"Failed to process add request");
m_msixResponse->SetErrorStatus(hr, L"Unable to install package. Please go to aka.ms/msix for more information.");
if (currentHandler.errorMode == ReturnError)
{
return hr;

Просмотреть файл

@ -24,13 +24,17 @@ void MsixResponse::SetCallback(std::function<void(const IMsixResponse& sender)>
void MsixResponse::SetErrorStatus(HRESULT errorCode, std::wstring errorText)
{
m_percentage = 0;
m_status = InstallationStep::InstallationStepError;
m_hresultTextCode = errorCode;
m_textStatus = errorText;
if (m_callback)
// Set response object with generic response if not explicitly caught and set by handlers already
if (SUCCEEDED(GetHResultTextCode()))
{
m_callback(*this);
m_percentage = 0;
m_status = InstallationStep::InstallationStepError;
m_hresultTextCode = errorCode;
m_textStatus = errorText;
if (m_callback)
{
m_callback(*this);
}
}
}

Просмотреть файл

@ -14,6 +14,7 @@ HRESULT PSFScriptExecuter::ExecuteForAddRequest()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}

Просмотреть файл

@ -42,6 +42,8 @@ HRESULT ProcessPotentialUpdate::ExecuteForAddRequest()
"Incoming version is not an update, but the same family name as an already installed package.",
TraceLoggingValue(p.path().filename().c_str(), "PackageCurrentlyInstalled"),
TraceLoggingValue(m_msixRequest->GetPackageFullName(), "PackageToBeInstalled"));
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_DOWNGRADE), L"The package could not be installed because a higher version of this package is already installed.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_DOWNGRADE);
}
}

Просмотреть файл

@ -86,6 +86,7 @@ HRESULT Protocol::ParseManifest()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}

Просмотреть файл

@ -57,6 +57,7 @@ HRESULT StartMenuLink::ExecuteForAddRequest()
{
if (m_msixRequest->GetMsixResponse()->GetIsInstallCancelled())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT), L"User cancelled installation.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT);
}
auto packageInfo = m_msixRequest->GetPackageInfo();

Просмотреть файл

@ -19,6 +19,7 @@ HRESULT ValidateArchitecture::ExecuteForAddRequest()
{
if (!IsArchitectureCompatibleWithOS())
{
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE), L"The deployment operation failed because the package targets the wrong processor architecture.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE);
}

Просмотреть файл

@ -44,7 +44,9 @@ HRESULT ValidateTargetDeviceFamily::ParseAndValidateTargetDeviceFamilyFromPackag
TraceLoggingWrite(g_MsixTraceLoggingProvider,
"No Target device family Found",
TraceLoggingLevel(WINEVENT_LEVEL_ERROR));
return HRESULT_FROM_WIN32(ERROR_INSTALL_REJECTED);
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_PREREQUISITE_FAILED), L"A Prerequisite for an install could not be satisfied.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_PREREQUISITE_FAILED);
}
while (hc)
@ -100,7 +102,9 @@ HRESULT ValidateTargetDeviceFamily::ParseAndValidateTargetDeviceFamilyFromPackag
TraceLoggingWrite(g_MsixTraceLoggingProvider,
"Target device family name or manifest min version are not compatible with the OS",
TraceLoggingLevel(WINEVENT_LEVEL_ERROR));
return HRESULT_FROM_WIN32(ERROR_INSTALL_REJECTED);
m_msixRequest->GetMsixResponse()->SetErrorStatus(HRESULT_FROM_WIN32(ERROR_INSTALL_PREREQUISITE_FAILED), L"A Prerequisite for an install could not be satisfied.");
return HRESULT_FROM_WIN32(ERROR_INSTALL_PREREQUISITE_FAILED);
}
bool ValidateTargetDeviceFamily::IsTargetDeviceFamilyNameCompatibleWithOS()

Просмотреть файл

@ -95,7 +95,6 @@ BEGIN
"Clicking on Yes will uninstall the app. Are you sure you want to cancel the install?"
IDS_STRING_REINSTALLAPP "Reinstall"
IDS_RUNFULLTRUST_CAPABILITY "Uses all system resources"
IDS_STRING_ERROR_MSG "App installation failed with error message: An internal error occurred with error 0x"
IDS_STRING_HELPTEXT_DESCRIPTION " Description:\n -----------\n \tInstalls an msix package, removes an msix package or queries for msix packages.\n \tMay also unpack msix packages and apply ACLs to the resulting package folders\n\n"
IDS_STRING_HELPTEXT_OPTIONS " Options:\n -------\n"
IDS_STRING_HELP_OPTION_UNPACK "Unpack a package (.appx, .msix, .appxbundle, .msixbundle) and extract its contents to a folder."
@ -105,7 +104,7 @@ BEGIN
IDS_STRING_HELP_OPTION_UNPACK_VALIDATESIGNATURE "optional parameter that validates a package's signature file before unpacking the package. This will require that the package's certificate is installed on the machine."
IDS_STRING_HELP_OPTION_APPLYACLS "Applies ACLs to a package folder (an unpacked package)"
IDS_STRING_HELP_OPTION_APPLYACLS_PACKAGEPATH "the path to the folder to apply acls to"
IDS_STRING_LOADING_PACKAGE_ERROR "Loading Package Failed"
IDS_STRING_LOADING_PACKAGE_ERROR "installation failed"
IDS_STRING_WXS_ERROR_PART1 "Warning - removing this will cause the following app(s) to be unremovable: "
IDS_STRING_WXS_ERROR_PART2 "These app(s) should be removed before proceeding."
IDS_STRING_LAUNCH_CHECKBOX "Launch when ready"
@ -114,9 +113,18 @@ BEGIN
IDS_STRING_VERSION "Version: "
IDS_STRING_CAPABILITIES "Capabilities:"
IDS_STRING_INSTALLING_APP "Installing app package"
IDS_STRING_ERROR_REASON_TEXT "Reason:"
IDS_STRING_ERROR_REASON_TEXT "Reason:"
IDS_STRING_LOADING_PACKAGE "Loading Package..."
IDS_STRING_LOADING_PACKAGE_OPEN_ERROR "Cannot open app package"
IDS_STRING_SIG_MISSING_ERROR "Ask the app developer for a new app package. This one isn't signed with a trusted certificate"
IDS_STRING_ROOT_SIG_UNTRUSTED_ERROR "Either you need a new certificate installed for this app package, or you need a new app package with trusted certificates. Your system administrator or the app developer can help. A certificate chain processed, but terminated in a root certificate which isn't trusted"
IDS_STRING_CANNOT_OPEN_PACKAGE_ERROR "Unable to open package. Please go to aka.ms/msix for more information."
IDS_STRING_GENERIC_INSTALL_FAILED_ERROR "Unable to install package. Please go to aka.ms/msix for more information."
IDS_STRING_INVALID_TDF_ERROR "A Prerequisite for an install could not be satisfied."
IDS_STRING_INVALID_ARCHITECTURE_ERROR "The deployment operation failed because the package targets the wrong processor architecture."
IDS_STRING_PACKAGE_DOWNGRADE_ERROR "The package could not be installed because a higher version of this package is already installed."
IDS_STRING_USER_CANCELLED_INSTALL_ERROR "User cancelled installation."
END
#endif // English (United States) resources

Просмотреть файл

@ -27,7 +27,6 @@
#define IDS_STRING_CANCEL_UPDATEPOPUP 121
#define IDS_STRING_REINSTALLAPP 122
#define IDS_RUNFULLTRUST_CAPABILITY 123
#define IDS_STRING_ERROR_MSG 124
#define IDS_STRING_HELPTEXT_DESCRIPTION 125
#define IDS_STRING_HELPTEXT_OPTIONS 126
#define IDS_STRING_HELP_OPTION_UNPACK 127
@ -48,6 +47,15 @@
#define IDS_STRING_INSTALLING_APP 142
#define IDS_STRING_ERROR_REASON_TEXT 143
#define IDS_STRING_LOADING_PACKAGE 144
#define IDS_STRING_LOADING_PACKAGE_OPEN_ERROR 145
#define IDS_STRING_SIG_MISSING_ERROR 146
#define IDS_STRING_ROOT_SIG_UNTRUSTED_ERROR 147
#define IDS_STRING_CANNOT_OPEN_PACKAGE_ERROR 148
#define IDS_STRING_GENERIC_INSTALL_FAILED_ERROR 149
#define IDS_STRING_INVALID_TDF_ERROR 150
#define IDS_STRING_INVALID_ARCHITECTURE_ERROR 151
#define IDS_STRING_PACKAGE_DOWNGRADE_ERROR 152
#define IDS_STRING_USER_CANCELLED_INSTALL_ERROR 153
// Next default values for new objects
//

Просмотреть файл

@ -267,7 +267,7 @@ HRESULT PackageManager::FindPackages(const std::wstring & searchParameter, uniqu
return S_OK;
}
HRESULT PackageManager::GetMsixPackageInfo(const wstring & msixFullPath, shared_ptr<IPackage> & package)
HRESULT PackageManager::GetMsixPackageInfo(const wstring & msixFullPath, shared_ptr<IPackage> & package, MSIX_VALIDATION_OPTION validationOption)
{
auto filemapping = FilePathMappings::GetInstance();
RETURN_IF_FAILED(filemapping.GetInitializationResult());
@ -275,7 +275,7 @@ HRESULT PackageManager::GetMsixPackageInfo(const wstring & msixFullPath, shared_
shared_ptr<Package> packageInfo;
ComPtr<IStream> packageStream;
RETURN_IF_FAILED(CreateStreamOnPackageUrl(msixFullPath.c_str(), &packageStream));
RETURN_IF_FAILED(PopulatePackageInfo::GetPackageInfoFromPackage(packageStream.Get(), MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_FULL, &packageInfo));
RETURN_IF_FAILED(PopulatePackageInfo::GetPackageInfoFromPackage(packageStream.Get(), validationOption, &packageInfo));
package = dynamic_pointer_cast<IPackage>(packageInfo);
return S_OK;

Просмотреть файл

@ -1,6 +1,5 @@
#pragma once
#include "inc/IPackageManager.hpp"
#include "inc/IPackage.hpp"
namespace MsixCoreLib {
@ -18,7 +17,7 @@ namespace MsixCoreLib {
HRESULT FindPackage(const std::wstring & packageFullName, std::shared_ptr<IInstalledPackage> & installedPackage) override;
HRESULT FindPackageByFamilyName(const std::wstring & packageFamilyName, std::shared_ptr<IInstalledPackage> & installedPackage) override;
HRESULT FindPackages(const std::wstring & searchParameter, std::unique_ptr<std::vector<std::shared_ptr<IInstalledPackage>>> & installedPackages) override;
HRESULT GetMsixPackageInfo(const std::wstring & msixFullPath, std::shared_ptr<IPackage> & package) override;
HRESULT GetMsixPackageInfo(const std::wstring & msixFullPath, std::shared_ptr<IPackage> & package, MSIX_VALIDATION_OPTION validationOption) override;
private:
HRESULT GetPackageInfo(const std::wstring & directoryPath, std::shared_ptr<IInstalledPackage> & installedPackage);
HRESULT CreateStreamOnPackageUrl(const std::wstring & package, IStream** stream);

Просмотреть файл

@ -5,6 +5,7 @@
#include "IMsixResponse.hpp"
#include "IPackage.hpp"
#include "DeploymentOptions.hpp"
#include "AppxPackaging.hpp"
namespace MsixCoreLib {
class IPackageManager
@ -19,6 +20,6 @@ namespace MsixCoreLib {
virtual HRESULT FindPackage(const std::wstring & packageFullName, std::shared_ptr<IInstalledPackage> &package) = 0;
virtual HRESULT FindPackageByFamilyName(const std::wstring & packageFamilyName, std::shared_ptr<IInstalledPackage> & installedPackage) = 0;
virtual HRESULT FindPackages(const std::wstring & searchParameter, std::unique_ptr<std::vector<std::shared_ptr<IInstalledPackage>>> & installedPackages) = 0;
virtual HRESULT GetMsixPackageInfo(const std::wstring & msixFullPath, std::shared_ptr<IPackage> & package) = 0;
virtual HRESULT GetMsixPackageInfo(const std::wstring & msixFullPath, std::shared_ptr<IPackage> & package, MSIX_VALIDATION_OPTION validationOption) = 0;
};
}