Jhosef,

A ZLib nao funciona com o WinZip ou WinRar, parece que tem uma forma 
propria de compactacao.
Por isso que nao optei por usar esta library, mas para quem se interessa 
ai vai uma dica:

procedure TForm1.CompressFiles(Files : TStrings; const Filename : String);
var
   InFile, OutFile, TmpFile : TFileStream;
   Compr : TCompressionStream;
   I, L : Integer;
   S : String;
begin
   if Files.Count > 0 then
   begin
     OutFile := TFileStream.Create(Filename,fmCreate);
     try
       { the number of files }
       L := Files.Count;
       OutFile.Write(L,SizeOf(L));
       for I := 0 to Files.Count-1 do
       begin
         InFile := TFileStream.Create(Files[I],fmOpenRead);
         try
           { the original filename }
           S := ExtractFilename(Files[I]);
           L := Length(S);
           OutFile.Write(L,SizeOf(L));
           OutFile.Write(S[1],L);
           { the original filesize }
           L := InFile.Size;
           OutFile.Write(L,SizeOf(L));
           { compress and store the file temporary}
           TmpFile := TFileStream.Create('tmp',fmCreate);
           Compr := TCompressionStream.Create(clMax,TmpFile);
           try
             Compr.CopyFrom(InFile,L);
           finally
             Compr.Free;
             TmpFile.Free;
           end;
           { append the Compressed file to the destination file }
           TmpFile := TFileStream.Create('tmp',fmOpenRead);
           try
             OutFile.CopyFrom(TmpFile,0);
           finally
             TmpFile.Free;
           end;
         finally
           InFile.Free;
         end;
       end;
     finally
       OutFile.Free;
     end;
     DeleteFile('tmp');
   end;
end;

procedure TForm1.DecompressFiles(const Filename, DestDirectory : String);
var
   Dest,S: String;
   Decompr: TDecompressionStream;
   InFile, OutFile: TFilestream;
   I,L,C: Integer;
begin
   Dest   := IncludeTrailingPathDelimiter(DestDirectory);
   InFile := TFileStream.Create(Filename,fmOpenRead);
   try
     { number of files }
     InFile.Read(C,SizeOf(C));
     for I := 1 to C do
     begin
       { read filename }
       InFile.Read(L,SizeOf(L));
       SetLength(S,L);
       InFile.Read(S[1],L);
       { read filesize }
       InFile.Read(L,SizeOf(L));
       { Decompress the files and store it }
       S := Dest+S; //include the path
       OutFile := TFileStream.Create(Dest+S,fmCreate);
       Decompr := TDecompressionStream.Create(InFile);
       try
         OutFile.CopyFrom(Decompr,L);
       finally
         OutFile.Free;
         Decompr.Free;
       end;
     end;
   finally
     InFile.Free;
   end;
end;

Obrigado.
MuriloCunha



On 05/05/2010 10:36, Jhosef Marks wrote:
> E ai galera, é o seguinte...
>
> Com a Zlib do delphi eu consegui compactar um arquivo, mas não consigo
> descompacta-lo com o Winzip ou Winrar...
>
> Já procurei na lista e no google alguma forma de fazer isso sem componentes
> ou bibliotecas de terceiro, quero usar apenas o ZLIB nativo do delphi e mais
> nada.
>
> Estou usando o Delphi 2010.
>
> Isso é possível????
>
> Att,
>
> Jhosef Marks de Carvalho
> Blog: http://www.jhosefmarks.com.br
> Jesus está voltando
>
> "E se o meu povo, que se chama pelo meu nome, se humilhar, e orar, e buscar
> a minha face e se converter dos seus maus caminhos, então eu ouvirei dos
> céus, e perdoarei os seus pecados, e sararei a sua terra." (2 Cr 7:14)
>
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>
>
> ------------------------------------
>
>    

Responder a