This project is read-only.

In CE but not in XP failure: ZipFile::Read(): Bad signature (054B5074) at position 0x00073AB6

Apr 1, 2009 at 4:10 PM
Hi all,
I'm hoping somebody has some insight to this problem I'm seeing: I'm using the following code to extract all files into a directory:



static void ExtractZipFiles(TestContext context)
using (ZipFile zip = ZipFile.Read(context.TestDeploymentDir + "\\"))
            zip.ExtractAll(context.TestDeploymentDir + "\\", true);
    catch (System.Exception ex1)
Console.Error.WriteLine("exception: {0}", ex1);

The code works well running in XP, however it fails in CE!!
The ReadCentralDirectoryFooter() fails because the EndOfCentralDirectorySignature that it retrieves is 0x054b5074 but is expecting 0x06054b50 at position 0x00073AB6.
At exactly the same position the code running in XP returns the correct value 0x06054b50 but the code running in CE fails. It seems like it is ONE byte off. As far as I can tell it is the same input ZIP file.

Any ideas?



Apr 2, 2009 at 9:25 AM
THAT is really curious.  One byte off!!

Hmmmmmm.....  Does this happen with every zipfile you try? 
What else can you tell me about the zipfile?

You said "as far as you can tell it is the same input zip file."  Can you make sure? 
Can you do a binary compare?  or maybe a checksum on the two files to verify that they are the same and that the one on the CE machine did not get corrupted in some way?

When you say, CE, I that means you are using the compact framework  version of the lib, correct? 
Would it be possible for you to build a test app on XP, linked against the Ionic.Zip.CF.dll, and run it on XP ?
(This will require referencing the CompactFramework assemblies when compiling the desktop app.) 
Apr 2, 2009 at 4:58 PM
I noticed that the assembly version is "" Could that be my problem? Is the Compact Version supported in that version?
Do I have to use 1.7 DotNetZip in order to use the Ionic.Zip.CF.dll?
Apr 2, 2009 at 6:35 PM
YES, that could be the problem.
I did not build or test the DotNetZip assembly on CF until v1.7. 

It's funny because I was going to ask you what version of the DotNetZip library you were using, but then it occurred to me that you were obviously using v1.7, because that is the only released version that supports .NET CF.

The DLL compiled for the desktop .NET Framework includes some calls to methods and classes that do not exist on the .NET CF or on the CE device.  So, for use on .NET CF, you must use the assembly built for CF.

Please can you re-test with v1.7 and let me know your results ?
Apr 2, 2009 at 9:11 PM
Thanks, I'll use v1.7 and let you know
Apr 6, 2009 at 5:14 PM
WOW, lots of new information but not all of it makes sense;
1) I was using the 7-zip v4.57 file archiver application to form the ZIP file the DOTNETZIP lib was trying to extract. I believe 7-zip created a ZIP file that was malformed. If I select 1060 files, right click and create an archive, the ZIP file fails to be extracted in the compact framework by the DotNetZip extractall() method. However, if I create the archive first with a couple of files, and then I add few files at the time until I add all the 1060 files, the resulting ZIP file works well with the DOTNETZIP extractall() method in the Compact Framework. It seems like 7-zip v4.57 is not as robust as it should be.

2) This is what does not make sense to me. DotNetZip version seems to be working in the Compact Framework. I cannot explain that since CF is no supported until v1.7

Apr 7, 2009 at 4:00 PM
hello, Mauricio,

On #1, very interesting.   7zip is open source, is that right?  Maybe you could ask them to have a look at that anomalous zip file?  

On #2 .  The v1.5.0.11 of DotNetZip was never tested on CF, but it is possible that it worked.  There were things added in later versions, like disposing streams, or setting timestamps on the extracted files, that are not supported directly within CF, and these things will not work.  It is possible though, that the v1.5.0.11 release is safe for CF.  Surprising but possible.
Apr 8, 2009 at 12:06 AM

Thanks for your help

Yes 7-zip is open source. I have been looking in their discussion group for similar malformed ZIP files scenarios but I have not found much. But my perception is that it is not quite robust since occasionally I got the MS debugger pop up asking me if I wanted to debug the problem while using the product.

I'll do what you suggest and contact them.

v1.5.0.11 seems to be working in CF! Nice job. I may update to 1.7 just to have some peace of mind.