
Originally Posted by
-3ncrypted
Here is my clean detours 
Code:
void MessageBoxA_Detour( void )
{
static decltype( &MessageBoxA ) lpMessageBoxA = reinterpret_cast<decltype( &MessageBoxA )>( GetProcAddress( LoadLibraryA( "user32.dll" ), "MessageBoxA" ) );
decltype( &MessageBoxA ) hkMessageBoxA = []( HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType ) -> int
{
std::cout << "MessageBox Call: " << lpText << std::endl;
return 0;
};
DetourFunc( reinterpret_cast<PBYTE>( lpMessageBoxA ), reinterpret_cast<PBYTE>( hkMessageBoxA ), 5 );
}
Usage:
Code:
MessageBoxA_Detour( );
MessageBoxA( HWND_DESKTOP, "Hooked", "Test", MB_OK );
It's nice but it's not even yours. I've seen you twice now post something and act as if you've created it when all you've done is rip it off another site.