May 7, 2012 at 11:48 PM
Edited May 7, 2012 at 11:49 PM
I added a header to my zipped files before the archive starts. If I open the file in notepad, I can see the correct header. If I open the file in winrar, it shows me the contents of the archive. Passing the stream to the SevenZipExtractor
constructor throws an exception with the following message:
"The stream is invalid or no corresponding signature was found."
I just removed the line which resets the stream position:
I read off the header and pass the stream to the SevenZipExtractor constructor and it now works. When googling for this issue, I saw others who had the same problem, so I just wanted to share my hacky solution. Although, this now behaves as I
would have expected, so maybe it's not that hacky. I might also need to set the out variable "offset" to the current stream position instead of 0, but I'm not sure how to properly test it and it seems to work without changes.
It seems like the original intent of CheckSignature was to read through the file until it found the start of the archive, but was never fully implemented. There is even a region marked "Check if it is an SFX archive or a file with an embedded archive."