chtof / chocolatey-packages

Apache License 2.0
12 stars 36 forks source link

lossless-cut polluting registry #76

Open SenseOnline opened 2 years ago

SenseOnline commented 2 years ago

Lossless-cut registry keys created on install are not removed on uninstall.

Any way to remove them?

SenseOnline commented 2 years ago

Digging further, it looks like the install script was updated in 68d4fa9fcda6af4b54e2dcec95992bce55436d09 without the corresponding updates to the uninstall script.

A quick fix would be to replace the following lines in the uninstall script

# Remove File Association for .MP4
Remove-Item -Recurse -Force -LiteralPath "HKLM:\SOFTWARE\Classes\SystemFileAssociations\.mp4\Shell\cut" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\LosslessCut.exe" -ErrorAction SilentlyContinue

to something like this, adding any neccessary checks or corrections since I highly doubt I'd get it right the first time without testing

# Remove File Associations
Remove-Item -LiteralPath "HKLM:\SOFTWARE\Clients\Media\LosslessCut" -Recurse -Force -ErrorAction SilentlyContinue;
Remove-Item -LiteralPath "HKLM:\SOFTWARE\Classes\Applications\LosslessCut.exe" -Recurse -Force -ErrorAction SilentlyContinue;
Remove-ItemProperty -LiteralPath "HKLM:\SOFTWARE\RegisteredApplications" -Name "LosslessCut" -Force -ErrorAction SilentlyContinue;

$extensions = @("3g2","3gp","8svx","aa","aac","aax","act","aiff","alac","amr","amv","ape","asf","au","avi","awb","cda","dct","drc","dss","dvf","f4a","f4b","f4p","f4v","flac","flv","gif","gifv","gsm","iklax","ivs","m2ts","m2v","m4a","m4b","m4p","m4v","mkv","mmf","mng","mogg","mov","mp2","mp3","mp4","mpc","mpe","mpeg","mpg","mpv","msv","mts","mxf","nmf","nsf","nsv","oga","ogg","ogv","opus","qt","ra","rf64","rm","rmvb","roq","sln","svi","ts","tta","vob","voc","vox","wav","webm","wma","wmv","wv","yuv","tsv","3gpp","webm")
foreach ($extension in $extensions) {
    Remove-Item -LiteralPath "HKLM:\SOFTWARE\Classes\.$extension\OpenWithList\LosslessCut.exe" -Recurse -Force -ErrorAction SilentlyContinue;
    Remove-Item -LiteralPath ("HKLM:\SOFTWARE\Classes\LossLessCut." + "$extension".ToUpper()) -Recurse -Force -ErrorAction SilentlyContinue;
    Remove-Item -LiteralPath "HKLM:\SOFTWARE\Classes\SystemFileAssociations\.$extension\Shell\losslesscut" -Recurse -Force -ErrorAction SilentlyContinue;
    Remove-ItemProperty -LiteralPath "HKLM:\SOFTWARE\Classes\.$extension\OpenWithProgids" -Name ("LosslessCut." + "$extension".ToUpper()) -Force -ErrorAction SilentlyContinue;
}