From 97a9b2ee006d78c7a54d8f23fda92d897061cf15 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 9 Jun 2022 10:50:27 -0700 Subject: [PATCH] Workaround for missing readBigUInt64LE() in older NodeJS. --- authenticode.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/authenticode.js b/authenticode.js index 8dc5de27..f0f4374c 100644 --- a/authenticode.js +++ b/authenticode.js @@ -172,7 +172,7 @@ function createAuthenticodeHandler(path) { obj.header.peWindows = {} if (obj.header.pe32plus == 0) { // 32bit header - obj.header.peWindows.imageBase = optinalHeader.readUInt32LE(28); + //obj.header.peWindows.imageBase = optinalHeader.readUInt32LE(28); obj.header.peWindows.sectionAlignment = optinalHeader.readUInt32LE(32); obj.header.peWindows.fileAlignment = optinalHeader.readUInt32LE(36); obj.header.peWindows.majorOperatingSystemVersion = optinalHeader.readUInt16LE(40); @@ -187,15 +187,15 @@ function createAuthenticodeHandler(path) { obj.header.peWindows.checkSum = optinalHeader.readUInt32LE(64); obj.header.peWindows.subsystem = optinalHeader.readUInt16LE(68); obj.header.peWindows.dllCharacteristics = optinalHeader.readUInt16LE(70); - obj.header.peWindows.sizeOfStackReserve = optinalHeader.readUInt32LE(72); - obj.header.peWindows.sizeOfStackCommit = optinalHeader.readUInt32LE(76); - obj.header.peWindows.sizeOfHeapReserve = optinalHeader.readUInt32LE(80); - obj.header.peWindows.sizeOfHeapCommit = optinalHeader.readUInt32LE(84); + //obj.header.peWindows.sizeOfStackReserve = optinalHeader.readUInt32LE(72); + //obj.header.peWindows.sizeOfStackCommit = optinalHeader.readUInt32LE(76); + //obj.header.peWindows.sizeOfHeapReserve = optinalHeader.readUInt32LE(80); + //obj.header.peWindows.sizeOfHeapCommit = optinalHeader.readUInt32LE(84); obj.header.peWindows.loaderFlags = optinalHeader.readUInt32LE(88); obj.header.peWindows.numberOfRvaAndSizes = optinalHeader.readUInt32LE(92); } else { // 64bit header - obj.header.peWindows.imageBase = optinalHeader.readBigUInt64LE(24); + //obj.header.peWindows.imageBase = optinalHeader.readBigUInt64LE(24); // TODO: readBigUInt64LE is not supported in older NodeJS versions obj.header.peWindows.sectionAlignment = optinalHeader.readUInt32LE(32); obj.header.peWindows.fileAlignment = optinalHeader.readUInt32LE(36); obj.header.peWindows.majorOperatingSystemVersion = optinalHeader.readUInt16LE(40); @@ -210,10 +210,10 @@ function createAuthenticodeHandler(path) { obj.header.peWindows.checkSum = optinalHeader.readUInt32LE(64); obj.header.peWindows.subsystem = optinalHeader.readUInt16LE(68); obj.header.peWindows.dllCharacteristics = optinalHeader.readUInt16LE(70); - obj.header.peWindows.sizeOfStackReserve = optinalHeader.readBigUInt64LE(72); - obj.header.peWindows.sizeOfStackCommit = optinalHeader.readBigUInt64LE(80); - obj.header.peWindows.sizeOfHeapReserve = optinalHeader.readBigUInt64LE(88); - obj.header.peWindows.sizeOfHeapCommit = optinalHeader.readBigUInt64LE(96); + //obj.header.peWindows.sizeOfStackReserve = optinalHeader.readBigUInt64LE(72); + //obj.header.peWindows.sizeOfStackCommit = optinalHeader.readBigUInt64LE(80); + //obj.header.peWindows.sizeOfHeapReserve = optinalHeader.readBigUInt64LE(88); + //obj.header.peWindows.sizeOfHeapCommit = optinalHeader.readBigUInt64LE(96); obj.header.peWindows.loaderFlags = optinalHeader.readUInt32LE(104); obj.header.peWindows.numberOfRvaAndSizes = optinalHeader.readUInt32LE(108); }