I am trying to detour a function using DetourAttach()
in the following fashion:
hooks::logDebug("swresample-3Proxy.log", fmt::format("Try to attach hook. Function {:p}, hook {:p}.",
*hook.first, hook.second));
writeProtectedMemory(hook.first, hook.second);
auto result = DetourAttach(hook.first, hook.second);
Where hook.first = 0x00007ff69f119ea0 {Gladius.exe!gladius::Game::main(int,char * *,char * *)} {0x8b4820ec83485340} void * *
hook.second = 0x00007ff818f51ef5 {swresample-3.dll!hooks::gamemainHooked(struct gladius::Game *,int,char * *,char * *)} void *
But the result comes with the following error:
Exception thrown at 0x00007FF69F119EA1 in Gladius.exe: 0xC000001D: Illegal Instruction.
And the question marks (see the screenshot) where the jump instruction supposed to be.
Would appreciate some help in resolving this...