Re[3]: Список методов из VMT
От: Danchik Украина  
Дата: 10.05.05 10:47
Оценка:
Здравствуйте, Аноним, Вы писали:

Что то типа этого ?

procedure GetMethodNames(aClass: TClass; List: TStrings);
type
  TMethodTable = packed record
    Count: SmallInt;
  //[...methods...]
  end;
var
  aTable : ^TMethodTable;
  aName  : ^ShortString;
  K      : Integer;
begin
  List.BeginUpdate;
  try
    while aClass <> nil do
    begin
      asm
        mov  EAX, [aClass]
        mov  EAX,[EAX].vmtMethodTable { fetch pointer to method table }
        mov  [aTable], EAX
      end;
      if aTable <> nil then
      begin
        aName  := Pointer(PChar(aTable) + 8);
        for K := 1 to aTable.Count do
        begin
          if List.IndexOf (aName^) < 0 then
            List.Add (aName^);
          aName := Pointer(PChar(aName) + length(aName^) + 7)
        end;
      end;
      aClass := aClass.ClassParent;
    end;
  finally
    List.EndUpdate;
  end;
end;


Учти, работает только в случае когда метод published
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.