Registriert seit: 12. Aug 2003
Ort: Soest
4.016 Beiträge
Delphi 10.1 Berlin Enterprise
|
AW: Padding Bytes herausfinden
20. Feb 2018, 17:05
Kurz mal die RTTI bemüht:
Delphi-Quellcode:
procedure PrintPaddingBytes(typeInfo: PTypeInfo);
var
ctx: TRttiContext;
t: TRttiType;
f: TRttiField;
offset: Integer;
begin
t := ctx.GetType(typeInfo);
offset := 0;
for f in t.GetFields do
begin
case f.Offset - offset of
0:;
1: Writeln('padding at byte ', offset);
else
Writeln('padding at bytes ', offset, ' - ', f.Offset - 1);
end;
offset := f.Offset + f.FieldType.TypeSize;
end;
end;
|