Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Expected Return Code for InvalidParameter #2635

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@
"missingDependency",
"diskFull",
"insufficientMemory",
"invalidParameter",
"noNetwork",
"contactSupport",
"rebootRequiredToFinish",
Expand All @@ -237,6 +238,7 @@
"alreadyInstalled",
"downgrade",
"blockedByPolicy",
"systemNotSupported",
"custom"
]
},
Expand Down
2 changes: 2 additions & 0 deletions schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
"missingDependency",
"diskFull",
"insufficientMemory",
"invalidParameter",
"noNetwork",
"contactSupport",
"rebootRequiredToFinish",
Expand All @@ -279,6 +280,7 @@
"alreadyInstalled",
"downgrade",
"blockedByPolicy",
"systemNotSupported",
"custom"
]
},
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,15 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeFileInUse);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeInstallInProgress);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeInsufficientMemory);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeInvalidParameter);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeMissingDependency);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeNoNetwork);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodePackageInUse);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodePackageInUseByApplication);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeRebootInitiated);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeRebootRequiredForInstall);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeRebootRequiredToFinish);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowReturnCodeSystemNotSupported);
WINGET_DEFINE_RESOURCE_STRINGID(InstallFlowStartingPackageInstall);
WINGET_DEFINE_RESOURCE_STRINGID(InstallLocationNotProvided);
WINGET_DEFINE_RESOURCE_STRINGID(InstallScopeDescription);
Expand Down
4 changes: 4 additions & 0 deletions src/AppInstallerCLICore/Workflows/InstallFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ namespace AppInstaller::CLI::Workflow
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_DISK_FULL, Resource::String::InstallFlowReturnCodeDiskFull);
case ExpectedReturnCodeEnum::InsufficientMemory:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_INSUFFICIENT_MEMORY, Resource::String::InstallFlowReturnCodeInsufficientMemory);
case ExpectedReturnCodeEnum::InvalidParameter:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_INVALID_PARAMETER, Resource::String::InstallFlowReturnCodeInvalidParameter);
case ExpectedReturnCodeEnum::NoNetwork:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_NO_NETWORK, Resource::String::InstallFlowReturnCodeNoNetwork);
case ExpectedReturnCodeEnum::ContactSupport:
Expand All @@ -146,6 +148,8 @@ namespace AppInstaller::CLI::Workflow
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_DOWNGRADE, Resource::String::InstallFlowReturnCodeDowngrade);
case ExpectedReturnCodeEnum::BlockedByPolicy:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_BLOCKED_BY_POLICY, Resource::String::InstallFlowReturnCodeBlockedByPolicy);
case ExpectedReturnCodeEnum::SystemNotSupported:
return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_SYSTEM_NOT_SUPPORTED, Resource::String::InstallFlowReturnCodeSystemNotSupported);
default:
THROW_HR(E_UNEXPECTED);
}
Expand Down
6 changes: 6 additions & 0 deletions src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,9 @@ Do you agree to the terms?</value>
<data name="InstallFlowReturnCodeInsufficientMemory" xml:space="preserve">
<value>There's not enough memory available to install. Close other applications then try again.</value>
</data>
<data name="InstallFlowReturnCodeInvalidParameter" xml:space="preserve">
<value>One of the installation parameters is invalid. The package installation log may have additional details.</value>
</data>
<data name="InstallFlowReturnCodeNoNetwork" xml:space="preserve">
<value>This application requires internet connectivity. Connect to a network then try again.</value>
</data>
Expand Down Expand Up @@ -1224,6 +1227,9 @@ Do you agree to the terms?</value>
<data name="InstallFlowReturnCodeBlockedByPolicy" xml:space="preserve">
<value>Organization policies are preventing installation. Contact your admin.</value>
</data>
<data name="InstallFlowReturnCodeSystemNotSupported" xml:space="preserve">
<value>The current system configuration does not support the installation of this package.</value>
</data>
<data name="InstallAbandoned" xml:space="preserve">
<value>Installation abandoned</value>
</data>
Expand Down
30 changes: 28 additions & 2 deletions src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ namespace AppInstaller::Manifest
{
result = ExpectedReturnCodeEnum::PackageInUse;
}
if (inStrLower == "packageinusebyapplication")
else if (inStrLower == "packageinusebyapplication")
{
result = ExpectedReturnCodeEnum::PackageInUseByApplication;
}
Expand All @@ -335,6 +335,10 @@ namespace AppInstaller::Manifest
{
result = ExpectedReturnCodeEnum::InsufficientMemory;
}
else if (inStrLower == "invalidparameter")
{
result = ExpectedReturnCodeEnum::InvalidParameter;
}
else if (inStrLower == "nonetwork")
{
result = ExpectedReturnCodeEnum::NoNetwork;
Expand Down Expand Up @@ -371,6 +375,10 @@ namespace AppInstaller::Manifest
{
result = ExpectedReturnCodeEnum::BlockedByPolicy;
}
else if (inStrLower == "systemnotsupported")
{
result = ExpectedReturnCodeEnum::SystemNotSupported;
}
else if (inStrLower == "custom")
{
result = ExpectedReturnCodeEnum::Custom;
Expand Down Expand Up @@ -593,7 +601,18 @@ namespace AppInstaller::Manifest
{ ERROR_SUCCESS_REBOOT_INITIATED, ExpectedReturnCodeEnum::RebootInitiated },
{ ERROR_INSTALL_USEREXIT, ExpectedReturnCodeEnum::CancelledByUser },
{ ERROR_PRODUCT_VERSION, ExpectedReturnCodeEnum::AlreadyInstalled },
{ ERROR_INSTALL_REJECTED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_INSTALL_REJECTED, ExpectedReturnCodeEnum::SystemNotSupported },
{ ERROR_INSTALL_PACKAGE_REJECTED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_INSTALL_TRANSFORM_REJECTED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_PATCH_PACKAGE_REJECTED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_PATCH_REMOVAL_DISALLOWED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_INSTALL_REMOTE_DISALLOWED, ExpectedReturnCodeEnum::BlockedByPolicy },
{ ERROR_INVALID_PARAMETER, ExpectedReturnCodeEnum::InvalidParameter },
{ ERROR_INVALID_TABLE, ExpectedReturnCodeEnum::InvalidParameter },
{ ERROR_INVALID_COMMAND_LINE, ExpectedReturnCodeEnum::InvalidParameter },
{ ERROR_INVALID_PATCH_XML, ExpectedReturnCodeEnum::InvalidParameter },
{ ERROR_INSTALL_LANGUAGE_UNSUPPORTED, ExpectedReturnCodeEnum::SystemNotSupported },
{ ERROR_INSTALL_PLATFORM_UNSUPPORTED, ExpectedReturnCodeEnum::SystemNotSupported },
};
case InstallerTypeEnum::Inno:
// See https://jrsoftware.org/ishelp/index.php?topic=setupexitcodes
Expand All @@ -614,6 +633,13 @@ namespace AppInstaller::Manifest
{ HRESULT_FROM_WIN32(ERROR_INSTALL_CANCEL), ExpectedReturnCodeEnum::CancelledByUser },
{ HRESULT_FROM_WIN32(ERROR_PACKAGE_ALREADY_EXISTS), ExpectedReturnCodeEnum::AlreadyInstalled },
{ HRESULT_FROM_WIN32(ERROR_INSTALL_PACKAGE_DOWNGRADE), ExpectedReturnCodeEnum::Downgrade },
{ HRESULT_FROM_WIN32(ERROR_DEPLOYMENT_BLOCKED_BY_POLICY), ExpectedReturnCodeEnum::BlockedByPolicy},
{ HRESULT_FROM_WIN32(ERROR_INSTALL_POLICY_FAILURE), ExpectedReturnCodeEnum::BlockedByPolicy},
{ HRESULT_FROM_WIN32(ERROR_PACKAGES_IN_USE), ExpectedReturnCodeEnum::PackageInUse },
{ HRESULT_FROM_WIN32(ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE), ExpectedReturnCodeEnum::SystemNotSupported },
{ HRESULT_FROM_WIN32(ERROR_PACKAGE_NOT_SUPPORTED_ON_FILESYSTEM), ExpectedReturnCodeEnum::SystemNotSupported },
{ HRESULT_FROM_WIN32(ERROR_DEPLOYMENT_OPTION_NOT_SUPPORTED), ExpectedReturnCodeEnum::SystemNotSupported },
{ HRESULT_FROM_WIN32(ERROR_PACKAGE_LACKS_CAPABILITY_TO_DEPLOY_ON_HOST), ExpectedReturnCodeEnum::SystemNotSupported },
};
default:
return {};
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCommonCore/Public/AppInstallerErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@
#define APPINSTALLER_CLI_ERROR_INSTALL_BLOCKED_BY_POLICY ((HRESULT)0x8A15010F)
#define APPINSTALLER_CLI_ERROR_INSTALL_DEPENDENCIES ((HRESULT)0x8A150110)
#define APPINSTALLER_CLI_ERROR_INSTALL_PACKAGE_IN_USE_BY_APPLICATION ((HRESULT)0x8A150111)
#define APPINSTALLER_CLI_ERROR_INSTALL_INVALID_PARAMETER ((HRESULT)0x8A150112)
#define APPINSTALLER_CLI_ERROR_INSTALL_SYSTEM_NOT_SUPPORTED ((HRESULT)0x8A150113)

// Status values for check package installed status results.
// Partial success has the success bit(first bit) set to 0.
Expand Down
2 changes: 2 additions & 0 deletions src/AppInstallerCommonCore/Public/winget/ManifestCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace AppInstaller::Manifest
MissingDependency,
DiskFull,
InsufficientMemory,
InvalidParameter,
NoNetwork,
ContactSupport,
RebootRequiredToFinish,
Expand All @@ -138,6 +139,7 @@ namespace AppInstaller::Manifest
AlreadyInstalled,
Downgrade,
BlockedByPolicy,
SystemNotSupported,
Custom,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ namespace AppInstaller::Repository::Rest::Schema::V1_4::Json
{
return ExpectedReturnCodeEnum::PackageInUseByApplication;
}
else if (inStrLower == "invalidparameter")
{
return ExpectedReturnCodeEnum::InvalidParameter;
}
else if (inStrLower == "systemnotsupported")
{
return ExpectedReturnCodeEnum::SystemNotSupported;
}

return V1_1::Json::ManifestDeserializer::ConvertToExpectedReturnCodeEnum(inStrLower);
}
Expand Down