public FixupRecord(RecordReader reader, RecordContext context) : base(reader, context) { List <FixupThreadDefinition> threads = new List <FixupThreadDefinition>(); List <FixupDefinition> fixups = new List <FixupDefinition>(); while (!reader.IsEOF) { byte b = reader.PeekByte(); if ((b & 0x80) == 0) { FixupThreadDefinition thread = ParseThreadSubrecord(reader); threads.Add(thread); if (thread.Kind == FixupThreadKind.Target) { context.TargetThreads[thread.ThreadNumber] = thread; } else { context.FrameThreads[thread.ThreadNumber] = thread; } } else { FixupDefinition fixup = ParseFixupSubrecord(reader, context); fixups.Add(fixup); if (context.LastRecord is LEDATARecord) { var r = (LEDATARecord)context.LastRecord; fixup.DataOffset += (ushort)r.DataOffset; r.Segment.Fixups.Add(fixup); } else if (context.LastRecord is LIDATARecord) { } else if (context.LastRecord is COMDATRecord) { } else { throw new InvalidDataException("FIXUPP record must follow LEDATA, LIDATA, or COMDAT record."); } } } this.Threads = threads.ToArray(); this.Fixups = fixups.ToArray(); }
public FixupRecord(RecordReader reader, RecordContext context) : base(reader, context) { List<FixupThreadDefinition> threads = new List<FixupThreadDefinition>(); List<FixupDefinition> fixups = new List<FixupDefinition>(); while (!reader.IsEOF) { byte b = reader.PeekByte(); if ((b & 0x80) == 0) { FixupThreadDefinition thread = ParseThreadSubrecord(reader); threads.Add(thread); if (thread.Kind == FixupThreadKind.Target) context.TargetThreads[thread.ThreadNumber] = thread; else context.FrameThreads[thread.ThreadNumber] = thread; } else { FixupDefinition fixup = ParseFixupSubrecord(reader, context); fixups.Add(fixup); if (context.LastRecord is LEDATARecord) { var r = (LEDATARecord)context.LastRecord; fixup.DataOffset += (ushort)r.DataOffset; r.Segment.Fixups.Add(fixup); } else if (context.LastRecord is LIDATARecord) { } else if (context.LastRecord is COMDATRecord) { } else { throw new InvalidDataException("FIXUPP record must follow LEDATA, LIDATA, or COMDAT record."); } } } this.Threads = threads.ToArray(); this.Fixups = fixups.ToArray(); }