From df336ed5418276b5634d511da768561a7c3ff290 Mon Sep 17 00:00:00 2001 From: Kaleb Luedtke Date: Fri, 2 Sep 2022 13:35:47 -0500 Subject: [PATCH] Add ExpectedReturnCode::ReturnResponse for PackageInUseByApplication --- schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json | 1 + schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json | 1 + src/AppInstallerCLICore/Resources.h | 1 + src/AppInstallerCLICore/Workflows/InstallFlow.cpp | 2 ++ src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3 +++ src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp | 4 ++++ src/AppInstallerCommonCore/Public/AppInstallerErrors.h | 1 + src/AppInstallerCommonCore/Public/winget/ManifestCommon.h | 1 + 8 files changed, 14 insertions(+) diff --git a/schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json b/schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json index 1f4475e977..fbc6cbf9f5 100644 --- a/schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json +++ b/schemas/JSON/manifests/v1.4.0/manifest.installer.1.4.0.json @@ -222,6 +222,7 @@ "type": "string", "enum": [ "packageInUse", + "packageInUseByApplication", "installInProgress", "fileInUse", "missingDependency", diff --git a/schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json b/schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json index 51bbbbf630..d562a2de84 100644 --- a/schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json +++ b/schemas/JSON/manifests/v1.4.0/manifest.singleton.1.4.0.json @@ -264,6 +264,7 @@ "type": "string", "enum": [ "packageInUse", + "packageInUseByApplication", "installInProgress", "fileInUse", "missingDependency", diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h index be31921a12..5c8843712b 100644 --- a/src/AppInstallerCLICore/Resources.h +++ b/src/AppInstallerCLICore/Resources.h @@ -152,6 +152,7 @@ namespace AppInstaller::CLI::Resource 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); diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp index d0af3ef715..0422eb5e6c 100644 --- a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -116,6 +116,8 @@ namespace AppInstaller::CLI::Workflow { case ExpectedReturnCodeEnum::PackageInUse: return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_PACKAGE_IN_USE, Resource::String::InstallFlowReturnCodePackageInUse); + case ExpectedReturnCodeEnum::PackageInUseByApplication: + return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_PACKAGE_IN_USE_BY_APPLICATION, Resource::String::InstallFlowReturnCodePackageInUseByApplication); case ExpectedReturnCodeEnum::InstallInProgress: return ExpectedReturnCode(returnCode, APPINSTALLER_CLI_ERROR_INSTALL_INSTALL_IN_PROGRESS, Resource::String::InstallFlowReturnCodeInstallInProgress); case ExpectedReturnCodeEnum::FileInUse: diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw index ac583d45ae..18c07fd368 100644 --- a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw +++ b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1176,6 +1176,9 @@ Do you agree to the terms? Application is currently running. Exit the application then try again. + + Files modified by the installer are currently in use by a different application. Exit the applications then try again. + Another installation is already in progress. Try again later. diff --git a/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp b/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp index c3cc446767..cf4869aa75 100644 --- a/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp +++ b/src/AppInstallerCommonCore/Manifest/ManifestCommon.cpp @@ -311,6 +311,10 @@ namespace AppInstaller::Manifest { result = ExpectedReturnCodeEnum::PackageInUse; } + if (inStrLower == "packageinusebyapplication") + { + result = ExpectedReturnCodeEnum::PackageInUseByApplication; + } else if (inStrLower == "installinprogress") { result = ExpectedReturnCodeEnum::InstallInProgress; diff --git a/src/AppInstallerCommonCore/Public/AppInstallerErrors.h b/src/AppInstallerCommonCore/Public/AppInstallerErrors.h index 1a5014f00d..15fb835357 100644 --- a/src/AppInstallerCommonCore/Public/AppInstallerErrors.h +++ b/src/AppInstallerCommonCore/Public/AppInstallerErrors.h @@ -126,6 +126,7 @@ #define APPINSTALLER_CLI_ERROR_INSTALL_DOWNGRADE ((HRESULT)0x8A15010E) #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) namespace AppInstaller diff --git a/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h b/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h index 6688ffa5b4..00b0d2adcb 100644 --- a/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h +++ b/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h @@ -123,6 +123,7 @@ namespace AppInstaller::Manifest { Unknown, PackageInUse, + PackageInUseByApplication, InstallInProgress, FileInUse, MissingDependency,