From dc9a581e1cf922d043e6906c0897ec732a7c86f5 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 9 Sep 2021 15:10:22 -0700 Subject: [PATCH] Fix resource entry checking --- .../Microsoft/Entries/ResourceDirectoryTableEntry.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs index 334addd3..e7c80eef 100644 --- a/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs +++ b/BurnOutSharp/ExecutableType/Microsoft/Entries/ResourceDirectoryTableEntry.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using BurnOutSharp.ExecutableType.Microsoft.Headers; using BurnOutSharp.Tools; namespace BurnOutSharp.ExecutableType.Microsoft.Entries @@ -22,7 +21,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// The offset of a string that gives the Type, Name, or Language ID entry, depending on level of table. /// - public uint NameOffset => (uint)(IntegerId & (1 << 32)); + public uint NameOffset => (uint)(IntegerId ^ (1 << 31)); /// /// The string that gives the Type, Name, or Language ID entry, depending on level of table pointed to by NameOffset @@ -42,7 +41,7 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// High bit 1. The lower 31 bits are the address of another resource directory table (the next level down). /// - public uint SubdirectoryOffset => (uint)(DataEntryOffset & (1 << 32)); + public uint SubdirectoryOffset => (uint)(DataEntryOffset ^ (1 << 31)); /// /// Resource Data entry (a leaf). @@ -54,12 +53,12 @@ namespace BurnOutSharp.ExecutableType.Microsoft.Entries /// /// Determine if an entry has a name or integer identifier /// - public bool IsIntegerIDEntry() => (NameOffset & (1 << 32)) == 0; + public bool IsIntegerIDEntry() => (IntegerId & (1 << 31)) == 0; /// /// Determine if an entry represents a leaf or another directory table /// - public bool IsResourceDataEntry() => (DataEntryOffset & (1 << 32)) == 0; + public bool IsResourceDataEntry() => (DataEntryOffset & (1 << 31)) == 0; public static ResourceDirectoryTableEntry Deserialize(Stream stream, long sectionStart) {