#ifndef DETOUR_H
#define DETOUR_H
// Include files
#include "global.h"
class Detour
{
public:
// Constructor and destructor
Detour(void * targetFunc, void * detourFunc);
~Detour(void);
// Fetches the trampoline
inline byte * Trampoline(void) { return m_trampoline; }
// Patch functions
bool Unpatch(void);
bool Patch(void);
private:
// Private functions
size_t SizeRequired(void);
int SetAddressProtection(void * addr, int protection);
// Private arrays
static byte m_jmpOperator[];
static uint m_jmpOffset;
static size_t m_jmpSize;
// Private variables
byte * m_trampoline;
byte * m_detourFunc;
byte * m_targetFunc;
size_t m_preludeSize;
};
#endif