[delphizip] Re: Error extracting zips containing more than 65536 archives.

  • From: James Turner <james.d.h.turner@xxxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Wed, 19 Jan 2005 11:41:29 +0000

QUOTE FROM THE ZIP SPECIFICATION

End of central directory record:

end of central dir signature    4 bytes  (0x06054b50)
number of this disk             2 bytes
number of the disk with the
start of the central directory  2 bytes
total number of entries in the
central directory on this disk  2 bytes
total number of entries in
the central directory           2 bytes
size of the central directory   4 bytes
offset of start of central
directory with respect to
the starting disk number        4 bytes
.ZIP file comment length        2 bytes
.ZIP file comment       (variable size)

You will note that only 2 bytes are allocated to the number of entries in the 
central directory.

In other words, the problem lies in the the zip format rather than in Delphi 
Zip.

The Zip64 format avoids this problem, but this format is not supported by 
Delphi Zip.

-- James Turner


> 
> From: "Ferran Artero (Grupo 77)" <ferran@xxxxxxxxxx>
> Date: 2005/01/19 Wed AM 10:28:50 GMT
> To: <delphizip@xxxxxxxxxxxxx>
> Subject: [delphizip] Error extracting zips containing more than 65536 
> archives.
> 
>   Hello ! 
> 
>   One week ago I write with this problem. I still have the same problem.
> 
>   Now I'm using the v. 1.78 !! of ZipMaster, Delphi 5 and Windows 2000 SP4.
> 
>   Problem : I use the "Add" method and after I want to extract/test the 
> result obtained.The zip has 200MB aprox. and contains 66000 archives aprox. 
> 
>   If the "result.zip" obtained with the Add method contains more than 65536 
> then the extract method crashes. If contains less than 65536 works correctly.
> 
> 
> 
>   RUNNING VERSION A of my UNPACK method:
> 
>   During the extract (using the ExtrOption "[ExtrTest]") , the "OnMessage" 
> event shows : 
>     one message : "Bad Ending Signature for Central dir" but the ErrorCode 
> parameter is "0" and just after this 
>     the message : "Error In Archive warning- c:\Result.zip" and the ErrorCode 
> parameter of this event returns the number "8323336". After this one,
>     the last message is "warnings were given". 
>   Finally the error code from the Extract method is the number "8".
> 
> 
> 
>   RUNNING VERSION B of my UNPACK method:
> 
>   If the extraction is normal (not using the [ExtrTest] extract option), then 
> the "OnMessage" event shows : 
>     one message : "Bad Ending Signature for Central dir" but the ErrorCode 
> parameter is "0" and just after this 
>     the last message is "warnings were given". 
>   Finally the result of the Extract method is an "0". But if we go to analize 
> the result obtained there are just a few archives from the "result.zip", not 
> everything.
> 
> 
> 
> 
>   HOW CAN I UNPACK ZIPS CONTAINING MORE THAN 65535 ARCHIVES ? 
>   IS IT POSSIBLE ? 
>   DO I FORGET SOMETHING IN MY UNPACK METHOD TO HAVE COMPATIBILITY WITH THIS 
> KIND OF ZIPS ?
> 
>   Thanks.
> 
> 
> 
>   SOURCE CODE :
> 
> function PACK(): boolean;
> begin
> 
>   Result := False;
> 
>   oZipMstr := TZipMaster.Create(Form);
>   AutoFree(AF, oZipMstr);
>   oZipMstr.AddOptions := oZipMstr.AddOptions + [AddRecurseDirs];
>   oZipMstr.AddOptions  := oZipMstr.AddOptions + [AddDirNames];
>   oZipMstr.ZipFileName := Self.Path + ZIP_FILENAME;
>   oZipMstr.AddCompLevel := 3;
>   oZipMstr.RootDir := ROOT_DIR;
>   oZipMstr.FSpecArgs.Add('*');
>   oZipMstr.OnMessage := Self._MessageNow;
>   oZipMstr.Add;
> 
>   if oZipMstr.ErrCode > 0 then begin
>     ShowMessage(IntToStr(oZipMstr.ErrCode));
>     Exit;
>   end;
> 
>   
>   Result := True;
> 
> end;
> 
> //--------------------------------------------------------------------------------
> 
> function UNPACK(): boolean;                                    // VERSION A
> begin
> 
>   Result := False;
> 
>   oZipMstrTest := TZipMaster.Create(Form);
>   AutoFree(AF, oZipMstrTest);
> 
>   oZipMstrTest.ZipFileName := Self.Path + ZIP_FILENAME;
>   oZipMstrTest.ExtrBaseDir := 'C:\Temp';
>   oZipMstrTest.FSpecArgs.Add('*');
>   oZipMstrTest.ExtrOptions := oZipMstrTest.ExtrOptions + [ExtrDirNames];
>   oZipMstrTest.ExtrOptions := oZipMstrTest.ExtrOptions + [ExtrOverWrite]; 
>   oZipMstrTest.ExtrOptions := oZipMstrTest.ExtrOptions + [ExtrTest];  //  <-- 
>  JUST TESTING.
>   oZipMstrTest.OnMessage := Self._MessageNow;
>   ResultExtract := oZipMstrTest.Extract;                  // <--- Returns an 
> "8".
> 
>   if (ResultExtract <> 0) and
>     ShowMessage(IntToStr(ResultExtract));
>     Exit;
>   end;
> 
>   Result := True;
> 
> end;
> 
> //--------------------------------------------------------------------------------
> 
> function UNPACK(): boolean;                              // VERSION B
> begin
> 
>   Result := False;
> 
>   oZipMstrTest := TZipMaster.Create(Form);
>   AutoFree(AF, oZipMstrTest);
> 
>   oZipMstrTest.ZipFileName := Self.Path + ZIP_FILENAME;
>   oZipMstrTest.ExtrBaseDir := 'C:\Temp';
>   oZipMstrTest.FSpecArgs.Add('*');
>   oZipMstrTest.ExtrOptions := oZipMstrTest.ExtrOptions + [ExtrDirNames];
>   oZipMstrTest.ExtrOptions := oZipMstrTest.ExtrOptions + [ExtrOverWrite]; 
>   oZipMstrTest.OnMessage := Self._MessageNow;
>   ResultExtract := oZipMstrTest.Extract;                  // <--- Returns an 
> "0".
> 
>   if (ResultExtract <> 0) and
>     ShowMessage(IntToStr(ResultExtract));
>     Exit;
>   end;
> 
>   Result := True;
> 
> end;
> _______________________________
> 
> Ferran  (ferran@xxxxxxxxxx)
> 
> -----------
> To unsubscribe from this list, send an empty e-mail 
> message to:
>   delphizip-request@xxxxxxxxxxxxx 
> and put the word unsubscribe in the subject.
> 

-----------------------------------------
Email provided by http://www.ntlhome.com/


-----------------------------------------
Email provided by http://www.ntlhome.com/


-----------
To unsubscribe from this list, send an empty e-mail 
message to:
  delphizip-request@xxxxxxxxxxxxx 
and put the word unsubscribe in the subject.

Other related posts: