Advertisement
Guest User

x2techtree.cpp

a guest
Apr 30th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <windows.h>
  2. #include <assert.h>
  3. typedef uintptr_t addr;
  4. #include "MemoryMgr.h"
  5.  
  6. typedef unsigned char uchar;
  7. typedef unsigned short ushort;
  8. typedef unsigned int uint;
  9.  
  10. #define RET(n)  __asm push  n __asm retn
  11. #define ASM(name) void __declspec(naked) name(void)
  12.  
  13. ASM(techtree_asm)
  14. {
  15.     __asm {
  16.         cmp ecx, 104
  17.         jnz slingers_hook
  18.         cmp dword ptr [edi], 775
  19.         jnz slingers_hook
  20.         cmp dword ptr [esi+0x81C], 14
  21.         jnz endif_5B3C42
  22.            
  23.         slingers_hook:
  24.         cmp ecx, 87
  25.         jnz endif_5B3B9F
  26.         cmp dword ptr [edi], 185
  27.         jnz endif_5B3B9F
  28.         cmp dword ptr [esi+0x81C], 21
  29.         jnz endif_5B3C42
  30.            
  31.         endif_5B3B9F:
  32.         RET(0x5B3B9F);
  33.            
  34.         endif_5B3C42:
  35.         RET(0x5B3C42);
  36.     }
  37. }
  38.  
  39. BOOL WINAPI
  40. DllMain(HINSTANCE hInst, DWORD reason, LPVOID)
  41. {
  42.     if(reason == DLL_PROCESS_ATTACH) {
  43.         if (*(int*)0x6146F0 == 0x042474ff && *(int*)0x51A3B8 == 0x002A6674) {
  44.             if (strstr((char*)GetCommandLine(), "age2_x2")) {
  45.                 InjectHook(0x5B3B85, techtree_asm, PATCH_JUMP);
  46.             }
  47.         }
  48.     }
  49.  
  50.     return TRUE;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement