Hi...
I was looking over the script documentation and two of the objects/classes looked interesting but i'm not sure what they do.
TIntelRecord and TVMProcedure... what are these and how are they used? Can you give us more information about what these classes are and what they their methods can do?
Thanks!
TIntelRecord and TVMProcedure Usage?
All properties and methods of this classes is specified in help file on page "VMProtect classes". How you can use this classes - see examples in folder "Examples\Scripts".
Code from "Examples\Scripts\VMClasses\Project1.vms":
Code from "Examples\Scripts\VMClasses\Project1.vms":
Code: Select all
procedure OnBeforeCompilation;
var I,J,K: Integer;
FileName,S: String;
P: TVMProcedure;
Lines: TStringList;
begin
Lines:=TStringList.Create;
try
for K:=0 to VMProtector.Count-1 do
begin
P:=VMProtector.Procedures[K];
Lines.Add('//');
Lines.Add('// procedure '+P.Name);
if P.IncludedInCompilation then S:='True'
else S:='False';
Lines.Add('// IncludedInCompilation = '+S);
case P.CompilationType of
ctMutation: S:='Mutation';
ctVirtualization: S:='Virtualization';
ctUltra: S:='Ultra';
else
S:='Unknown';
end;
Lines.Add('// CompilationType = '+S);
case P.CodeType of
otCode: S:='Code';
otMarker: S:='Marker';
otString: S:='String';
else
S:='Unknown';
end;
Lines.Add('// CodeType = '+S);
Lines.Add('//');
for I:=0 to P.Count-1 do
with P.Records[I] do
begin
S:='';
for J:=0 to DumpLength-1 do
S:=S+Format('%.2x',[Dump[J]]);
while Length(S)<24 do
S:=S+' ';
Lines.Add(Format('%.8x %s %s',[Address,S,CommandText]));
end;
end;
FileName:=ChangeFileExt(VMProtector.InputFileName,'.txt');
Lines.SaveToFile(FileName);
finally
Lines.Free;
end;
MsgBox('Functions are saved in file:'#13+FileName,'VMProtect Script',MB_OK or MB_ICONINFORMATION);
end;
-
- Posts: 6
- Joined: Fri Sep 19, 2008 3:24 pm
Code from "Examples\Scripts\UseExtMarkers\Project1.vms":lostpotential wrote:What about TIntelRecord.ReadFromFile... how exactly does this work and what does it do?
Code: Select all
procedure OnBeforeCompilation;
var R:TIntelRecord;
CompilationType:TCompilationType;
Ptr:Int64;
I:Integer;
S:String;
begin
R:=TIntelRecord.Create(nil);
with VMProtector do
for I:=0 to InputFile.MapRecords.Count-1 do
with InputFile.MapRecords.Items[I] do
if CodeType=otMarker then
begin
Ptr:=Address+$12; // $12 - size of VMProtectBegin
R.ReadFromFile(InputFile,Ptr);
S:=R.CommandText;
if S='lea eax, [eax]' then
CompilationType:=ctMutation
else
if S='lea ebx, [ebx]' then
CompilationType:=ctUltra
else
CompilationType:=ctVirtualization;
AddByAddress(Address,CompilationType,True);
end;
R.Free;
end;