Add GCPW as a Windows FMA (#42619)
This pull request adds support for the "Google Credential Provider for Windows" application to the maintained apps system, including its metadata, installation logic, and user interface icon. The changes ensure that the app is properly recognized, categorized, and visually represented in the frontend. **New application support:** - Added metadata for "Google Credential Provider for Windows" in `winget` input, including identifiers, architecture, installer type, and default category. - Added output configuration for the app, specifying version, detection query, installer/uninstaller scripts, installer URL, and SHA256 hash. - Registered the app in the main `apps.json` output with a description and platform information. **Frontend/UI updates:** - Added a new React SVG icon component for "Google Credential Provider for Windows" in the software page. - Registered the new icon in the icons index and mapped the app name to the icon in the `SOFTWARE_NAME_TO_ICON_MAP`. [[1]](diffhunk://#diff-628095892e1d16090be1db6cc1a5c9cebc65248c32a8b1312385394818f2907bR13) [[2]](diffhunk://#diff-628095892e1d16090be1db6cc1a5c9cebc65248c32a8b1312385394818f2907bR317)
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Attempts to locate Google Credential Provider for Windows product code from registry and uninstall it using msiexec
|
||||
|
||||
$displayName = "Google Credential Provider for Windows"
|
||||
$publisher = "Google LLC"
|
||||
|
||||
$paths = @(
|
||||
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
|
||||
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',
|
||||
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
|
||||
'HKCU:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
|
||||
)
|
||||
|
||||
$productCode = $null
|
||||
foreach ($p in $paths) {
|
||||
$items = Get-ChildItem -Path $p -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue
|
||||
} | Where-Object {
|
||||
$_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like "$displayName*") -and ($publisher -eq "" -or $_.Publisher -eq $publisher) -and $_.PSChildName -match '^{[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}}$'
|
||||
}
|
||||
if ($items) {
|
||||
$productCode = ($items | Select-Object -First 1).PSChildName
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $productCode) {
|
||||
Write-Host "Product code not found for $displayName"
|
||||
Exit 1
|
||||
}
|
||||
|
||||
Write-Host "Found product code: $productCode"
|
||||
Write-Host "Attempting to uninstall using msiexec..."
|
||||
|
||||
$timeoutSeconds = 300 # 5 minute timeout
|
||||
|
||||
try {
|
||||
$process = Start-Process msiexec -ArgumentList @("/quiet", "/x", $productCode, "/norestart") -PassThru -NoNewWindow
|
||||
|
||||
# Wait for process with timeout
|
||||
$completed = $process.WaitForExit($timeoutSeconds * 1000)
|
||||
|
||||
if (-not $completed) {
|
||||
Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "Uninstall timed out after $timeoutSeconds seconds"
|
||||
Exit 1603 # ERROR_UNINSTALL_FAILURE
|
||||
}
|
||||
|
||||
# Check exit code and output result
|
||||
if ($process.ExitCode -eq 0) {
|
||||
Write-Host "Uninstall successful"
|
||||
Exit 0
|
||||
} else {
|
||||
Write-Host "Uninstall failed with exit code: $($process.ExitCode)"
|
||||
Exit $process.ExitCode
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error running uninstaller: $_"
|
||||
Exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user