Files
SabreTools.Models/NewExecutable/RelocationRecord.cs

77 lines
2.6 KiB
C#
Raw Normal View History

2023-09-04 00:11:04 -04:00
using System.Runtime.InteropServices;
2023-09-04 00:12:49 -04:00
namespace SabreTools.Models.NewExecutable
2023-09-04 00:11:04 -04:00
{
/// <summary>
/// A table of relocation records follows. The following is the format
/// of each relocation record.
/// </summary>
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class RelocationRecord
{
/// <summary>
/// Source type.
/// </summary>
public RelocationRecordSourceType SourceType;
/// <summary>
/// Flags byte.
///
/// The target value has four types that are defined in the flag
/// byte field.
/// </summary>
public RelocationRecordFlag Flags;
/// <summary>
/// Offset within this segment of the source chain.
/// If the ADDITIVE flag is set, then target value is added to
/// the source contents, instead of replacing the source and
/// following the chain. The source chain is an 0FFFFh
/// terminated linked list within this segment of all
/// references to the target.
/// </summary>
public ushort Offset;
/// <summary>
/// INTERNALREF
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.INTERNALREF"/></remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public InternalRefRelocationRecord InternalRefRelocationRecord;
2023-09-04 21:14:41 -04:00
#else
public InternalRefRelocationRecord? InternalRefRelocationRecord;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// IMPORTNAME
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTNAME"/></remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public ImportNameRelocationRecord ImportNameRelocationRecord;
2023-09-04 21:14:41 -04:00
#else
public ImportNameRelocationRecord? ImportNameRelocationRecord;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// IMPORTORDINAL
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.IMPORTORDINAL"/></remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public ImportOrdinalRelocationRecord ImportOrdinalRelocationRecord;
2023-09-04 21:14:41 -04:00
#else
public ImportOrdinalRelocationRecord? ImportOrdinalRelocationRecord;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// IMPORTORDINAL
/// </summary>
/// <remarks>Must be <c>NULL</c> if <see cref="Flags"/> is not set to <see cref="RelocationRecordFlag.OSFIXUP"/></remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public OSFixupRelocationRecord OSFixupRelocationRecord;
2023-09-04 21:14:41 -04:00
#else
public OSFixupRelocationRecord? OSFixupRelocationRecord;
#endif
2023-09-04 00:11:04 -04:00
}
}