Last active
December 18, 2015 18:59
-
-
Save ritalin/5829274 to your computer and use it in GitHub Desktop.
List publish method for Delphi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program Project1; | |
uses | |
TestClass in 'TestClass.pas'; | |
{$APPTYPE CONSOLE} | |
type | |
TMethodTable = packed record | |
Count: smallint; | |
Reserved1: array[0..5] of byte; | |
Data: char; | |
end; | |
var | |
ref: TClass; | |
table: ^TMethodTable; | |
i: integer; | |
buf: ^ShortString; | |
begin | |
ref := TTestClass; | |
asm | |
mov EAX, [ref] | |
mov EAX,[EAX].vmtMethodTable | |
mov [table], EAX | |
end; | |
buf := @table.Data; | |
for i := 1 to table.Count do begin | |
Writeln(buf^); | |
buf := Pointer(PChar(buf) + (Length(buf^)+1)+6); | |
end; | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit TestClass; | |
interface | |
type | |
TTestClass = class | |
public | |
procedure MethA; | |
published | |
procedure MethPA; | |
procedure MethPB; | |
procedure MethPC; | |
end; | |
implementation | |
procedure TTestClass.MethPA; | |
begin | |
end; | |
procedure TTestClass.MethPB; | |
begin | |
end; | |
procedure TTestClass.MethPC; | |
begin | |
end; | |
procedure TTestClass.MethA; | |
begin | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment