Fixed authenticode-js unsign when changing resources, #4190
Ylian Saint-Hilaire committed
Jun 29, 2022 at 12:25 UTC
efd4dac6e8eccb44ff4be7aea49281fd5df93348
1 file changed
+4
-2
authenticode.js
+4
-2
@@ -1937,7 +1937,6 @@ function start() {
1937
});
1938
return;
1939
}
1940
- console.log("Done.");
1940
}
1941
if (command == 'unsign') { // Unsign an executable
1942
if (typeof args.exe != 'string') { console.log("Missing --exe [filename]"); return; }
@@ -1952,7 +1951,10 @@ function start() {
1951
}
1952
} else {
1953
console.log("Changing resources and unsigning to " + args.out);
1955
- exe.writeExecutable(args, null); // Unsigning with resources decoded and re-encoded.
1954
+ exe.writeExecutable(args, null, function (err) { // Unsigning with resources decoded and re-encoded.
1955
+ if (err == null) { console.log("Done."); } else { console.log(err); }
1956
+ if (exe != null) { exe.close(); }
1957
+ });
1958
}
1959
}
1960
if (command == 'createcert') { // Create a code signing certificate and private key