You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vtables are (I trimmed the RTTI because it's unavailable):
-----------------------------------------------------------------------------------
0x0: Base::~Base;
0x4: nullptr; // pure virtual function with no implementation
-----------------------------------------------------------------------------------
0x0: FirstChild::~FirstChild;
0x4: FirstChild::impl; // derived class introduces the implementation
0x8: FirstChild::func;
-----------------------------------------------------------------------------------
0x0: SecondChild::~SecondChild;
0x4: SecondChild::impl; // derived class introduces the implementation
0x8: SecondChild::another;
0x10: SecondChild::func;
-----------------------------------------------------------------------------------
Next... I've got a struct Holder that contains a pointer to some instance of the derived class. Like, it is sometimes assigned a FirstChild's address and sometimes it's the SecondChild's.
Now the questions...
I wanted to type the field as Base*. Then Base would be
structBase {
BaseVtable*vtable;
};
The question is... what's BaseVtable then? I guess, it should look like this:
structBaseVtable {
??? dtor;
??? impl;
};
...but I don't know what types to use for the entries. I could use void*, but that erases the info about the arguments => theoretically Ghidra might show
have you tried using a union of vftables and then manually selecting the vftable type based on the target? that seems to be what you are trying to go for here?
My case is (simplified and abstracted) as follows... The source code likely declares a base class and 2 derived classes in the following manner:
The vtables are (I trimmed the RTTI because it's unavailable):
Next... I've got a struct
Holder
that contains a pointer to some instance of the derived class. Like, it is sometimes assigned aFirstChild
's address and sometimes it's theSecondChild
's.Now the questions...
I wanted to type the field as
Base*
. ThenBase
would beThe question is... what's
BaseVtable
then? I guess, it should look like this:...but I don't know what types to use for the entries. I could use
void*
, but that erases the info about the arguments => theoretically Ghidra might showinstead of
The latter is definitely better => how to type the entries?
Even if we manage to propagate the types into the BaseVtable, what are supposed to do with the derived vtbales?
... and then
Assuming we don't use
void*
for the entries, it looks like there is just no way to type that... Because we can no longer do this:We are forced to do
... but that doesn't work, because the
BaseVtable
doesn't have the entry forFirstChild::func
Maybe I'm just confused and I must use
void*
for the functions, tell me if that's so, please.The text was updated successfully, but these errors were encountered: