procedure TForm1.Button1Click(Sender: TObject);
var
nthookscript: Tstringlist;
begin
nthookscript:=nil;
nthookscript:=tstringlist.create;
nthookscript.add(VMProtectDecryptStringA(('teststring0000')));
nthookscript.add(VMProtectDecryptStringA(('teststring0001')));
nthookscript.add(VMProtectDecryptStringA(('teststring0002')));
nthookscript.clear;
nthookscript.free;
end;
teststring0000,teststring0001,teststring0002 -> memory data string delete!!
VMProtectFreeString?
Does using VMProtectFreeString in Delphi initialize memory?
How do I use it in my TStringList example?
I want to delete string data from memory
delphi VMProtectDecryptStringA memory clean?
-
- Posts: 3
- Joined: Thu Oct 28, 2021 7:09 am
Re: delphi VMProtectDecryptStringA memory clean?
Code: Select all
str1 = VMProtectDecryptStringA('teststring0000');
str2 = VMProtectDecryptStringA('teststring0001');
str3 = VMProtectDecryptStringA('teststring0002');
...
nthookscript:=tstringlist.create;
nthookscript.add(str1);
nthookscript.add(str2);
nthookscript.add(str3);
nthookscript.clear;
nthookscript.free;
...
VMProtectFreeString(str1);
VMProtectFreeString(str2);
VMProtectFreeString(str3);
-
- Posts: 3
- Joined: Thu Oct 28, 2021 7:09 am
Re: delphi VMProtectDecryptStringA memory clean?
procedure TForm1.Button1Click(Sender: TObject);
var
nthookscript: Tstringlist;
str1 : string;
str2 : string;
str3 : string;
begin
showmessage('1');
str1 := VMProtectDecryptStringA('teststring0000');
str2 := VMProtectDecryptStringA('teststring0001');
str3 := VMProtectDecryptStringA('teststring0002');
nthookscript:=nil;
nthookscript:=tstringlist.create;
nthookscript.add(str1);
nthookscript.add(str2);
nthookscript.add(str3);
nthookscript.clear;
nthookscript.free;
showmessage('2');
VMProtectFreeString(@str1);
VMProtectFreeString(@str2);
VMProtectFreeString(@str3);
end;
https://i.ibb.co/dfmz40P/no-clean.png
Lazarus test.
Declare a variable and search the memory string after packing
Memory uninitialized after showmessge(2)
var
nthookscript: Tstringlist;
str1 : string;
str2 : string;
str3 : string;
begin
showmessage('1');
str1 := VMProtectDecryptStringA('teststring0000');
str2 := VMProtectDecryptStringA('teststring0001');
str3 := VMProtectDecryptStringA('teststring0002');
nthookscript:=nil;
nthookscript:=tstringlist.create;
nthookscript.add(str1);
nthookscript.add(str2);
nthookscript.add(str3);
nthookscript.clear;
nthookscript.free;
showmessage('2');
VMProtectFreeString(@str1);
VMProtectFreeString(@str2);
VMProtectFreeString(@str3);
end;
https://i.ibb.co/dfmz40P/no-clean.png
Lazarus test.
Declare a variable and search the memory string after packing
Memory uninitialized after showmessge(2)
Re: delphi VMProtectDecryptStringA memory clean?
Look at the declaration of VMProtectDecryptStringA more curefully:
It seems you don't know what differences between String and PAnsiChar. Here is the correct code:
Code: Select all
function VMProtectDecryptStringA(Value: PAnsiChar): PAnsiChar; {$IFDEF MSWINDOWS} stdcall {$ELSE} cdecl {$ENDIF};
Code: Select all
str1 : PAnsiChar;
str2 : PAnsiChar;
str3 : PAnsiChar;
...
VMProtectFreeString(str1);
VMProtectFreeString(str2);
VMProtectFreeString(str3);
-
- Posts: 3
- Joined: Thu Oct 28, 2021 7:09 am
Re: delphi VMProtectDecryptStringA memory clean?
PAnsiChar -> memory clean success
thank you
thank you