HexSpan?TryGetSpan(FatMethodBody fatBody, HexPosition position, UInt32Data offsetData, UInt32Data lengthData) { if (!offsetData.Span.Span.Contains(position)) { return(null); } return(TryGetSpan(fatBody, offsetData.ReadValue(), lengthData.ReadValue())); }
static HexSpan?TryGetRvaSpan(HexBufferFile file, HexPosition position, RvaData rvaData, UInt32Data sizeData) { if (!rvaData.Span.Span.Contains(position)) { return(null); } var peHeaders = file.GetHeaders <PeHeaders>(); if (peHeaders is null) { return(null); } uint rva = rvaData.ReadValue(); if (rva == 0) { return(null); } uint size = sizeData.ReadValue(); if (size == 0) { return(null); } var pos = peHeaders.RvaToBufferPosition(rva); if (pos + size > file.Span.End) { return(new HexSpan(pos, 0)); } return(new HexSpan(pos, size)); }
static HexSpan?TryGetFileSpan(HexBufferFile file, HexPosition position, FileOffsetData offsetData, UInt32Data sizeData) { if (!offsetData.Span.Span.Contains(position)) { return(null); } var peHeaders = file.GetHeaders <PeHeaders>(); if (peHeaders is null) { return(null); } uint offset = offsetData.ReadValue(); if (offset == 0) { return(null); } uint size = sizeData.ReadValue(); if (size == 0) { return(null); } var pos = peHeaders.FilePositionToBufferPosition(offset); if (pos + size > file.Span.End) { return(new HexSpan(pos, 0)); } return(new HexSpan(pos, size)); }
public UInt32HexField(UInt32Data data, string fieldName, bool useDecimal = false) : base(data, fieldName) => this.data = new UInt32VM(buffer.ReadUInt32(Span.Start), a => UpdateValue(), useDecimal);
public UInt32Field(string objectName, string fieldName, uint defaultValue) { //this.objectName = objectName; //this.name = fieldName; data = PersistentData.GetData <UInt32Data>(objectName, fieldName); }