0

I am trying to modify the main function for a specific decompiled .exe. More specifically, I want to remove the reference to GUI from that .exe file, so that GUI doesn't get initialised on the startup and also make a call to a different function, which normally gets called from the subsequent GUI dialog.

Example:

__int64 __fastcall gladius::Game::main(gladius::Game *this, int a2, char **a3, char **a4)
{
  gladius::Game *v4; // rbx@1

  v4 = this;
  gladius::Game::initialize(this, a2, a3, a4);
  proxy::gui::GUI::run(*((proxy::gui::GUI **)v4 + 5));
  gladius::Game::quit(v4);
  return 0i64;
}

called from the entry point to this program:

int main(int param_1,char **param_2,char **param_3)

{
  int iVar1;
  Game local_68 [96];
  
  gladius::Game::Game(local_68);
  iVar1 = gladius::Game::main(local_68,param_1,param_2,param_3);
  gladius::Game::~Game(local_68);
  return iVar1;
}

I want to change this to something like this:


__int64 __fastcall gladius::Game::main(gladius::Game *this, int a2, char **a3, char **a4)
{
  gladius::Game *v4; // rbx@1

  v4 = this;
  gladius::Game::initialize(a2, a3, a4);
  gladius::world::World::create();
  gladius::Game::quit(v4);
  return 0i64;
}

Will call to the gladius::Game::main be possible from say proxy DLL in this case? Or as it is a main function it won't be called properly?

2
  • 1
    This code doesn't look C# to me. Commented Jul 12, 2021 at 20:48
  • 1
    You are correct. Changed the header.
    – Irbis77
    Commented Jul 13, 2021 at 17:28

1 Answer 1

0

Fixed with hooking the main function just as it is normally done with hooking technics. Note, that although the function above is called main, it is not the one called when the application starts. So, might be different for the actual main function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.