This project is read-only.

Reading self-extract file not generated by WinZip

Jun 18, 2010 at 5:15 PM

Hi. I have a self-extract file that was not generated by WinZip and I want to read its structure without having to extract the files. When I try to read the self-extract, I receive a BadReadException with the following message: "ZipEntry::ReadDirEntry(): Bad signature (0x48918D99) at position 0x01762215".

Is there a way to do what I want?


Jun 18, 2010 at 6:00 PM

It's possible the self-extracting archive is not actually a valid zip file. That seems to be what DotNetZip is telling you.

you say the archive was "not generated by WinZip".    What was it generated by?

Can you read the generated archive in WinZip?  

Some "self extracting archives" are not zip files.  The ones generated by winzip are zip files.

In some cases the self-extracting archive is a file that contains a valid zip file; for example a file that consists of a stub exe, along with the contents of a valid zip file appended to it.   In that case you may need to (1) open a stream on the file, (2) seek to the beginning of the actual zip content in the file, and finally (3) pass the stream to ZipFile.Read(), in order to read it as a zip file with DotNetZip. I believe that should work. But you will need to know exactly where the zip content starts.




Jun 18, 2010 at 6:15 PM

Hi Cheeso. Thanks for your answer.

The self extract file is, as you said, a stub exe along with the contents. I can view the contents in WinRAR (it ignores the exe and reads only the contents). When I use other zip libraries, such as SharpZipLib, it reads only the contents and ignores the stub exe, without needing to know the point where the zip starts.

The only way to do the same using DotNetZip is doing what you said?

Jun 18, 2010 at 6:35 PM


Seems like SharpZiplib is guessing at where the zip content starts - which is effectively the reference point for every offset value in the zip file.  I guess DotNetZip could do that, but I've never had a request for it.  Not sure if I could make the logic intelligent enough to handle both "winzip-style" self-extracting archives and "stub exe + ZIP", which is what you have, and intelligently select between them.  I'd have to think about that. 


Sep 9, 2011 at 11:28 PM

Hi Cheeso,

     Have you had a chance to think about making DotNetZip able to extract contents from these stub EXE + contents files?  I have a situation where my program uses DotNetZip to extract updates to a program.  Some updates are .zip and some are .exe.  I just run the .exe to actually install the updates, but I want to use DotNetZip to extract the files prior to installation to read the new file version numbers so that a user can choose whether or not to install the update.

     For reference, here is an example file that I can open with 7-Zip and see the contents, but which is an EXE: .  These are the types of files I would love for DotNetZip to be able to handle.  I'm not concerned about


Sep 11, 2011 at 5:32 PM

This is a new question.

Please open a new thread - don't recycle a thread from 15 months ago.