tags:

views:

52

answers:

1

I have previously been using Chilkat Zip .Net to generate backup files from my application, but after having issues with the Component, moved to Xceed Zip .Net for the same function.

If you take one of the Zips generated with the Chilkat and attempt to extract using Xceed, 7Zip, WinZip then it fails.

If you take the same file and extract with Chilkat, Windows Zip, WinRar then the file extracts just fine.

Having a read on Wikipedia about the WinZip format I investigated the Central Directory and the Local File header, and it appears that the Chilkat component has written the Central Directory record filesize incorrectly. If you use something like FRHed to edit the Central Record and make the filesize the same as the Local Header size, then everything extracts correctly.

What would you recommend I do?

  1. Write a small utility using the Chilkat library to extract the Zip and then recompress with the Xceed Library
  2. Read the Zip file looking for the Necessary Zip Markers (as defined in the Spec) and then correct the Central Header.
  3. Some other combination.
+1  A: 

It depends on number of backups your program generated. Probably, it would be easier to decompress/recompress them from program or by hands. However, if there is a lot of files, the better way would be to fix central directory record fields - you should write code, which 1) searches for central directory; 2) for each record, goes to position where local file header is stored, and read file size; 3) go back to central directory and write valid file size there; 4) Beware of large files, if they are - file size for files >4Gb is written in extension.

Nickolay O.
Thanks. What I ended up doing is what you wrote, I just decompressed the old backup files, then recompressed them BUT only if the file itself exhibited the error in the record. I made a small application that is delivered as a Support Module to our application so that the old library was there for use.
Paul Farry