Files
DepotDownloaderMod/NetHook/csimpledetour.cpp
Ryan Stecker 3624b3ad4d woo.
--HG--
extra : convert_revision : svn%3A946a0da7-ebce-4904-9acb-2f1e67aed693%401
2010-07-28 23:28:34 +00:00

34 lines
573 B
C++

#include "csimpledetour.h"
CSimpleDetour::CSimpleDetour(void **old, void *replacement)
{
m_fnOld = old;
m_fnReplacement = replacement;
}
void CSimpleDetour::Attach()
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(m_fnOld, m_fnReplacement);
DetourTransactionCommit();
m_bAttached = true;
}
void CSimpleDetour::Detach()
{
if (!m_bAttached)
return;
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(m_fnOld, m_fnReplacement);
DetourTransactionCommit();
}