[delphizip] Question: Detect ZIP data using QueryZip

  • From: Daniel Marschall <uni@xxxxxxxxxxxxxxxxxxx>
  • To: delphizip@xxxxxxxxxxxxx
  • Date: Sun, 3 Oct 2010 19:12:08 +0200

Hello.

I need a function that checks if a file has ZIP-data and is (probably) 
extractable. I want to allow ZIP-SFXs and native ZIP files.

Here is my current function:


function IsExtractable(AFilename: string): boolean;
var
  q: integer;
  uz: TZipMaster19;
begin
  uz := TZipMaster19.Create(nil);
  try
    q := uz.QueryZip(AFilename);
    result := true;
    if (q and zqbHasLocal) <> zqbHasLocal then result := false;
    if (q and zqbHasCentral) <> zqbHasCentral then result := false;
    if ((q and zqbHasEOC) <> zqbHasEOC) and
       ((q and zqbHasEOC64) <> zqbHasEOC64) then result := false;
  finally
    uz.Free;
  end;
end;


My questions:
- In a ZIP64 file (I never had used one), is zqbHasEOC64 available and 
zqbHasEOC not? Or are both bits, zqbHasEOC and zqbHasEOC64 set?
- If zqbHasEOC64 is set, is zqbHasLoc64 then required too?
- Any suggestions how to improve that function?

Regards
Daniel Marschall


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