Advertisement
Guest User

Untitled

a guest
Feb 17th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 6.25 KB | None | 0 0
  1. __declspec(naked)
  2. VOID
  3. KillLocalPlayerAsm(
  4.     VOID
  5.     )
  6. {
  7.     FLOAT Result;
  8.  
  9.     __asm {
  10.         push    ebp
  11.         mov     ebp,esp
  12.         sub     esp,28h
  13.         push    esi
  14.  
  15. ;
  16. ; Get player base address
  17. ;
  18.         push    90h    
  19.         mov     eax,00468550h
  20.         call    eax                             ; ClntObjMgrGetActivePlayer
  21.  
  22.         push    edx                             ; Player's GUID (HighPart)
  23.        push    eax                             ; Player's GUID (LowPart)
  24.         mov     edx,008364B4h                   ; '..\Object/ObjectClient/Player_C.h'
  25.         mov     ecx,10h                         ; TYPEMASK_PLAYER
  26.         mov     eax,00468460h
  27.         call    eax                             ; ClntObjMgrObjectPtr
  28. ;
  29. ; (eax) = player base
  30.        
  31.         mov     [ebp-28h],eax
  32.  
  33. ;
  34. ; Initialize CDataStore structure
  35. ;
  36.         xor     esi,esi
  37.         mov     [ebp-14h],esi                   ; m_data
  38.         mov     [ebp-10h],esi                   ; m_base
  39.         mov     [ebp-0Ch],esi                   ; m_alloc
  40.         mov     [ebp-8],esi                     ; m_size
  41.         mov     dword ptr [ebp-4],0FFFFFFFFh    ; m_read
  42.         mov     dword ptr [ebp-18h],007FF9E4h   ; CDataStore___vftable_
  43.  
  44. ;
  45. ; Put MSG_MOVE_HEARTBEAT opcode
  46. ;
  47.         push    0EEh                            ; MSG_MOVE_HEARTBEAT
  48.         lea     ecx,[ebp-18h]
  49.         mov     eax,00418190h
  50.         call    eax                             ; CDataStore__PutInt32
  51.  
  52. ;
  53. ; Put the flag
  54. ;
  55.         xor     eax,eax
  56.         push    eax                             ; Flag
  57.         lea     ecx,[ebp-18h]
  58.         mov     eax,00418190h
  59.         call    eax                             ; CDataStore__PutInt32
  60.  
  61. ;
  62. ; Get timestamp
  63. ;
  64.         mov     eax,0042C010h
  65.         call    eax                             ; OsGetAsyncTimeMs
  66. ;
  67. ; (eax) = timestamp
  68.  
  69. ;
  70. ; Put timestamp
  71. ;
  72.         push    eax                             ; Timestamp
  73.         lea     ecx,[ebp-18h]
  74.         mov     eax,00418190h
  75.         call    eax                             ; CDataStore__PutInt32
  76.  
  77. ;
  78. ; Get player position address
  79. ;
  80.         mov     ebx,[ebp-28h]
  81. ;
  82. ; Put player X-coordinate
  83. ;
  84.         mov     ecx,[ebx+9B8h]
  85.         push    ecx                             ; X-coordinate
  86.         lea     ecx,[ebp-18h]
  87.         mov     eax,004183D0h
  88.         call    eax                             ; CDataStore__PutFloat
  89.  
  90. ;
  91. ; Put player Y-coordinate
  92. ;
  93.         mov     ecx,[ebx+9BCh]
  94.         push    ecx                             ; Y-coordinate
  95.         lea     ecx,[ebp-18h]
  96.         mov     eax,004183D0h
  97.         call    eax                             ; CDataStore__PutFloat
  98.  
  99. ;
  100. ; Put player Z-coordinate
  101. ;
  102.         fld     [ebx+9C0h]
  103.         mov     eax,00865618h                   ; [eax] = 100.0f
  104.         fld     [eax]
  105.         fadd    st(0),st(1)                     ; Z += 100.0f
  106.         fstp    [Result]
  107.         mov     ecx,Result
  108.         push    ecx                             ; Z-coordinate
  109.         lea     ecx,[ebp-18h]
  110.         mov     eax,004183D0h
  111.         call    eax                             ; CDataStore__PutFloat
  112.  
  113. ;
  114. ; Put player facing
  115. ;
  116.         mov     ecx,[ebx+9C4h]
  117.         push    ecx                             ; Facing
  118.         lea     ecx,[ebp-18h]
  119.         mov     eax,004183D0h
  120.         call    eax                             ; CDataStore__PutFloat
  121.  
  122. ;
  123. ; Put the falltime
  124. ;
  125.         mov     eax,1520
  126.         push    eax                             ; Falltime
  127.         lea     ecx,[ebp-18h]
  128.         mov     eax,00418190h
  129.         call    eax                             ; CDataStore__PutInt32
  130.  
  131. ;
  132. ; Send the packet
  133. ;
  134.         lea     ecx,[ebp-18h]
  135.         mov     [ebp-4],esi
  136.         mov     eax,005AB630h
  137.         call    eax                             ; ClientServices_Send
  138.  
  139. ;
  140. ; CleanUp
  141. ;
  142.         cmp     dword ptr [ebp-0Ch],0FFFFFFFFh
  143.         mov     dword ptr [ebp-18h],007FF9E4h   ; CDataStore___vftable_
  144.         jz      Exit
  145.  
  146.         lea     eax,[ebp-0Ch]
  147.         push    eax
  148.         lea     ecx,[ebp-10h]
  149.         push    ecx
  150.         lea     edx,[ebp-14h]
  151.         push    edx
  152.         lea     ecx,[ebp-18h]
  153.         mov     eax,007FF9E8h
  154.         call    [eax]                           ; CDataStore__Release
  155.  
  156. ;
  157. ; Send fall land packet
  158. ;
  159.         xor     ebx,ebx
  160.         push    ebx                             ; Unknown1
  161.         push    ebx                             ; Unknown2
  162.         push    0C9h                            ; Opcode (MSG_MOVE_FALL_LAND)
  163.         mov     eax,0042C010h
  164.         call    eax                             ; OsGetAsyncTimeMs
  165.         push    eax                             ; Timestamp
  166.         mov     ecx,[ebp-28h]                   ; Player base
  167.         mov     eax,00600A30h
  168.         call    eax                             ; CMovementData_C__SendSimpleMoveMessage
  169.  
  170. Exit:
  171.         pop     esi
  172.         mov     esp,ebp
  173.         pop     ebp
  174.         ret
  175.     }
  176. }
  177.  
  178. BOOL
  179. KillLocalPlayer(
  180.     VOID
  181.     )
  182. {
  183.     INJDATA InjData;
  184.     PVOID   CodeBase;
  185.  
  186.     RtlZeroMemory(&InjData, sizeof(INJDATA));
  187.  
  188.     if (!PlayerIsDead()) {
  189.         CodeBase = AllocateVirtualMemory((DWORD_PTR)NULL, SizeOfProc(KillLocalPlayerAsm), MEM_COMMIT | MEM_RESERVE);
  190.         if (CodeBase == NULL) {
  191.             return FALSE;
  192.         }
  193.  
  194.         WriteBuffer((DWORD_PTR)CodeBase, KillLocalPlayerAsm, SizeOfProc(KillLocalPlayerAsm));
  195.  
  196.         SuspendThread(hGameThread);
  197.  
  198.         if (!InjectHooking()) {
  199.             ResumeThread(hGameThread);
  200.             return FALSE;
  201.         }
  202.  
  203.         InjData.JumpPointer = pEndScene;
  204.  
  205.         WriteBuffer((DWORD_PTR)EndSceneHook_Parameters, &InjData, sizeof(INJDATA));
  206.  
  207.         WriteDword((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_PARAMS, (DWORD)EndSceneHook_Parameters);
  208.         WriteByte((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION, 0xE8);
  209.         WriteDword((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION + 1,
  210.             ((DWORD_PTR)CodeBase - ((DWORD_PTR)EndSceneHook_InjectedCode + OFFSET_ESHOOK_FUNCTION)) - 5);
  211.  
  212.         ResumeThread(hGameThread);
  213.  
  214.         Sleep(50);
  215.  
  216.         AddChatMessage("RIP in Peace, %s!", ReadStringA(0x00C27D88));
  217.  
  218.         FreeVirtualMemory((DWORD_PTR)CodeBase, 0, MEM_RELEASE);
  219.     }  
  220.  
  221.     return TRUE;
  222. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement