Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Howdy All,

I want to use VMProtect's Markers to mark blocks of the code containing string constants that should be protected.
PHP
uses VMProtectSDK;

VMProtectBegin(MARKER_NAME);
...
VMProtectEnd;

// DELPHI FUNCTION EXAMPLE :

procedure TForm1.Button1Click(Sender: TObject);
begin
 VMProtectBegin('Test marker');
 if StrToIntDef(Edit1.Text, 0) mod 17=13 then
  MessageDlg(VMProtectDecryptStringA('Correct password'), mtInformation, [mbOK], 0)
 else
  begin
   MessageDlg(VMProtectDecryptStringA('Incorrect password'), mtError, [mbOK], 0);
   Edit1.SetFocus;
  end;
 VMProtectEnd;
end;
I tried to implement it :
PHP
procedure TForm1.IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
var Payload, Host, Header, Krypt1, Krypt2:String;
begin
VMProtectBegin
('Krypt1 := EncryptString('website.com', 'pwd');'+sLineBreak+
 'Krypt2 := EncryptString('website.net', 'pwd');');
VMProtectEnd;
  if (pos('CONNECT',athread.NetData)<>0) or (pos('HTTP',athread.NetData)<>0) then begin
      if host.Text = 'Host' then begin
          Payload := 'GET http://'+Krypt1+'/ HTTP/1.1'+#13#10;
          Host := AddHeader(AThread.NetData,'Host: '+Krypt2+''#13#10);
          AThread.NetData := Payload+Host;
          end;
      end;
  end;
But I got some errors:
XML
[Error] Unit1.pas(xxx): ')' expected but identifier 'website' found
[Error] Unit1.pas(xxx): Missing operator or semicolon
[Error] Unit1.pas(xxx): Missing operator or semicolon
[Error] Unit1.pas(xxx): Missing operator or semicolon
[Error] Unit1.pas(xxx): Statement expected, but expression of type 'String' found
[Error] Unit1.pas(xxx): ';' expected but 'IF' found
[Error] Unit1.pas(xxx): Undeclared identifier: 'host'
[Error] Unit1.pas(xxx): Undeclared identifier: 'Payload'
[Error] Unit1.pas(xxx): Undeclared identifier: 'Krypt2'
[Error] Unit1.pas(xxx): Undeclared identifier: 'Host'
[Error] Unit1.pas(xxx): Undeclared identifier: 'AThread'
[Error] Unit1.pas(xxx): 'END' expected but ',' found
[Error] Unit1.pas(xxx): '.' expected but ';' found
[Error] Unit1.pas(xxx): Identifier redeclared: 'Finalization'
[Error] Unit1.pas(xxx): Incompatible types: 'String' and 'Integer'
[Error] Unit1.pas(xxx): Not enough actual parameters
[Warning] Unit1.pas(xxx): Text after final 'END.' - ignored by compiler
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
Also, tried :
C#
VMProtectBegin(nil);
Krypt1 := EncryptString('website.com', 'pwd');
Krypt2 := EncryptString('website.net', 'pwd');
VMProtectEnd;
Althought, no error found, but VMProtect unable to hide and protect my string.

How to resolve this problem ? and I asking you to teach me how to write the line of code.

I would appreciate any help.

Cheers,
J
Posted
Updated 1-Apr-15 12:37pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900