[delphizip] Re: Error in spanned files

  • From: "R. Peters" <russellpeters@xxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Sat, 21 Aug 2004 10:56:54 +1000

Found the problem (at least I think I have)

In the file ZMaster.pas
in the function TZMaster.List
(at about line 661)

  Result := fErrCode;

  if not Active then
  begin
    FDelaying := FDelaying + [zdiList];
    exit;
  end;

{$IFNDEF NO_SPAN}
  // Locate last of multi volume or last disk of split
  r := GetLastVolume(FZipFileName, EOC, TRUE);
  if r < 0 then
    exit;                                   // error exception should been
thrown when detected
  if r = 1 then // Don't complain - this may intentionally be a new zip
file.
{$ELSE}
  if (FZipFileName = '') or not FileExists(FZipFileName) then
{$ENDIF}
  begin                                     { let user's program know
there's no entries }
    if Assigned(FOnDirUpdate) then
      FOnDirUpdate(Owner);
    Exit;
  end;

  FInfileName := FZipFileName;
  FDrive := ExtractFileDrive(ExpandFileName(FInFileName)) + '\';
  FDriveFixed := IsFixedDrive(FDrive);
  GetDriveProps;

{$IFDEF NO_SPAN}

the lines

  FInfileName := FZipFileName;
  FDrive := ExtractFileDrive(ExpandFileName(FInFileName)) + '\';
  FDriveFixed := IsFixedDrive(FDrive);
  GetDriveProps;
need to be moved to before r:= GetLastVolume

  Result := fErrCode;

  if not Active then
  begin
    FDelaying := FDelaying + [zdiList];
    exit;
  end;

// the 4 moved lines
  FInfileName := FZipFileName;
  FDrive := ExtractFileDrive(ExpandFileName(FInFileName)) + '\';
  FDriveFixed := IsFixedDrive(FDrive);
  GetDriveProps;

{$IFNDEF NO_SPAN}
  // Locate last of multi volume or last disk of split
  r := GetLastVolume(FZipFileName, EOC, TRUE);
  if r < 0 then
    exit;                                   // error exception should been
thrown when detected
  if r = 1 then // Don't complain - this may intentionally be a new zip
file.
{$ELSE}
  if (FZipFileName = '') or not FileExists(FZipFileName) then
{$ENDIF}
  begin                                     { let user's program know
there's no entries }
    if Assigned(FOnDirUpdate) then
      FOnDirUpdate(Owner);
    Exit;
  end;

// these 4 lines moved
//  FInfileName := FZipFileName;
//  FDrive := ExtractFileDrive(ExpandFileName(FInFileName)) + '\';
//  FDriveFixed := IsFixedDrive(FDrive);
//  GetDriveProps;

{$IFDEF NO_SPAN}

The problem was that GetLastVolume puts it's name into FInFileName but this
was being reset, causing it to truncated and the number added - of course it
did not exist.
Hope this fixes the problem. (it did on mine).
Will prepare an update soon.
- Russell Peters

----- Original Message ----- 
From: "Alfeu Marcatto" <alfeu@xxxxxxxxxxxxxx>
To: <delphizip@xxxxxxxxxxxxx>
Sent: Saturday, August 21, 2004 7:42 AM
Subject: [delphizip] Re: Error in spanned files


I think that I understood part of the problem.

The error occur in ZMaster.pas in
    procedure TZMaster.CreateMVFileName(var FileName: string;
StripPartNbr: Boolean);

During Central Directory build CreateMVFileName is called twice by
       function TZMaster.IsRightDisk: Boolean;
First:  CreateMVFileName('F:\Temp\Teste2.zip', True)
         then the error occur because stripPartNbr is not necessary.
    In CreateMVFileName the routine below extract the extension of file
name and also striplen (6 characteres and not 3)
        FileName := Copy(FileName, 1, length(FileName) -
          Length(ExtractFileExt(FileName)) - StripLen) +
          Copy(IntToStr(1001 + FDiskNr), 2, 3) + ExtractFileExt(FileName);
    then filename = F:\Temp\Tes007.zip
Second: CreateMVFileName('F:\Temp\Teste2007.zip', True)
    this is correct because is necessary extract 6 characteres then
    FileName = Teste2.zip

I change the first striplen to 0 and the error not occur.
Winzip don't expand but ZipMaster expand correctly.

IsRightDisk is called twice by
    procedure TZMaster.GetNewDisk(DiskSeq: Integer);
    First to DiskSeq = 6 (Copy(IntToStr(1001 + FDiskNr) change to 007)
    Second to DiskSeq = 7 (Copy(IntToStr(1001 + FDiskNr) change to 008)

This both files have part of Central Directory.

I answer your questions below.

Alfeu

Roger Aelbrecht wrote:

>Roger Aelbrecht wrote:
>
>
>>Alfeu,
>>
>>I think I could manage to have the same kind of error as you did
>>For now it is not necessary to send me the files.
>>I will try to find out what is wrong and how to solve it.
>>
>>
>>
>
>Unfortunately the error I found is in a peace of code that is only in
>ZipBuilder not in ZipMaster so I still could not reproduce your problem.
>
>To help us is it possible for you to go in debug mode.
>The error you show should normally produce an exception and it would
>help a lot to know at what line that exception is thrown.
>I don't use Delphi so I cannot tell you how to do it.
>
>
>
procedure TZMaster.GetNewDisk(DiskSeq: Integer);
        raise EZipMaster.CreateResDisp(DS_NoInFile, TRUE)

>2nd question, after the files are created ( whit error), if you start
>a new process and set the file name to Test 2.zip.
>Does it show an error?
>
>
>
Yes. Same error.

>Can you do an extract/test on this file with ZipMaster?
>If extract/test works then nothing is wrong with the archive.
>
>
>
Yes. The extract is ok.

>3rd sorry for asking the same thins again but I want to be sure that we
>got the correct information.
>
>>From what I read from all your posting you use as ZipFileName
>FMain.ZipMaster1.ZipFileName := 'F:\Temp\Teste 2.zip';
>
>and you get the error, from you message as
>
>Teste 2 - ERRO 0: Copying: Central Directory
>Teste 2 - ERRO 0: Trace : GetNewDisk Opening: F:\Temp\Test007.zip
>(F:\Temp is the destination directory)
>Teste 2 - ERRO 11001: Input file does not exist
>
>Is the file name F:\Temp\Test007.zip the correct name in the message?
>
>
>
See above

>Did ZipMaster create files with names 'Teste 2001.zip' to 'Teste 2008.zip'
?
>
>If all the above filenames are correct we need to find out why ZipMaster is
>looking for 'Test007.zip' were it should look for 'Teste 2007.zip'
>
>
>
>
I did the test with 'Teste2.zip'

>Roger Aelbrecht
>http://home.tiscali.be/driehoeksw
>
>-----------
>To unsubscribe from this list, send an empty e-mail
>message to:
>  delphizip-request@xxxxxxxxxxxxx
>and put the word unsubscribe in the subject.
>
>
>

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



-- 
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.262 / Virus Database: 264.6.4 - Release Date: 19/08/2004

-----------
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: