@@ -43,7 +43,7 @@ protected override IReadOnlyList<string> _getOperationParameters(IPackage packag
4343 _ => [ ]
4444 } ) ;
4545
46- if ( operation is OperationType . Uninstall && package . Version != "Unknown" )
46+ if ( operation is OperationType . Uninstall && package . Version != "Unknown" && package . OverridenOptions . WinGet_SpecifyVersion is not false )
4747 {
4848 parameters . AddRange ( [ "--version" , $ "\" { package . Version } \" "] ) ;
4949 }
@@ -135,55 +135,54 @@ protected override OperationVeredict _getOperationResult(
135135 // See https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md for reference
136136 uint uintCode = ( uint ) returnCode ;
137137
138- if ( uintCode == 0x8A150109 )
139- {
140- // If the user is required to restart the system to complete the installation
138+ if ( uintCode is 0x8A150109 )
139+ { // TODO: Restart required to finish installation
141140 if ( operation is OperationType . Update ) MarkUpgradeAsDone ( package ) ;
142- //return OperationVeredict.RestartRequired;
143141 return OperationVeredict . Success ;
144142 }
145143
146- if ( uintCode == 0x8A150077 || uintCode == 0x8A15010C || uintCode == 0x8A150005 )
147- {
144+ if ( uintCode is 0x8A150077 or 0x8A15010C or 0x8A150005 )
145+ { // At some point, the user clicked cancel or Ctrl+C
148146 return OperationVeredict . Canceled ;
149147 }
150148
151- if ( uintCode == 0x8A150011 )
152- {
153- // TODO: Needs skip checksum
149+ if ( operation is OperationType . Uninstall && uintCode is 0x8A150017 && package . OverridenOptions . WinGet_SpecifyVersion is not false )
150+ { // No manifest found matching criteria
151+ package . OverridenOptions . WinGet_SpecifyVersion = false ;
152+ return OperationVeredict . AutoRetry ;
153+ }
154+
155+ if ( uintCode is 0x8A150011 )
156+ { // TODO: Integrity failed
154157 return OperationVeredict . Failure ;
155158 }
156159
157- if ( uintCode == 0x8A15002B )
158- {
160+ if ( uintCode is 0x8A15002B )
161+ { // TODO: The update cannot be installed (not applicable)
159162 return OperationVeredict . Failure ;
160163 }
161164
162- if ( uintCode == 0x8A15010D || uintCode == 0x8A15004F || uintCode == 0x8A15010E )
163- {
164- // Application is already installed
165+ if ( uintCode is 0x8A15010D or 0x8A15004F or 0x8A15010E )
166+ { // Application is already installed
165167 if ( operation is OperationType . Update ) MarkUpgradeAsDone ( package ) ;
166168 return OperationVeredict . Success ;
167169 }
168170
169- if ( returnCode == 0 )
170- {
171- // Operation succeeded
171+ if ( returnCode is 0 )
172+ { // Operation succeeded
172173 if ( operation is OperationType . Update ) MarkUpgradeAsDone ( package ) ;
173174 return OperationVeredict . Success ;
174175 }
175176
176- if ( uintCode == 0x8A150056 && package . OverridenOptions . RunAsAdministrator != false && ! CoreTools . IsAdministrator ( ) )
177- {
178- // Installer can't run elevated
177+ if ( uintCode is 0x8A150056 && package . OverridenOptions . RunAsAdministrator is not false && ! CoreTools . IsAdministrator ( ) )
178+ { // Installer can't run elevated, but this condition hasn't been forced on UniGetUI
179179 package . OverridenOptions . RunAsAdministrator = false ;
180180 return OperationVeredict . AutoRetry ;
181181 }
182182
183- if ( ( uintCode is 0x8A150019 or 0x80073D28 ) && package . OverridenOptions . RunAsAdministrator != true )
184- {
183+ if ( ( uintCode is 0x8A150019 or 0x80073D28 ) && package . OverridenOptions . RunAsAdministrator is not true )
184+ { // Installer needs to run elevated, handle autoelevation
185185 // Code 0x80073D28 was added after https://github.com/marticliment/UniGetUI/issues/3093
186- // Installer needs to run elevated
187186 package . OverridenOptions . RunAsAdministrator = true ;
188187 return OperationVeredict . AutoRetry ;
189188 }
0 commit comments