Delphi problem reading EOF after protecting with VMP

Issues related to VMProtect
Post Reply
google000
Posts: 6
Joined: Sat Jan 10, 2015 9:38 am

Delphi problem reading EOF after protecting with VMP

Post by google000 »

Hello, Im using some code to read EOF data, im using delphi, before protection with VMProtect this sample code works, but after protection with packing and only with packing option it doest not work..admin can you help me ?

with all option checked in vmprotect without using packing .. this code works but with packing doest not work.

this is code my with im using to read eof data

Code: Select all

function ReadFile(FileName: String): AnsiString;
var
  F             :File;
  Buffer        :AnsiString;
  Size          :Integer;
  ReadBytes     :Integer;
  DefaultFileMode:Byte;
begin
  Result := '';
  DefaultFileMode := FileMode;
  FileMode := 0;
  AssignFile(F, FileName);
  Reset(F, 1);

  if (IOResult = 0) then
  begin
    Size := FileSize(F);
    while (Size > 1024) do
    begin
      SetLength(Buffer, 1024);
      BlockRead(F, Buffer[1], 1024, ReadBytes);
      Result := Result + Buffer;
      Dec(Size, ReadBytes);
    end;
    SetLength(Buffer, Size);
    BlockRead(F, Buffer[1], Size);
    Result := Result + Buffer;
    CloseFile(F);
  end;

  FileMode := DefaultFileMode;
end;          

Code: Select all

function ReadEof(Delimit1, Delimit2 :String) :String;
var
  Buffer      :AnsiString;
  ResLength   :Integer;
  i           :Integer;
  PosDelimit  :Integer;
begin
  Buffer := ReadFile(ParamStr(0));
  if Pos(Delimit1, Buffer) > Pos(Delimit2, Buffer) then
    PosDelimit := Length(Buffer)-(Pos(Delimit1, Buffer)+Length(Delimit1))
  else PosDelimit := Length(Buffer)-(Pos(Delimit2, Buffer)+Length(Delimit2));
  Buffer := Copy(Buffer, (Length(Buffer)-PosDelimit), Length(Buffer));
  ResLength := Pos(Delimit2, Buffer)-(Pos(Delimit1, Buffer)+Length(Delimit1));
  for i := 0 to (Reslength-1) do
    Result := Result+Buffer[Pos(Delimit1, Buffer)+(Length(Delimit1)+i)];
end;              
thank you admin, I'm licensed user of VMProtect.
Admin
Site Admin
Posts: 2584
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Delphi problem reading EOF after protecting with VMP

Post by Admin »

As I understand your program reads own executable file:

Code: Select all

Buffer := ReadFile(ParamStr(0));
So after packing you can not find Delimit1 and Delimit2 in the buffer.
google000
Posts: 6
Joined: Sat Jan 10, 2015 9:38 am

Re: Delphi problem reading EOF after protecting with VMP

Post by google000 »

yes exactly :)
Admin
Site Admin
Posts: 2584
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Delphi problem reading EOF after protecting with VMP

Post by Admin »

In this case I don't understand what is the problem :))
google000
Posts: 6
Joined: Sat Jan 10, 2015 9:38 am

Re: Delphi problem reading EOF after protecting with VMP

Post by google000 »

the problem is that I dont know how to modify this code to work...can you help me ?
Admin
Site Admin
Posts: 2584
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Delphi problem reading EOF after protecting with VMP

Post by Admin »

Please look at this again:
Buffer := ReadFile(ParamStr(0));
It means that you find data in your executable file. After packing of your executable file your code can not find any delimiters because the data in your executable file is packed.

For example: you have a program test.exe, that contains "MY_MEGA_STRING". After packing with VMProtect you have test.vmp.exe but this file doesn't contain "MY_MEGA_STRING" because "MY_MEGA_STRING" was transformed into packed data "XXXXXX". If you want to find "MY_MEGA_STRING" in unpacked data you need to work with memory instead of the packed file.
google000
Posts: 6
Joined: Sat Jan 10, 2015 9:38 am

Re: Delphi problem reading EOF after protecting with VMP

Post by google000 »

thank you admin for help, but I know that ! the problem is that eof data is not packed, but it still can't find those delimiters if program is protected and packed with vmprotect (eof data at the end is added after encryption, packing with vmprotect and is not packed).
Post Reply