Fixed icon ordering and naming in authenticode.js.

Ylian Saint-Hilaire committed Aug 11, 2022 at 10:45 UTC ff67f6abc371d00f1eb5ed20f40353c04483a2ed
1 file changed +10 -4
authenticode.js
+10 -4
@@ -811,7 +811,7 @@ function createAuthenticodeHandler(path) {
811
812 // Set icon information
813 obj.setIconInfo = function (iconInfo) {
814 - // Delete all icon and icon groups the the ressources
814 + // Delete all icon and icon groups the the resources
815 var resourcesEntries = [];
816 for (var i = 0; i < obj.resources.entries.length; i++) {
817 if ((obj.resources.entries[i].name != resourceDefaultNames.icon) && (obj.resources.entries[i].name != resourceDefaultNames.iconGroups)) {
@@ -820,9 +820,15 @@ function createAuthenticodeHandler(path) {
820 }
821 obj.resources.entries = resourcesEntries;
822
823 - // count the icon groups
824 - var iconGroupCount = 0;
825 - for (var i in iconInfo) { iconGroupCount++; }
823 + // Count the icon groups and re-number all icons
824 + var iconGroupCount = 0, nextIconNumber = 1;
825 + for (var i in iconInfo) {
826 + iconGroupCount++;
827 + var xicons = {};
828 + for (var j in iconInfo[i].icons) { xicons[nextIconNumber++] = iconInfo[i].icons[j]; }
829 + iconInfo[i].icons = xicons;
830 + }
831 + console.log(iconInfo);
832 if (iconGroupCount == 0) return; // If there are no icon groups, we are done
833
834 // Add the new icons entry