From 1188cad5e6b67c83350156eb7dcbf23c2114cfc9 Mon Sep 17 00:00:00 2001 From: SilasLaspada Date: Thu, 24 Jun 2021 12:58:38 -0600 Subject: [PATCH] Slightly improve PE Compact version detection (#40) * Slightly improve PE Compact version detection * Address comments * Address comments --- BurnOutSharp/PackerType/PECompact.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BurnOutSharp/PackerType/PECompact.cs b/BurnOutSharp/PackerType/PECompact.cs index b555a5b2..251823a3 100644 --- a/BurnOutSharp/PackerType/PECompact.cs +++ b/BurnOutSharp/PackerType/PECompact.cs @@ -30,9 +30,13 @@ namespace BurnOutSharp.PackerType return MatchUtil.GetFirstMatch(file, fileContent, matchers, includePosition); } + // TODO: Improve version detection, Protection ID is able to detect ranges of versions. For example, 1.66-1.84 or 2.20-3.02. public static string GetVersion(string file, byte[] fileContent, List positions) { - return $"v{BitConverter.ToInt16(fileContent, positions[0] + 4)}"; + short version = BitConverter.ToInt16(fileContent, positions[0] + 4); + if (version == 0) + return string.Empty; + return $"(Internal Version {version})"; } } }