This project is read-only.

Zero reported size for files embedded in CAB file

Jul 17, 2010 at 12:10 AM


I'm using the SevenZipSharp library in my .NET (C++/CLI) project on a 32-bit Windows 7 test machine to list the files embedded in Microsoft Cabinet (CAB) files. I'm simply creating an instance of the SevenZipExtractor with the file-path of the .cab file and then inspecting the ArchiveFileInfos returned in ArchiveFileData. For the embedded files I see valid values for various properties like FileName, Encrypted, IsDirectory and LastWriteTime, but the Size reported for every single file embedded in the .cab file is 0. This happens for every .cab file I've tried so far (~5). Using the original 7z.exe from the command line to list the contents of the cab files (7z l <>) shows the correct non-zero file sizes for the embedded files. Viewing the cab file under a hex editor shows that the first 4 bytes are "4D 53 43 46" - this matches the expected CAB signature in Formats.cs and the file appears to be correctly recognized by SevenZipSharp. I see the same behavior with version 0.62 as well as the most recent version 0.63 (July 16, 2010) of the SevenZipSharp library. Not sure if this matters, but I've seen this behavior with my project built with Visual Studio 2008 as well as Visual Studio 2010 (Express Edition in both cases). Also, I see correct Size values reported for files embedded in .zip and .tar files, so the problem appears specific to CAB files.


Has anybody seen similar behavior? This seems fairly basic and easy to reproduce, so I'm hoping that someone has experience with this... Any help or pointers appreciated.




Jul 17, 2010 at 5:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.