Exetools  

Go Back   Exetools > General > Source Code

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 05-11-2016, 09:32
IChooseYou
 
Posts: n/a
I have only used to Detours 1.5 before, and the documentation for 3.0 isn't great. So in case anyone struggles:

PHP Code:
PVOID SetDetourPVOIDppTargetPVOID pHandler )
{
    if ( 
DetourTransactionBegin( ) != NO_ERROR )
        return 
FALSE;

    if ( 
DetourUpdateThreadGetCurrentThread( ) ) != NO_ERROR )
    {
        
DetourTransactionCommit( );
        return 
NULL;
    }

    
PDETOUR_TRAMPOLINE pTrampoline NULL;
    
    if ( 
DetourAttachExppTargetpHandler, &pTrampolineNULLNULL ) != NO_ERROR )
    {
        
DetourTransactionCommit( );
        return 
NULL;        
    }

    if ( 
DetourTransactionCommit( ) != NO_ERROR )
    {
        
DetourTransactionAbort( );
        return 
NULL;
    }

    return 
pTrampoline;

Retouring works the same, call DetourDetach as opposed to DetourAttach/DetourAttachEx

PHP Code:
    g_lpDispatchMessage reinterpret_cast<PVOID*>( 0x14317DCD0 );
    
oDispatchMessage reinterpret_cast<tDispatchMessage>( SetDetour( &g_lpDispatchMessagehkDispatchMessage ) );

    
RemoveDetour( &g_lpDispatchMessagehkDispatchMessage ); 
Reply With Quote
The Following 6 Users Say Thank You to For This Useful Post:
besoeso (05-12-2016), dude719 (05-12-2016), romero (05-26-2016), user_hidden (05-11-2016)
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SignatureToDetour: Converts IDA Pro signatures to C++ Detours sh3dow Source Code 2 01-23-2017 21:14
microsoft ddk kP^ General Discussion 3 10-20-2003 20:39


All times are GMT +8. The time now is 18:28.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )