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

  • From: "Ferran Artero (Grupo 77)" <ferran@xxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Wed, 19 Jan 2005 11:28:50 +0100

  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.

Other related posts: