[delphizip] Re: Some improvement suggestions and a SFX freeze bug

  • From: Daniel Marschall <uni@xxxxxxxxxxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Fri, 24 Sep 2010 07:23:42 +0200

I figured it out. Here is the code that brings behavior "Warn on Cutted-Zip, do 
not warn on Zip with garbage):

if i + SizeOf(TZipEndOfCentral) + clen <> Size then
begin
  File_Size := File_Size + ((i + SizeOf(TZipEndOfCentral) + clen) - Size);
  if i + SizeOf(TZipEndOfCentral) + clen > Size then
  begin
    Result := EOCBadComment; // Comment was cut from ZIP file!
  end;
end;

Is that OK?


On Thu, 23 Sep 2010 15:55:17 +0200, Daniel Marschall <uni@xxxxxxxxxxxxxxxxxxx> 
wrote:
> Mh, that's a bit confusing to me, since this fix ">" instead of "<>" came
> from you. The "(ErrCode <> DS_CECommentLen)" is a quick fix, but then
> ZipMaster would not even warn on a cutted comment (which is actually a
> incomplete ZIP). I think, we should find a solution where DelphiZip warn
> resp. sending error codes when comment is cut, but does not warn if comment
> is longer than expected (garbage). Is that possible?
> 
> On Thu, 23 Sep 2010 18:54:55 +1000, R Peters <rpeters@xxxxxxxxxxxxx>
> wrote:
>> I keep forgetting that the correction needs to be done.
>> Explanation - in the early sfx days the zip file was just appended to
> the
>> sfx stub which meant that all file offsets were wrong (it still is
> written
>> after the stub but now all offsets are correct) - to correct for this
> the
>> position of the central directory is calculated relative to the EOC
>> position
>> which is assumed to be the end of the file.
>> You need to remove that 'fix' for detecting 'garbage' and ignore the
>> warning
>> message.
>> I presume you do not have Unattended := True; so the warnings are giving
>> to
>> a dialog box which is annoying.
>> For this version it is probably best that warnings don't give a dialog
> box
>> -
>> this can best be done with a simple change (should be in next build)
>>
>> In ZMCore19.pas
>> procedure TZMCore.ShowMsg(const msg: TZMString; err: Integer; display:
>> Boolean);
>> begin
>>   FErrMessage := msg;
>>   if err < 0 then
>>     fFErrCode := -err
>>   else
>>     fFErrCode := err;
>>   if display and (not fUnattended) and (ErrCode <> GE_Abort) and
>>     (ErrCode <> DS_Canceled) and (ErrCode <> DS_CECommentLen) then
>>     ZipMessageDlg(msg, zmtInformation + DHC_ZipMessage);
>>
>>   ReportMessage(ErrCode, msg);
>> end;
>>
>> On line 1038 the extra condition 'and (ErrCode <> DS_CECommentLen)' has
>> been
>> added.
>>
>> I am (now) looking at better filtering of errors/warnings but that will
> be
>> in the next version which I am currently trying to work on.
>> Russell Peters
>>
> 
> -----------
> 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.

Other related posts: