Extract rar file causes an Invalid Archive Exception - the file is valid


The file attached causes this exception on the 32 bit version of SevenZipSharp version 0.64:
SevenZip.SevenZipArchiveException occurred
Message="Invalid archive: open/read error! Is it encrypted and a wrong password was provided?\nIf your archive is an exotic one, it is possible that SevenZipSharp has no signature for its format and thus decided it is TAR by mistake."
   at SevenZip.SevenZipBase.ThrowException(CallbackBase handler, Exception[] e)
   at SevenZip.SevenZipExtractor.OpenArchive(IInStream archiveStream, ArchiveOpenCallback openCallback)
   at SevenZip.SevenZipExtractor.GetArchiveInfo(Boolean disposeStream)
   at SevenZip.SevenZipExtractor.InitArchiveFileData(Boolean disposeStream)
   at SevenZip.SevenZipExtractor.ExtractArchive(String directory)
On the 64 bit version an unmanaged exception is thrown which crashes my application.
The file can be extracted without any problems with the 7Zip windows application.

file attachments


thunder7553 wrote Feb 9, 2011 at 8:09 AM

I do have the same problem - I create an SFX archive and read the files later on with SevenZipSharp. When using LZMA2/Ultra compression settings, this message appears when extracting from the SFX. When I use LZMA2/Normal compressing settings, it works. I thought it had something to do with the Ultra option. The archive format is 7z by the way (in my case). I am using 9.20 7z.dll.

wrote Mar 7, 2011 at 7:47 PM

kenlefeb wrote Mar 7, 2011 at 8:47 PM

After stepping through the code, I realized this was an inaccurate exception. What really happened was that the createObject method failed, so the archive interface variable (_archive in SevenZipExtractor) was null, which caused the default exception to be thrown at line 448 of SevenZipLibraryManager (in the InArchive method).

When I switched the 7z.dll that I was using (I had copied the one that came with my licensed copy of PowerArchiver, instead of using the "official" one that is linked from this CodePlex project), it started working.

wrote Feb 22, 2013 at 1:16 AM

wrote Jan 31, 2014 at 9:46 AM