Advertisement
allen343434

Untitled

Mar 1st, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. Function & addy:
  2.  
  3. #define ADR_PROXY offsethere
  4.  
  5. template <typename T> __declspec(naked) T _cdecl ProxyCall(void* Target, UINT NumberOfParams, void* ProxyFFD5, ...)
  6. {
  7. __asm mov edx, esp; // stackframe on edx - edx points now to the return adress - Target, NumberOfParams, ProxyFFD5, Params after.
  8. __asm push esp; // save esp
  9. __asm push ebp; // save ebp
  10. __asm push esi; // save esi
  11.  
  12. __asm lea esi, [edx + 8]; // Points to NumberOfParams
  13. __asm mov ecx, [esi]; // Get Number Of Params
  14. __asm inc ecx; // Also push ProxyFFD5
  15.  
  16. PushParams:
  17. __asm mov eax, [esi + ecx * 4]; // Get Parameter from right to left
  18. __asm push eax; // and push them on the stack
  19. __asm loop PushParams; // Repeat until all params pushed (ecx != 0) - Stack is done after this
  20.  
  21. __asm mov ebp, ReturnHere; // Mov Returnadress into ebp to be called by proxy
  22. __asm mov eax, [edx + 4]; // Get Target
  23. __asm jmp eax; // jump to target
  24.  
  25. ReturnHere:
  26. __asm add esp, 4; // remove return address from Proxy
  27. __asm pop esi; // restore esi
  28. __asm pop ebp; // restore ebp
  29. __asm pop esp; // restore stack
  30. __asm retn; // return
  31. }
  32.  
  33. CALL:
  34.  
  35. if (ProxyCall<SHORT>(&GetAsyncKeyState, 1, (void*)ADR_PROXY, VK_INSERT) & 1)
  36. {
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement