mirror of
https://github.com/thunderbrewhq/binana.git
synced 2026-05-03 05:03:50 +00:00
feat(profile): add macros for properly defining the interfaces of vtables
This commit is contained in:
parent
8f4b08b0e6
commit
4b438d3528
2 changed files with 23 additions and 4 deletions
|
|
@ -4,12 +4,12 @@
|
||||||
DECLARE_STRUCT(GameClientCommands);
|
DECLARE_STRUCT(GameClientCommands);
|
||||||
DECLARE_STRUCT(GameClientCommands__v_table);
|
DECLARE_STRUCT(GameClientCommands__v_table);
|
||||||
|
|
||||||
|
#define INTERFACE GameClientCommands
|
||||||
struct GameClientCommands__v_table {
|
struct GameClientCommands__v_table {
|
||||||
E_METHOD(GameClientCommands, void, Install);
|
E_METHOD(void, Install);
|
||||||
E_METHOD(GameClientCommands, void, Uninstall);
|
E_METHOD(void, Uninstall);
|
||||||
// void* Install;
|
|
||||||
// void* Uninstall;
|
|
||||||
};
|
};
|
||||||
|
#undef INTERFACE
|
||||||
|
|
||||||
struct GameClientCommands {
|
struct GameClientCommands {
|
||||||
GameClientCommands__v_table* v_table;
|
GameClientCommands__v_table* v_table;
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,23 @@
|
||||||
|
|
||||||
#define DECLARE_UNION(T) typedef union T T
|
#define DECLARE_UNION(T) typedef union T T
|
||||||
|
|
||||||
|
#if defined(IDA) || defined(CLANGD)
|
||||||
|
// void Method(int32_t a1);
|
||||||
|
#define P_METHOD(__result__, name, ...) __result__(__thiscall* name)(INTERFACE * this, __VA_ARGS__)
|
||||||
|
|
||||||
|
// void Method();
|
||||||
|
#define E_METHOD(__result__, name) __result__(__thiscall* name)(INTERFACE * this)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
// ghidra doesn't support calling conventions in function pointer types :(
|
||||||
|
// this hides autoanalysis for the 'this' pointer but at least has correct
|
||||||
|
// parameter types
|
||||||
|
|
||||||
|
#define P_METHOD(__result__, name, ...) __result__ (*name)(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define E_METHOD(__result__, name) __result__ (*name)()
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue