Advertisement
Guest User

Header file

a guest
May 3rd, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #ifndef DETOUR_H
  2. #define DETOUR_H
  3.  
  4. // Include files
  5. #include "global.h"
  6.  
  7. class Detour
  8. {
  9. public:
  10.     // Constructor and destructor
  11.     Detour(void * targetFunc, void * detourFunc);
  12.     ~Detour(void);
  13.  
  14.     // Fetches the trampoline
  15.     inline byte * Trampoline(void) { return m_trampoline; }
  16.  
  17.     // Patch functions
  18.     bool Unpatch(void);
  19.     bool Patch(void);
  20.  
  21. private:
  22.     // Private functions
  23.     size_t SizeRequired(void);
  24.     int SetAddressProtection(void * addr, int protection);
  25.  
  26.     // Private arrays
  27.     static byte m_jmpOperator[];
  28.     static uint m_jmpOffset;
  29.     static size_t m_jmpSize;
  30.  
  31.     // Private variables
  32.     byte * m_trampoline;
  33.     byte * m_detourFunc;
  34.     byte * m_targetFunc;
  35.     size_t m_preludeSize;
  36. };
  37.  
  38.  
  39. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement