diff --git a/BurnOutSharp.Models/PortableExecutable/COFFLineNumber.cs b/BurnOutSharp.Models/PortableExecutable/COFFLineNumber.cs new file mode 100644 index 00000000..4cd8e37e --- /dev/null +++ b/BurnOutSharp.Models/PortableExecutable/COFFLineNumber.cs @@ -0,0 +1,42 @@ +using System.Runtime.InteropServices; + +namespace BurnOutSharp.Models.PortableExecutable +{ + /// + /// COFF line numbers are no longer produced and, in the future, will + /// not be consumed. + /// + /// COFF line numbers indicate the relationship between code and line + /// numbers in source files. The Microsoft format for COFF line numbers + /// is similar to standard COFF, but it has been extended to allow a + /// single section to relate to line numbers in multiple source files. + /// + /// COFF line numbers consist of an array of fixed-length records. + /// The location (file offset) and size of the array are specified in + /// the section header. + /// + /// + [StructLayout(LayoutKind.Explicit)] + public class COFFLineNumber + { + /// + /// Used when Linenumber is zero: index to symbol table entry for a function. + /// This format is used to indicate the function to which a group of + /// line-number records refers. + /// + [FieldOffset(0)] public uint SymbolTableIndex; + + /// + /// Used when Linenumber is non-zero: the RVA of the executable code that + /// corresponds to the source line indicated. In an object file, this + /// contains the VA within the section. + /// + [FieldOffset(0)] public uint VirtualAddress; + + /// + /// When nonzero, this field specifies a one-based line number. When zero, + /// the Type field is interpreted as a symbol table index for a function. + /// + [FieldOffset(4)] public ushort Linenumber; + } +} diff --git a/BurnOutSharp.Models/PortableExecutable/COFFRelocation.cs b/BurnOutSharp.Models/PortableExecutable/COFFRelocation.cs index adece90b..b8d277ae 100644 --- a/BurnOutSharp.Models/PortableExecutable/COFFRelocation.cs +++ b/BurnOutSharp.Models/PortableExecutable/COFFRelocation.cs @@ -7,7 +7,7 @@ namespace BurnOutSharp.Models.PortableExecutable /// should be modified when placed in the image file and subsequently loaded /// into memory. /// - /// mage files do not contain COFF relocations, because all referenced symbols + /// Image files do not contain COFF relocations, because all referenced symbols /// have already been assigned addresses in a flat address space. An image /// contains relocation information in the form of base relocations in the /// .reloc section (unless the image has the IMAGE_FILE_RELOCS_STRIPPED attribute). diff --git a/BurnOutSharp.Models/PortableExecutable/Executable.cs b/BurnOutSharp.Models/PortableExecutable/Executable.cs index d6d6cfd0..499c38f1 100644 --- a/BurnOutSharp.Models/PortableExecutable/Executable.cs +++ b/BurnOutSharp.Models/PortableExecutable/Executable.cs @@ -36,6 +36,6 @@ namespace BurnOutSharp.Models.PortableExecutable /// public SectionHeader[] SectionTable { get; set; } - // TODO: Left off at "COFF Relocations (Object Only)" + // TODO: Left off at "COFF Symbol Table" } } diff --git a/BurnOutSharp.Models/PortableExecutable/SectionHeader.cs b/BurnOutSharp.Models/PortableExecutable/SectionHeader.cs index bd58dc3c..343feba9 100644 --- a/BurnOutSharp.Models/PortableExecutable/SectionHeader.cs +++ b/BurnOutSharp.Models/PortableExecutable/SectionHeader.cs @@ -105,5 +105,10 @@ namespace BurnOutSharp.Models.PortableExecutable /// COFF Relocations (Object Only) /// public COFFRelocation[] COFFRelocations; + + /// + /// COFF Line Numbers (Deprecated) + /// + public COFFLineNumber[] COFFLineNumbers; } }