Procedure RecordInfoToStingList(SL: TStrings; RI: TXMLSerializeRecordInfo);
Var i: Integer;
Begin
SL.Add(Format('
Align:%d', [RI.Align]));
For i := 0
to RI.Count - 1
do Begin
If not (RI.DType[i]
in [rtAlign, rtSplit])
Then
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"',
[RI.FullOffset[i], RI.Offset[i], RI.Size[i], RI.
Name[i]]));
If RI.DType[i]
in [rtRecord, rtArray, rtDynArray]
Then
RecordInfoToStingList(SL, RI.SubInfo[i]);
End;
End;
Var Test: TSearchRec;
RI, RIx: TXMLSerializeRecordInfo;
SL: TStrings;
Begin
// einfach nur den Record mit irgendetwas befüllen
FindFirst(Application.ExeName, faAnyFile, Test);
FindClose(Test);
RI := TXMLSerializeRecordInfo.Create;
Try
RI.Add('
Time', rtInteger);
RI.Add('
Size', rtInt64);
RI.Add('
Attr', rtInteger);
RI.Add('
Name', rtString);
RI.Add('
Exclude', rtInteger);
RI.Add('
Handle', rtLongWord);
RIx := RI.Add('
Data', rtRecord);
RIx.Add('
Attributes', rtLongWord);
RIx.Add('
', rtSplit, 4);
RIx.Add('
Creation', rtWord64);
RIx.Add('
', rtSplit, 4);
RIx.Add('
LastAccess', rtWord64);
RIx.Add('
', rtSplit, 4);
RIx.Add('
LastWrite', rtWord64);
RIx.Add('
', rtSplit, 4);
RIx.Add('
FileSize', rtWord64LE);
RIx.Add('
Reserved0', rtLongWord);
RIx.Add('
Reserved1', rtLongWord);
RIx.Add('
FileName', rtCharArray, 260);
RIx.Add('
Alternate', rtCharArray, 14);
//RI.Parse('I"Time" I8"Size" I"Attr" S"Name" I"Exclude" W4"Handle" R"Data" ('
// + 'W4"Attributes" NX4W8"Creation" NX4W8"LastAccess" NX4W8"LastWrite" IE"FileSize"'
// + 'I4"Reserved0" I4"Reserved1" C260"FileName" C14"Alternate" )');
//RI.Parse('I I8 I S I W4 R ( W4 NX4W8 NX4W8 NX4W8 WE I4 I4 C260 C14 )');
//RI.Parse('ii8isiw4r(w4nx4w8nx4w8nx4w8iei4i4c260c14)');
SL := TStringList.Create;
RecordInfoToStingList(SL, RI);
SL.Add('
');
SL.Add('
------------------------------');
SL.Add('
');
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.Time) - Integer(@Test), SizeOf(Test.Time), '
Time']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.Size) - Integer(@Test), SizeOf(Test.Size), '
Size']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.Attr) - Integer(@Test), SizeOf(Test.Attr), '
Attr']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.
Name) - Integer(@Test), SizeOf(Test.
Name), '
Name']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.ExcludeAttr) - Integer(@Test), SizeOf(Test.ExcludeAttr), '
Exclude']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.FindHandle) - Integer(@Test), SizeOf(Test.FindHandle), '
Handle']));
SL.Add(Format('
FullOffset:%0:d Offset:%0:d Size:%d Name:"%s"', [Integer(@Test.FindData) - Integer(@Test), SizeOf(Test.FindData), '
Data']));
SL.Add('
');
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.dwFileAttributes) - Integer(@Test), Integer(@Test.FindData.dwFileAttributes) - Integer(@Test.FindData), SizeOf(Test.FindData.dwFileAttributes), '
Attributes']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.ftCreationTime) - Integer(@Test), Integer(@Test.FindData.ftCreationTime) - Integer(@Test.FindData), SizeOf(Test.FindData.ftCreationTime), '
Creation']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.ftLastAccessTime) - Integer(@Test), Integer(@Test.FindData.ftLastAccessTime) - Integer(@Test.FindData), SizeOf(Test.FindData.ftLastAccessTime), '
LastAccess']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.ftLastWriteTime) - Integer(@Test), Integer(@Test.FindData.ftLastWriteTime) - Integer(@Test.FindData), SizeOf(Test.FindData.ftLastWriteTime), '
LastWrite']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.nFileSizeHigh) - Integer(@Test), Integer(@Test.FindData.nFileSizeHigh) - Integer(@Test.FindData), SizeOf(Test.FindData.nFileSizeHigh) * 2, '
FileSize']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.dwReserved0) - Integer(@Test), Integer(@Test.FindData.dwReserved0) - Integer(@Test.FindData), SizeOf(Test.FindData.dwReserved0), '
Reserved0']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.dwReserved1) - Integer(@Test), Integer(@Test.FindData.dwReserved1) - Integer(@Test.FindData), SizeOf(Test.FindData.dwReserved1), '
Reserved1']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.cFileName) - Integer(@Test), Integer(@Test.FindData.cFileName) - Integer(@Test.FindData), SizeOf(Test.FindData.cFileName), '
FileName']));
SL.Add(Format('
FullOffset:%d Offset:%d Size:%d Name:"%s"', [Integer(@Test.FindData.cAlternateFileName) - Integer(@Test), Integer(@Test.FindData.cAlternateFileName) - Integer(@Test.FindData), SizeOf(Test.FindData.cAlternateFileName), '
Alternate']));
SL.Add('
');
SL.Add('
------------------------------');
SL.Add('
');
SL.Add(RI.GetString(sfFormat2));
SL.Add('
');
SL.Add(RI.GetString(sfShort));
ShowMessage(SL.Text);
SL.Free;
Finally
RI.Free;
End;