Advertisement
expired6978

ArmorAddon

Jul 14th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. // hook Armor Attachment
  2.     {
  3.         struct InstallArmorAddon_Code : Xbyak::CodeGenerator {
  4.             InstallArmorAddon_Code(void * buf, UInt64 funcAddr) : Xbyak::CodeGenerator(4096, buf)
  5.             {
  6.                 Xbyak::Label funcLabel;
  7.                 Xbyak::Label retnLabel;
  8.  
  9.                 mov(r9, r12);
  10.                 call(ptr [rip + funcLabel]);
  11.                 jmp(ptr [rip + retnLabel]);
  12.  
  13.                 L(funcLabel);
  14.                 dq(funcAddr);
  15.  
  16.                 L(retnLabel);
  17.                 dq(InstallArmorAddon_Start.GetUIntPtr() + 5);
  18.             }
  19.         };
  20.  
  21.         void * codeBuf = g_localTrampoline.StartAlloc();
  22.         InstallArmorAddon_Code code(codeBuf, (UInt64)InstallArmorAddon_Hook);
  23.         g_localTrampoline.EndAlloc(code.getCurr());
  24.  
  25.         g_branchTrampoline.Write5Branch(InstallArmorAddon_Start.GetUIntPtr(), uintptr_t(code.getCode()));
  26.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement