Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7075549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:11:27+00:00 2026-05-28T06:11:27+00:00

I have ZipForge for Delphi XE2 & Delphi XE2. I try to test any

  • 0

I have ZipForge for Delphi XE2 & Delphi XE2.

I try to test any invalid zip archives (e.g. not fully downloaded) like in their demo:

procedure TfmMain.bnStartClick(Sender: TObject);
begin
  with Archiver do
  begin
    FileName := 'c:\2.zip';
    OpenArchive;
    try
      TestFiles('*.*');
    except
      MessageDlg('Errors occurred in the archive file', mtError, [mbOk], 0);
    end;
    CloseArchive;
  end;
end;

But my exception doesn’t fire; ZipForge’s dialog fires instead of mine.

I tried Abbrevia Component but it even can’t recognize if an archive is invalid…

Please help me to make my exception working (not ZipForge’s one) or suggest me a better component for zip files with a test feature. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:11:27+00:00Added an answer on May 28, 2026 at 6:11 am

    Be aware that you can modify ZIP files, e.g. by truncating them somewhat, the ZIP file will still be valid. With my test file, I removed the final 5000 bytes and it was reported as valid. I extracted it successfully using my ZIP program. Of course the extracted contents were incorrect and not the original contents. Perhaps this is what was happening for you. Maybe your attempts to corrupt your ZIP file were not in fact making it into an invalid ZIP file.

    Delphi XE2 comes with a built in ZIP component that worked well in my simple test and successfully detected an invalid file, once I had truncated the file enough to make it truly corrupt.

    I used the IsValid method to check validity. Here is my very simple test program.

    program ZipTest;
    
    {$APPTYPE CONSOLE}
    
    uses
      System.SysUtils, System.Zip;
    
    procedure Main;
    const
      ZipArchive = 'C:\desktop\test.zip';
    var
      ZipFile: TZipFile;
      FileName: string;
    begin
      ZipFile := TZipFile.Create;
      try
        if ZipFile.IsValid(ZipArchive) then begin
          ZipFile.Open(ZipArchive, zmRead);
          for FileName in ZipFile.FileNames do begin
            Writeln(FileName);
          end;
        end else begin
          Writeln(ZipArchive + ' not valid');
        end;
      finally
        ZipFile.Free;
      end;
    end;
    
    begin
      try
        Main;
        Readln;
      except
        on E: Exception do begin
          Writeln(E.ClassName, ': ', E.Message);
        end;
      end;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following files: C:\item1\item11\item1.xls C:\item1\item12\item11.xls If I follow this code: ZipForge zip
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution
There are many questions on zipping in Delphi, anyway this is not a duplicate.
have some headers like: HTTP/1.1 100 Continue HTTP/1.1 302 Found HTTP/1.1 200 OK HTTP/1.1
Have advancements in CPU design like dynamic instruction scheduling narrowed the performance gap between
Have any one tried to activate fancybox thumbnail gallery using a button or an
Have their been any studies related to the importance of how good a software
Have you any idea how to find out if spell check suggestions dialog is
Have a xml data like <Items><Item><name>test1</name></Item><Item><name>test2</name></Item></Items> Looks like jaxb cannot unmashall this when defining

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.