diff --git a/BurnOutSharp.Builder/Extensions.cs b/BurnOutSharp.Builder/Extensions.cs index 0845ab4d..21208263 100644 --- a/BurnOutSharp.Builder/Extensions.cs +++ b/BurnOutSharp.Builder/Extensions.cs @@ -345,7 +345,6 @@ namespace BurnOutSharp.Builder #endregion - // TODO: Implement other resource types from https://learn.microsoft.com/en-us/windows/win32/menurc/resource-file-formats #region Portable Executable /// @@ -392,9 +391,9 @@ namespace BurnOutSharp.Builder } /// - /// Read resource data as a SecuROM AddD overlay data + /// Read overlay data as a SecuROM AddD overlay data /// - /// Data to parse into a resource header + /// Data to parse into overlay data /// Offset into the byte array /// A filled SecuROM AddD overlay data on success, null on error public static Models.PortableExecutable.SecuROMAddD AsSecuROMAddD(this byte[] data, ref int offset) @@ -452,6 +451,38 @@ namespace BurnOutSharp.Builder return addD; } + #region Debug + + /// + /// Read debug data as an RSDS Program Database + /// + /// Data to parse into a database + /// Offset into the byte array + /// A filled RSDS Program Database on success, null on error + public static Models.PortableExecutable.RSDSProgramDatabase AsRSDSProgramDatabase(this byte[] data, ref int offset) + { + // If we have data that's invalid, we can't do anything + if (data == null) + return null; + + var rsdsProgramDatabase = new Models.PortableExecutable.RSDSProgramDatabase(); + + rsdsProgramDatabase.Signature = data.ReadUInt32(ref offset); + if (rsdsProgramDatabase.Signature != 0x53445352) + return null; + + rsdsProgramDatabase.GUID = new Guid(data.ReadBytes(ref offset, 0x10)); + rsdsProgramDatabase.Age = data.ReadUInt32(ref offset); + rsdsProgramDatabase.PathAndFileName = data.ReadString(ref offset, Encoding.ASCII); // TODO: Actually null-terminated UTF-8 + + return rsdsProgramDatabase; + } + + #endregion + + // TODO: Implement other resource types from https://learn.microsoft.com/en-us/windows/win32/menurc/resource-file-formats + #region Resources + /// /// Read resource data as a resource header /// @@ -1596,5 +1627,7 @@ namespace BurnOutSharp.Builder } #endregion + + #endregion } } \ No newline at end of file diff --git a/BurnOutSharp.Models/PortableExecutable/RSDSProgramDatabase.cs b/BurnOutSharp.Models/PortableExecutable/RSDSProgramDatabase.cs new file mode 100644 index 00000000..cc44986a --- /dev/null +++ b/BurnOutSharp.Models/PortableExecutable/RSDSProgramDatabase.cs @@ -0,0 +1,34 @@ +using System; +using System.Runtime.InteropServices; + +namespace BurnOutSharp.Models.PortableExecutable +{ + /// + /// This file describes the format of the pdb (Program Database) files of the "RSDS" + /// or "DS" type which are emitted by Miscrosoft's link.exe from version 7 and above. + /// + /// + [StructLayout(LayoutKind.Sequential)] + public class RSDSProgramDatabase + { + /// + /// "RSDS" signature + /// + public uint Signature; + + /// + /// 16-byte Globally Unique Identifier + /// + public Guid GUID; + + /// + /// "age" + /// + public uint Age; + + /// + /// zero terminated UTF8 path and file name + /// + public string PathAndFileName; + } +}