At positive offsets the VMT stores pointers to all user defined virtual methods.
I need to write some code to hook the VMT.
The way I do this is to get a pointer to a virtual method in an ancestor class.
Let's say: TCustomForm.ShowModal
. I then look up the offset in the VMT of TCustomForm
. With this offset in hand I go to TMyForm
and alter its VMT to point to the function I need.
I would like to generalize the approach and in order to do so I would like to know the total number of entries the VMT holds so I don't search past the end.
How do I obtain the size of the (user definable part of) the VMT?
Digging through the RTL source I think this is the way to get the count:
Feel free to correct me if needed.