Adaed
Adaed
that it
' can be opened by tools such as 7-Zip or WinRAR.
' https://users.cs.jmu.edu/buchhofp/forensics/formats/pkzip.html
' https://www.pkware.com/documents/casestudies/APPNOTE.TXT
#include "vbcompat.bi"
Sub Usage
Print "This program ""repairs"" a Seagate F3 packed Congen XML module (module
0x34)"
Print "so that it can be opened by tools such as 7-Zip or WinRAR."
Print
Print "Usage: CGZIPFIX infil=[""input filename""] outfil=[""output
filename""]"
Print "Example: CGZIPFIX infil=34.rpm outfil=congen.zip"
Print
End Sub
f1 = FreeFile
Open infil For Binary Access Read As #f1
' read module size at offset 0 and abort if greater than 1 MiB
With mod34ziphdr
.lenfilnam = lenxmlfil
.needed_ver = &H0014
End With
With outcdfilhdr
.flags = mod34ziphdr.flags
.comptyp = mod34ziphdr.comptyp
.timestamp = mod34ziphdr.timestamp
.datestamp = mod34ziphdr.datestamp
.crc32 = mod34ziphdr.crc32
.compsiz = mod34ziphdr.compsiz
.uncompsiz = mod34ziphdr.uncompsiz
.lenfilnam = lenxmlfil
.needed_ver = &H0014
End With
With outendcdrec
.centdirsiz = &H2E + lenxmlfil
.centdiroffst = mod34ziphdr.compsiz + &H1E + lenxmlfil
End With
' read ZIP data into buffer (offset 0x2E + compressed size)
If filbuff = 0 Then
Print "ERROR: could not allocate buffer memory"
Close
End
End If
f2 = FreeFile
Open outfil For Binary Access Write As #f2
Close
End