From 14d905fba342d9d630898f12d38e606052b21cd2 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 27 Jul 2022 11:28:24 -0700 Subject: [PATCH] Handle alternatively named version resources --- .../ExecutableType/Microsoft/Resources/StringFileInfo.cs | 6 +++--- .../ExecutableType/Microsoft/Resources/VersionInfo.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs index b33e67c1..e1ac39a6 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/StringFileInfo.cs @@ -15,13 +15,13 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Resources this.Length = resource?.Length ?? default; this.ValueLength = resource?.ValueLength ?? default; this.Type = resource?.Type ?? default; - this.Key = resource?.Key ?? default; + this.Key = resource?.Key?.TrimStart('\u0001') ?? default; } public static new StringFileInfo Deserialize(Stream stream) { Resource resource = Resource.Deserialize(stream); - if (resource.Key != "StringFileInfo") + if (resource.Key != "StringFileInfo" && resource.Key != "\u0001StringFileInfo") return null; StringFileInfo sfi = new StringFileInfo(resource); @@ -33,7 +33,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Resources public static new StringFileInfo Deserialize(byte[] content, ref int offset) { Resource resource = Resource.Deserialize(content, ref offset); - if (resource.Key != "StringFileInfo") + if (resource.Key != "StringFileInfo" && resource.Key != "\u0001StringFileInfo") return null; StringFileInfo sfi = new StringFileInfo(resource); diff --git a/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs b/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs index f09d2f05..69ebda3b 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Resources/VersionInfo.cs @@ -95,12 +95,12 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Resources int preChildOffset = offset; Resource firstChild = Resource.Deserialize(content, ref offset); - if (firstChild.Key == "StringFileInfo") + if (firstChild.Key == "StringFileInfo" || firstChild.Key == "\u0001StringFileInfo") { offset = preChildOffset; vi.ChildrenStringFileInfo = StringFileInfo.Deserialize(content, ref offset); } - else if (firstChild.Key == "VarFileInfo") + else if (firstChild.Key == "VarFileInfo" || firstChild.Key == "\u0001VarFileInfo") { offset = preChildOffset; vi.ChildrenVarFileInfo = VarFileInfo.Deserialize(content, ref offset); @@ -112,12 +112,12 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Resources preChildOffset = offset; Resource secondChild = Resource.Deserialize(content, ref offset); - if (secondChild.Key == "StringFileInfo") + if (secondChild.Key == "StringFileInfo" || secondChild.Key == "\u0001StringFileInfo") { offset = preChildOffset; vi.ChildrenStringFileInfo = StringFileInfo.Deserialize(content, ref offset); } - else if (secondChild.Key == "VarFileInfo") + else if (secondChild.Key == "VarFileInfo" || secondChild.Key == "\u0001VarFileInfo") { offset = preChildOffset; vi.ChildrenVarFileInfo = VarFileInfo.Deserialize(content, ref offset);