mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-20 15:55:15 +00:00
Add RSDS debug data type
This commit is contained in:
@@ -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
|
||||
|
||||
/// <summary>
|
||||
@@ -392,9 +391,9 @@ namespace BurnOutSharp.Builder
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read resource data as a SecuROM AddD overlay data
|
||||
/// Read overlay data as a SecuROM AddD overlay data
|
||||
/// </summary>
|
||||
/// <param name="data">Data to parse into a resource header</param>
|
||||
/// <param name="data">Data to parse into overlay data</param>
|
||||
/// <param name="offset">Offset into the byte array</param>
|
||||
/// <returns>A filled SecuROM AddD overlay data on success, null on error</returns>
|
||||
public static Models.PortableExecutable.SecuROMAddD AsSecuROMAddD(this byte[] data, ref int offset)
|
||||
@@ -452,6 +451,38 @@ namespace BurnOutSharp.Builder
|
||||
return addD;
|
||||
}
|
||||
|
||||
#region Debug
|
||||
|
||||
/// <summary>
|
||||
/// Read debug data as an RSDS Program Database
|
||||
/// </summary>
|
||||
/// <param name="data">Data to parse into a database</param>
|
||||
/// <param name="offset">Offset into the byte array</param>
|
||||
/// <returns>A filled RSDS Program Database on success, null on error</returns>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Read resource data as a resource header
|
||||
/// </summary>
|
||||
@@ -1596,5 +1627,7 @@ namespace BurnOutSharp.Builder
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace BurnOutSharp.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <see href="http://www.godevtool.com/Other/pdb.htm"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class RSDSProgramDatabase
|
||||
{
|
||||
/// <summary>
|
||||
/// "RSDS" signature
|
||||
/// </summary>
|
||||
public uint Signature;
|
||||
|
||||
/// <summary>
|
||||
/// 16-byte Globally Unique Identifier
|
||||
/// </summary>
|
||||
public Guid GUID;
|
||||
|
||||
/// <summary>
|
||||
/// "age"
|
||||
/// </summary>
|
||||
public uint Age;
|
||||
|
||||
/// <summary>
|
||||
/// zero terminated UTF8 path and file name
|
||||
/// </summary>
|
||||
public string PathAndFileName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user