From ff67f6abc371d00f1eb5ed20f40353c04483a2ed Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 11 Aug 2022 10:45:21 -0700 Subject: [PATCH] Fixed icon ordering and naming in authenticode.js. --- authenticode.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/authenticode.js b/authenticode.js index dee800b9..52e908b1 100644 --- a/authenticode.js +++ b/authenticode.js @@ -811,7 +811,7 @@ function createAuthenticodeHandler(path) { // Set icon information obj.setIconInfo = function (iconInfo) { - // Delete all icon and icon groups the the ressources + // Delete all icon and icon groups the the resources var resourcesEntries = []; for (var i = 0; i < obj.resources.entries.length; i++) { if ((obj.resources.entries[i].name != resourceDefaultNames.icon) && (obj.resources.entries[i].name != resourceDefaultNames.iconGroups)) { @@ -820,9 +820,15 @@ function createAuthenticodeHandler(path) { } obj.resources.entries = resourcesEntries; - // count the icon groups - var iconGroupCount = 0; - for (var i in iconInfo) { iconGroupCount++; } + // Count the icon groups and re-number all icons + var iconGroupCount = 0, nextIconNumber = 1; + for (var i in iconInfo) { + iconGroupCount++; + var xicons = {}; + for (var j in iconInfo[i].icons) { xicons[nextIconNumber++] = iconInfo[i].icons[j]; } + iconInfo[i].icons = xicons; + } + console.log(iconInfo); if (iconGroupCount == 0) return; // If there are no icon groups, we are done // Add the new icons entry