Issues with SaveSelfExtractor (large files) (64bit)

May 23, 2010 at 4:55 AM
Edited May 23, 2010 at 4:59 AM

Some info:

Using PowerShell V2 (non x86)
Dev/Test machine: Win 7 (64 BIT)
Directory to Zip Size: ~ 25GB


This code works and produces a ~ 7GB zip file which extracts OK:

[System.Reflection.Assembly]::LoadFrom("Ionic.Zip.dll")
$directoryToZip = "E:\VM\Win7 Dev"

$zipfile = new-object Ionic.Zip.ZipFile

$e
= $zipfile.AddDirectory($directoryToZip)
$zipfile
.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::Always $zipfile.Save("E:\Output\Test.zip")
$zipfile.Dispose()

 


 

This code saves the file OK, but when the outputted archive.exe runs the error below is produced.

[System.Reflection.Assembly]::LoadFrom("Ionic.Zip.dll");

$directoryToZip = "E:\VM\Win7 Dev"; $outputFile = [IO.FileInfo] "E:\Output\archive.exe";
$zipfile
= new-object Ionic.Zip.ZipFile; $selfExtractOptions = New-Object Ionic.Zip.SelfExtractorSaveOptions $selfExtractOptions.Flavor = [Ionic.Zip.SelfExtractorFlavor]::ConsoleApplication $selfExtractOptions.DefaultExtractDirectory = $outputFile.Directory.FullName $selfExtractOptions.RemoveUnpackedFilesAfterExecute = $false $e = $zipfile.AddDirectory($directoryToZip) $zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::Always $zipfile.SaveSelfExtractor($outputFile.FullName, $selfExtractOptions) $zipfile.Dispose();
Error when clicking on archive.exe:
[Window Title]
E:\Output\archive.exe

[Content]
E:\Output\archive.exe is not a valid Win32 application.

[OK]

Archive.exe is ~ 7GBs, so I thought perhaps the exe was too large and I also want the zip to fit on DVDs so I used the MaxOutputSegmentSize property set to 700MBs. It saved OK but I got another error when running it:
$directoryToZip = "E:\VM\Win7 Dev";
$outputFile = [IO.FileInfo] "E:\Output\archive.exe";
$zipfile = new-object Ionic.Zip.ZipFile;

$selfExtractOptions = New-Object Ionic.Zip.SelfExtractorSaveOptions
$selfExtractOptions.Flavor = [Ionic.Zip.SelfExtractorFlavor]::ConsoleApplication
$selfExtractOptions.DefaultExtractDirectory = $outputFile.Directory.FullName
$selfExtractOptions.RemoveUnpackedFilesAfterExecute = $false

$e = $zipfile.AddDirectory($directoryToZip)
$zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::Always
$zipfile.MaxOutputSegmentSize = 734003200

$zipfile.SaveSelfExtractor($outputFile.FullName, $selfExtractOptions)

$zipfile.Dispose();
Error when clicking on spanned archive.exe:
[Window Title]
E:\Output\archive.exe

[Content]
The version of this file is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher.

[OK]

Any suggestions would be appreciated. What i'm trying to do is create a spanned self extracting ZIP from a large (many GBs) input directory.
Coordinator
May 23, 2010 at 1:38 PM

Hmm, a spanned self-extracting archive.

The documentation says it is not possible

> You can save a split Zip file only when saving to a regular filesystem file. It's not possible to save a split zip file as a self-extracting archive,

Seems like a bug that DotNetZip does not throw an exception when you try to create a spanned SFX.  I'll create a work item for that.

Coordinator
May 23, 2010 at 1:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 23, 2010 at 11:14 PM

Ah thanks! Obviously I didn't read the entire documentation on that property.

How about my second example where I'm not splitting the ZIP. The error is "E:\Output\archive.exe is not a valid Win32 application.". Archive.exe was pretty big, about 7GBs. It seems like there is a limit to how big the self extracting EXE can be because when I take the same code and run it against a smaller input directory, the self extractor EXE works.

Coordinator
May 24, 2010 at 5:09 PM

You may be right that a SFX larger than a certain limit will not properly execute.

I'll have to investigate that.

 

Coordinator
May 24, 2010 at 5:10 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
May 24, 2010 at 5:11 PM

Can you clarify for me, where 64-bit OS is being used? 

on the creation of SFX - did you use a 64-bit OS there?

on the extraction of the SFX - did you use a 64-bit version of Windows there?

May 24, 2010 at 8:47 PM
Edited May 24, 2010 at 8:49 PM

So I ran the code on my Windows 7 64bit Ultimate machine. The input directory to be zipped was local on that machine and the self extracting EXE was created and executed all on that same machine.

Also I just tried the same code to create an SFX on Windows Server 2003 Enterprise 32BIT on a 22.9GB input folder. The output archive.exe file was 15GB and I get the following error when running it:

---------------------------
C:\Documents and Settings\arisman1\Desktop\test\archive.exe
---------------------------
C:\Documents and Settings\arisman1\Desktop\test\archive.exe is not a valid Win32 application.


---------------------------
OK  
---------------------------

The same code creates an SFX that works when created and executed on Windows Server 2003 Enterprise 32BIT on a smaller 22MB input folder.

May 24, 2010 at 10:05 PM

I read something earlier today that said there's a 4gb limit on Windows executable files (*.exe, *.dll, etc) for PE32 and PE32+ which applies to both 32-bit and 64-bit versions. You might be hitting this limit. I'll see if I can the page I was reading again...

P.S. What does WinZip do if you try to create an SFX from the same files?

Coordinator
May 25, 2010 at 1:18 AM

Yes, that's what I was thinking, too.  But I haven't figured out yet, how the DotNetZip SFX would interact with the PE spec.  In an SFX, the zip data is just "extra" data tacked onto the PE file.  It's not included formally into the PE data records.   So I would think there would be no problem. But, your observations disagree with that.

I need to look further.

 

May 25, 2010 at 2:03 AM

So I just tried winzip... WinZip is a little weird, first the zip must be created, then there is a tool in the winzip program files directory called WZSEPE32.EXE which creates a self extracting ZIP from an existing ZIP. It gave me an error when I selected my big 15GB zip file created with DotNetZip:

---------------------------
WinZip Self-Extractor Personal Edition
---------------------------
This Zip file cannot be made into a .EXE File because the resulting EXE File would be greater than 2GB.
---------------------------
OK   
---------------------------

Aug 17, 2011 at 3:23 PM

I am receiving a similar problem. I suspect it is because the files are so massive (e.g. ~90GB, ~20GB). Windows gives: http://i.imgur.com/2nNPT.png

It should be noted ZIP/RAR programs open the files just fine.