Advertisement
Guest User

Untitled

a guest
Jul 15th, 2015
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. /*
  2. -----------------------------------------
  3. * Game hacking QTS ( Quickie Tip Series )
  4. * no. 33 - Determining if a hooked function is called from your module
  5. -----------------------------------------
  6. * Author: SEGnosis      
  7. * Thanks to:
  8. * bitterbanana          - No known site
  9. * Drunken Cheetah       - No known site
  10. * fatboy88              - No known site
  11. * Geek4Ever             - No known site
  12. * learn_more            - www.uc-forum.com
  13. * Novocaine             - http://ilsken.net/blog/?page_id=64
  14. * Philly0494            - No known site
  15. * Roverturbo            - www.uc-forum.com
  16. * SilentKarma           - www.halocoders.com - offline
  17. * Strife                - www.uc-forum.com
  18. * Wieter20              - No known site
  19. */
  20.  
  21.  
  22. //----------------------------------//
  23.  
  24.  
  25. bool IsCalledWithinModule(HMODULE hModule, DWORD dwModuleSize)
  26. {
  27.     DWORD dwTemp;
  28.  
  29.    
  30.     // Store the current ebp
  31.     __asm
  32.     {
  33.         push eax
  34.         mov eax, ebp
  35.         mov dwTemp, eax
  36.         pop eax
  37.     }
  38.  
  39.     // Traverse up two call stacks
  40.     dwTemp = **(DWORD**)dwTemp;
  41.    
  42.     // Read the return address
  43.     dwTemp = *(DWORD*)(dwTemp + 4);
  44.  
  45.     return (dwTemp >= (DWORD)hModule && dwTemp <= ((DWORD)hModule + dwModuleSize));
  46. }
  47.  
  48. //----------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement