I wonder how to declare the reference to a constructor to a reversed class, i.e. I have a class say Game and it has a constructor at a certain address.
It is declared like this:
game.h
namespace gladius {
struct Game {
//virtual int __thiscall main(gladius::Game* thisptr, int param_1, char** param_2, char** param_3);
using GameConstructor = Game * (__fastcall*) (Game* thisptr);
GameConstructor gameConstructor;
..........
}
game.cpp
namespace gladius {
static std::array<Game, 1> functions = { {
Game{
(Game::GameConstructor)(AddressHelper::getInstance().GetBaseAddress() + 0x331b0 / (2 * sizeof(DWORD))),
Now let's imagine I want an instance of the Game object. How do I get one as something like this
Game gameObj = gameConstructor;
is not going to work as gameObj and gameConstructor have different type. Without reversing the constructor is there any way to call it (by address) and assign the reversed class instance to it?
And
namespace gladius {
struct Game {
using Game = Game * (__fastcall*) (Game* thisptr);
Game gameConstructor;
doesn't work as a declaration as you can't declare type the same as the type of the class / structure and I don't know how to modify the above to keep it as a reference to the addressed method rather than a fully reversed function.
Basically the question is, how to do
Game objInst = new Game();
where new Game();
points to existing Game constructor (accessible by address offset)?