Skip to content

Commit

Permalink
[regcool.vm] Restore hash installation
Browse files Browse the repository at this point in the history
The new signature verification in `CM-Assert-Signature` using
`signtool.exe` does not work for RegCool. Restore the previous
installation checking the SHA256. As the tool is using a URL that does
not include the version, the hash will change with every update,
breaking the package. If the package is updated often, we will need to
remove it from the default configuration (replacing it total-registry)
or researching if it is possible to use `signtool.exe` to verify the
package.

Note that the previous package implementation being replaced here had an
important bug: `VM-Assert-Signature` was not called at all, as
`Get-ChildItem -Path "$toolDir\*.{exe,dll}"` does not match any file.
  • Loading branch information
Ana06 committed Nov 6, 2024
1 parent 520a3b8 commit ab05c62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/regcool.vm/regcool.vm.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>regcool.vm</id>
<version>0.0.0.20240411</version>
<version>2.015</version>
<authors>Kurt Zimmermann</authors>
<description>In addition to all the features that you can find in RegEdit and RegEdt32, RegCool adds many powerful features that allow you to work faster and more efficiently with registry related tasks</description>
<dependencies>
Expand Down
34 changes: 2 additions & 32 deletions packages/regcool.vm/tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,8 @@ Import-Module vm.common -Force -DisableNameChecking

$toolName = 'RegCool'
$category = 'Registry'
$toolDir = Join-Path ${Env:RAW_TOOLS_DIR} $toolName

$zipUrl = 'https://kurtzimmermann.com/files/RegCoolX64.zip'
$zipSha256 = '8fde37cf66024eb68be3c0e34125540f855626935f1cffc0fb7409f3ba343870'

try {
# Download zip
$packageArgs = @{
packageName = $env:ChocolateyPackageName
file = Join-Path ${Env:TEMP} $toolName
url = $zipUrl
}
$filePath = Get-ChocolateyWebFile @packageArgs

# Extract zip
Get-ChocolateyUnzip -FileFullPath $filePath -Destination $toolDir

# Check signature of all unzip files
Get-ChildItem -Path "$toolDir\*.{exe,dll}" | ForEach-Object {
VM-Assert-Signature $_.FullName
}
} catch {
# Remove files with invalid signature
Remove-Item $toolDir -Recurse -Force -ea 0 | Out-Null
VM-Write-Log-Exception $_
}

try {
$shortcutDir = Join-Path ${Env:TOOL_LIST_DIR} $category
$shortcut = Join-Path $shortcutDir "$toolname.lnk"
$toolPath = Join-Path $toolDir "$toolName.exe"
Install-ChocolateyShortcut -shortcutFilePath $shortcut -targetPath $toolPath
VM-Assert-Path $shortcut
} catch {
VM-Write-Log-Exception $_
}
VM-Install-From-Zip $toolName $category $zipUrl -zipSha256 $zipSha256 -consoleApp $false -innerFolder $false

0 comments on commit ab05c62

Please sign in to comment.