I think this might fix registry version updates not being applied

This commit is contained in:
Caelan Sayler
2022-05-25 13:01:10 +01:00
parent 23e60cb0c1
commit ffe64d2164
+8 -9
View File
@@ -32,16 +32,12 @@ namespace Squirrel
var zp = new ZipPackage(pkgPath);
// NB: Sometimes the Uninstall key doesn't exist
using (var parentKey =
RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
.CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree)) {; }
using var parentKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
.CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree);
var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
using var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
.CreateSubKey(uninstallRegSubKey + "\\" + applicationName, RegistryKeyPermissionCheck.ReadWriteSubTree);
// we will try to find an "app.ico" from the package, write it to the local app dir, and then
// use it for the uninstaller icon. If an app.ico does not exist, it will use a SquirrelAwareApp exe icon instead.
var targetIco = Path.Combine(rootAppDirectory, "app.ico");
if (File.Exists(targetIco))
key.SetValue("DisplayIcon", targetIco, RegistryValueKind.String);
@@ -65,7 +61,7 @@ namespace Squirrel
var estimatedInstallInKb = compressedSizeInKb + (compressedSizeInKb / 0.38d * 2);
var dwordsToWrite = new[] {
new { Key = "EstimatedSize", Value = (int)estimatedInstallInKb },
new { Key = "EstimatedSize", Value = (int) estimatedInstallInKb },
new { Key = "NoModify", Value = 1 },
new { Key = "NoRepair", Value = 1 },
new { Key = "Language", Value = 0x0409 },
@@ -74,10 +70,13 @@ namespace Squirrel
foreach (var kvp in stringsToWrite) {
key.SetValue(kvp.Key, kvp.Value, RegistryValueKind.String);
}
foreach (var kvp in dwordsToWrite) {
key.SetValue(kvp.Key, kvp.Value, RegistryValueKind.DWord);
}
key.Flush();
return Task.FromResult(key);
}
@@ -98,4 +97,4 @@ namespace Squirrel
key.DeleteSubKeyTree(_config.AppId, false);
}
}
}
}