Recent

Author Topic: .cvd ClamAV database compress  (Read 2767 times)

Turkeytmfounder

  • Newbie
  • Posts: 6
.cvd ClamAV database compress
« on: June 04, 2023, 09:16:31 am »
Can someone do this for me? I want this:  https://www.youtube.com/watch?v=0xKuVFaEUfY&t there 3 videos can someone finish this project for me? I'm from Turkey. Or someone can tell me how to add 3rd parties to project

Turkeytmfounder

  • Newbie
  • Posts: 6
Re: .cvd ClamAV database compress
« Reply #1 on: June 04, 2023, 08:56:29 pm »
unit unit3;

{$mode objfpc}{$H+}

interface

uses
  Windows, Messages, SysUtils, Classes, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Buttons, Menus, Interfaces, MD5, Variants, ZLib, ZStream, Tar;

type
  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    OpenDialog1: TOpenDialog;
    SelectDirectoryDialog1: TSelectDirectoryDialog;
    SpeedButton1: TSpeedButton;
    procedure Button1Click(Sender: TObject);
    procedure Label2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Label2Click(Sender: TObject);
var
  CVDFile: TMemoryStream;
  GZFile: TMemoryStream;
  TarFile: TMemoryStream;
  Tar: TTarArchive;
  TDir: TTarDirRec;
  DesFile: String;
  GZStream: TDecompressionStream;
begin
  CVDFile := TMemoryStream.Create;
  CVDFile.LoadFromFile(Edit1.Text);
  CVDFile.Position := 512;

  GZFile := TMemoryStream.Create;
  GZFile.CopyFrom(CVDFile, CVDFile.Size - 512);
  GZFile.Position := 0;

  TarFile := TMemoryStream.Create;
  GZStream := TDecompressionStream.Create(GZFile);
  try
    TarFile.CopyFrom(GZStream, GZStream.Size);
  finally
    GZStream.Free;
  end;
  TarFile.SaveToFile(ExtractFilePath(ParamStr(0)) +
    ExtractFileName(Edit1.Text) + '.tar');

  Tar := TTarArchive.Create(ExtractFilePath(ParamStr(0)) +
    ExtractFileName(Edit1.Text) + '.tar');
  try
    Tar.Reset;
    while Tar.FindNext(TDir) do
    begin
      DesFile := ExtractFilePath(ParamStr(0)) + TDir.Name;
      Tar.ReadFile(DesFile);
    end;
  except
    on Exception do
  end;
  Tar.Free;

  CVDFile.Free;
  GZFile.Free;
  TarFile.Free;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    Edit1.Text := OpenDialog1.FileName;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  CVDFile: TMemoryStream;
  GZFile: TMemoryStream;
  TarFile: TMemoryStream;
  Tar: TTarArchive;
begin
  try
    // Your code logic goes here
  except
    on E: Exception do
    begin
      ShowMessage('An exception occurred: ' + E.Message);
    end;
  end;
end;


end. I got this errors:  Hint: (11030) Start of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Hint: (11031) End of reading config file C:\lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 3.2.2 [2023/03/04] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
(1002) Target OS: Win64 for x64
(3104) Compiling project2.lpr
C:\Users\semae\OneDrive\Belgeler\project2.lpr(13,17) Hint: (5023) Unit "ZLibExGZ" not used in project2
C:\Users\semae\OneDrive\Belgeler\project2.lpr(13,27) Hint: (5023) Unit "ZLibEx" not used in project2
(9022) Compiling resource C:\Users\semae\OneDrive\Belgeler\lib\x86_64-win64\project2.obj
(9015) Linking C:\Users\semae\OneDrive\Belgeler\project2.exe
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: memcpy
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: memset
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: zcalloc
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: zcfree
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: z_errmsg
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Error: Undefined symbol: __ImageBase
C:\Users\semae\OneDrive\Belgeler\project2.lpr(29,1) Fatal: (10026) There were 6 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus\fpc\3.2.2\bin\x86_64-win64\ppcx64.exe returned an error exitcode

Onur2x

  • New Member
  • *
  • Posts: 35
Re: .cvd ClamAV database compress
« Reply #2 on: June 05, 2023, 03:47:26 am »
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,libtar,GZIPUtils;//https://www.gocher.me/GZIP 

type

  { TForm1 }

  TForm1 = class(TForm)
    Button2: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    Memo1: TMemo;
    OpenDialog1: TOpenDialog;
    SpeedButton1: TSpeedButton;
    procedure Button2Click(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    edit1.Text:=OpenDialog1.FileName;
  end;
end;


procedure TForm1.Button2Click(Sender: TObject);
var
  MemoryStream, GZipStream: TMemoryStream;
  str1, str2: string;
  StartTime, EndTime: QWord;
  i: integer;


  Tar: TTarArchive;
  TDir: TTarDirRec;
  DesFile: String;
begin
  StartTime := GetTickCount64();

  // load gzip file to memory stream
  MemoryStream := TMemoryStream.Create;
  MemoryStream.LoadFromFile(Edit1.Text);
  MemoryStream.Position:=512;
  memo1.lines.add('source size:' + IntToStr(MemoryStream.Size));


  // gzip memory stream
  GZipStream := TMemoryStream.Create;
  GZipStream.CopyFrom(MemoryStream,MemoryStream.size-512);


  StartTime := GetTickCount64();
  if unzipStream(GZipStream,MemoryStream) then
  begin
    EndTime := GetTickCount64();
    memo1.lines.add('ungzip ok: ' + IntToStr(EndTime - StartTime) + ' ms');
  end
  else
    memo1.lines.add('ungzip failed');
  memo1.lines.add('ungzip size:' + IntToStr(MemoryStream.Size));

  // save ungzip memory stream to file
  MemoryStream.SaveToFile(Edit1.Text+'.tar');


  Tar := TTarArchive.Create(ExtractFilePath(ParamStr(0)) +  ExtractFileName(Edit1.Text) + '.tar');
  try
    Tar.Reset;
    while Tar.FindNext(TDir) do
    begin
      DesFile := ExtractFilePath(ParamStr(0)) + TDir.Name;
      Tar.ReadFile(DesFile);
    end;
  except
    on Exception do
  end;
  Tar.Free;

  FreeAndNil(MemoryStream);
  FreeAndNil(GZipStream);
end;

end.

Turkeytmfounder

  • Newbie
  • Posts: 6
Re: .cvd ClamAV database compress
« Reply #3 on: June 08, 2023, 01:21:52 pm »
I run this program but didn't show any screen on this program. Bu programı çalıştırdım ama bir pencere açılmadı maalesef ama Türk görmek güzel.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5755
  • Compiler Developer
Re: .cvd ClamAV database compress
« Reply #4 on: June 08, 2023, 06:09:43 pm »
Please always use [code=pascal][/code]-tags to avoid the forum software potentially interpreting your code. Not to mention that it looks nicer then...

Onur2x

  • New Member
  • *
  • Posts: 35
Re: .cvd ClamAV database compress
« Reply #5 on: June 09, 2023, 08:14:34 am »
can't you compile the program i don't understand.I think you may need to reinstall lazarus. Due to the above errors. you may have installed it wrong. Can you compile an application with an empty form?

Turkeytmfounder

  • Newbie
  • Posts: 6
Re: .cvd ClamAV database compress
« Reply #6 on: June 09, 2023, 02:59:08 pm »
I installed Lazarus but when I start the program it doesn't show form1.

af0815

  • Hero Member
  • *****
  • Posts: 1379
Re: .cvd ClamAV database compress
« Reply #7 on: June 09, 2023, 05:49:18 pm »
Check the projectoptions if it is in the automatic created forms.
regards
Andreas

Turkeytmfounder

  • Newbie
  • Posts: 6
Re: .cvd ClamAV database compress
« Reply #8 on: June 14, 2023, 01:57:47 pm »
Ekran hiç gözükmüyor. Onur. It doesn't show a anything Onur.

Turkeytmfounder

  • Newbie
  • Posts: 6
Re: .cvd ClamAV database compress
« Reply #9 on: June 16, 2023, 04:09:42 pm »
This code worked on Linux dd if=clam.cvd of=clam.tar.gz bs=512 skip=1.

 

TinyPortal © 2005-2018