Skip to content

Instantly share code, notes, and snippets.

@ritalin
Last active December 18, 2015 18:59
Show Gist options
  • Save ritalin/5829274 to your computer and use it in GitHub Desktop.
Save ritalin/5829274 to your computer and use it in GitHub Desktop.
List publish method for Delphi
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.
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