Want more features on Pastebin? Sign Up, it's FREE!
Guest

Header file

By: a guest on May 3rd, 2012  |  syntax: C++  |  size: 0.70 KB  |  views: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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
clone this paste RAW Paste Data