How to get the entire code of a method in memory so I can calculate its hash at runtime?
Posted
by bejo
on Stack Overflow
See other posts from Stack Overflow
or by bejo
Published on 2010-05-13T07:40:13Z
Indexed on
2010/05/13
7:44 UTC
Read the original article
Hit count: 166
Hello stackoverflow,
How to get the entire code of a method in memory so I can calculate its hash at runtime?
I need to make a function like this:
type
TProcedureOfObject = procedure of object;
function TForm1.CalculateHashValue (AMethod: TProcedureOfObject): string;
var
MemStream: TMemoryStream;
begin
result:='';
MemStream:=TMemoryStream.Create;
try
//how to get the code of AMethod into TMemoryStream?
result:=MD5(MemStream); //I already have the MD5 function
finally
MemStream.Free;
end;
end;
I use Delphi 7.
Thank you.
© Stack Overflow or respective owner