Results 1 to 5 of 5
  1. #1
    addmeasfd1's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Location
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Microsoft Visual C++ 2010 Express - ENU
    Posts
    87
    Reputation
    66
    Thanks
    199
    My Mood
    Yeehaw

    Post how can i update a detour

    how can i update a detour i have this code :
    Code:
    DWORD DetourCreate( DWORD  SrcVA, DWORD  DstVA, DWORD  Size )
    {
    	/*Credits for this detour to croner*/
    #define SIZEOF_JMP_NEAR  5
    
    	if ( SrcVA && DstVA && Size > 0 )
    	{
    		DWORD DetourVA = (DWORD) 
    			VirtualAlloc( NULL, Size + SIZEOF_JMP_NEAR, 
    			MEM_COMMIT | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE );
    		
    		if ( DetourVA == 0 )
    			return (0);
    
    		DWORD dwProtect;
    		if ( VirtualProtect( (VOID*)SrcVA, Size, PAGE_EXECUTE_READWRITE, &dwProtect ) )
    		{
    			for ( DWORD i=0; i < Size; i++ ) {
    				*(BYTE*)( DetourVA + i ) = *(BYTE*)( SrcVA + i );
    			}
    			
    			*(BYTE*)( DetourVA + Size + 0 ) = 0xE9;
    			*(DWORD*)( DetourVA + Size + 1 ) = ( SrcVA - DetourVA - SIZEOF_JMP_NEAR );
    
    	    	*(BYTE*)( SrcVA + 0 ) = 0xE9;
    			*(DWORD*)( SrcVA + 1 ) = ( DstVA - SrcVA - SIZEOF_JMP_NEAR );
    
    			VirtualProtect( (VOID*)SrcVA, Size, dwProtect, &dwProtect );
    
    			VirtualProtect( (VOID*)DetourVA, Size + 
    				SIZEOF_JMP_NEAR, PAGE_EXECUTE_READ, &dwProtect );
    
    	    	return DetourVA;
    		}
    	}
    	return (0);
    }
    
    
    
    
    PVOID D3Ddiscover(void *tbl, int size)
    {
    
    	
    	HWND				  hWnd;
    	void				  *pInterface=0 ;
    	D3DPRESENT_PARAMETERS d3dpp; 
    
    	if ((hWnd=CreateWindowEx(NULL,WC_DIALOG,"",WS_OVERLAPPED,0,0,50,50,NULL,NULL,NULL,NULL))==NULL) return 0;
    	ShowWindow(hWnd, SW_HIDE);
    
    	LPDIRECT3D9			pD3D;
    	LPDIRECT3DDEVICE9	pD3Ddev;
    	if ((pD3D = Direct3DCreate9(D3D_SDK_VERSION))!=NULL) 
    
    	{
    	    ZeroMemory(&d3dpp, sizeof(d3dpp));
    	    d3dpp.Windowed         = TRUE;
    		d3dpp.SwapEffect       = D3DSWAPEFFECT_DISCARD;
    	    d3dpp.hDeviceWindow    = hWnd;
    	    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    	    d3dpp.BackBufferWidth  = d3dpp.BackBufferHeight = 600;
    		pD3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&pD3Ddev);
    		if (pD3Ddev)  {
    		    pInterface = (PDWORD)*(DWORD *)pD3Ddev;
    			memcpy(tbl,(void *)pInterface,size);
    			pD3Ddev->Release();
    		}
    		pD3D->Release();
    	}
    	DestroyWindow(hWnd);
    	return pInterface;
    }
    
    void EraseHeaders(HINSTANCE hModule)
    {
    	/* 
    	* jus a func to erase headers by Croner.
    	* keep in mind you wont be able to load 
    	* any resources after you erase headers.
    	*/
    
    	PIMAGE_DOS_HEADER pDoH; 
    	PIMAGE_NT_HEADERS pNtH;
    	DWORD i, ersize, protect;
    
    	if (!hModule) return;
    	
    	// well just to make clear what we doing
    	pDoH = (PIMAGE_DOS_HEADER)(hModule);
    
    	pNtH = (PIMAGE_NT_HEADERS)((LONG)hModule + ((PIMAGE_DOS_HEADER)hModule)->e_lfanew);
    
    	ersize = sizeof(IMAGE_DOS_HEADER);
    	if ( VirtualProtect(pDoH, ersize, PAGE_READWRITE, &protect) )
    	{
    		for ( i=0; i < ersize; i++ )
    				*(BYTE*)((BYTE*)pDoH + i) = 0;
    	}
    
    	ersize = sizeof(IMAGE_NT_HEADERS);
    	if ( pNtH && VirtualProtect(pNtH, ersize, PAGE_READWRITE, &protect) )
    	{
    		for ( i=0; i < ersize; i++ )
    				*(BYTE*)((BYTE*)pNtH + i) = 0;
    	}
    	return;
    }
    
    
    void HideModule(HINSTANCE hModule)/*Credits to Thanatos aka Surpintine for his hide module function*/
    {
    	DWORD dwPEB_LDR_DATA = 0;
    	_asm
    	{
    		pushad;
    		pushfd;
    		mov eax, fs:[30h]             
    		mov eax, [eax+0Ch]               
    		mov dwPEB_LDR_DATA, eax	
    
    		InLoadOrderModuleList:
    			mov esi, [eax+0Ch]	     
    			mov edx, [eax+10h]	     
    
    		LoopInLoadOrderModuleList: 
    		    lodsd		         
    			mov esi, eax	
    			mov ecx, [eax+18h]  
    			cmp ecx, hModule	
    			jne SkipA		 
    		    mov ebx, [eax]	  
    		    mov ecx, [eax+4]  
    		    mov [ecx], ebx    
    		    mov [ebx+4], ecx	  
    			jmp InMemoryOrderModuleList 
    
    		SkipA:
    			cmp edx, esi     
    			jne LoopInLoadOrderModuleList
    
    		InMemoryOrderModuleList:
    			mov eax, dwPEB_LDR_DATA
    			mov esi, [eax+14h]
    			mov edx, [eax+18h]
    
    		LoopInMemoryOrderModuleList: 
    			lodsd
    			mov esi, eax
    			mov ecx, [eax+10h]
    			cmp ecx, hModule
    			jne SkipB
    			mov ebx, [eax] 
    			mov ecx, [eax+4]
    			mov [ecx], ebx
    			mov [ebx+4], ecx
    			jmp InInitializationOrderModuleList
    
    		SkipB:
    			cmp edx, esi
    			jne LoopInMemoryOrderModuleList
    
    		InInitializationOrderModuleList:
    			mov eax, dwPEB_LDR_DATA
    			mov esi, [eax+1Ch]	  
    			mov edx, [eax+20h]	  
    
    		LoopInInitializationOrderModuleList: 
    			lodsd
    			mov esi, eax		
    			mov ecx, [eax+08h]
    			cmp ecx, hModule		
    			jne SkipC
    			mov ebx, [eax] 
    			mov ecx, [eax+4]
    			mov [ecx], ebx
    			mov [ebx+4], ecx
    			jmp Finished
    
    		SkipC:
    			cmp edx, esi
    			jne LoopInInitializationOrderModuleList
    
    		Finished:
    			popfd;
    			popad;
    	}
    }

  2. #2
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,681
    Reputation
    5180
    Thanks
    14,176
    My Mood
    Inspired
    Best if you don't use public code and learn what you are doing when you are detouring a function.
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


  3. The Following User Says Thank You to Flengo For This Useful Post:

    Jhem (03-21-2013)

  4. #3
    AeroMan's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    Hell
    Posts
    3,294
    Reputation
    189
    Thanks
    3,049
    My Mood
    Busy
    A detour is basicly a jump to your function.
    Alot of it is explained here: windows - How does Microsoft Detours work and how do I use it to get a stack trace? - Stack Overflow
    I will upload another tutorial by it when im back from my exams.

  5. The Following 5 Users Say Thank You to AeroMan For This Useful Post:

    [MPGH]Flengo (03-21-2013),Jhem (03-21-2013),MJCreado (03-21-2013),Ryuzaki™ (03-21-2013),~ExoduS~* (03-21-2013)

  6. #4
    obinobi's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Hiding in a Bush...
    Posts
    344
    Reputation
    10
    Thanks
    510
    My Mood
    Relaxed
    ~~~~~~~~Post Closed~~~~~~~~~~~~
    Last edited by obinobi; 03-21-2013 at 04:48 PM.

  7. #5
    Flengo's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    /admincp/banning.php
    Posts
    20,681
    Reputation
    5180
    Thanks
    14,176
    My Mood
    Inspired
    Closed upon request. There's a nice post above there with information.

    /Closed
    I Read All Of My PM's & VM's
    If you need help with anything, just let me know.

     


     
    VM | PM | IM
    Staff Administrator Since 10.13.2019
    Publicist Since 04.04.2015
    Middleman Since 04.14.2014
    Global Moderator Since 08.01.2013
    Premium Since 05.29.2013

    Minion+ Since 04.18.2013

    Combat Arms Minion Since 12.26.2012
    Contributor Since 11.16.2012
    Member Since 05.11.2010


Similar Threads

  1. How can i update my game?
    By adeddd in forum Alliance of Valiant Arms (AVA) Help
    Replies: 9
    Last Post: 09-26-2012, 09:12 PM
  2. (Help) How can i update my COD4 v1.0 ?
    By SandYAN in forum Call of Duty Modern Warfare Help
    Replies: 0
    Last Post: 02-19-2012, 02:45 PM
  3. [Help] Automaton can not be used. Automatic machine how to skip update?
    By fzxwzleo in forum Mission Against Terror Discussions
    Replies: 4
    Last Post: 05-01-2011, 06:45 PM
  4. How can i find the new Addys after an Update?
    By taylan in forum WarRock Hack Source Code
    Replies: 11
    Last Post: 07-19-2010, 10:42 PM
  5. how can i make game hack?!!!!
    By UnknownID in forum General Game Hacking
    Replies: 2
    Last Post: 02-07-2006, 07:21 PM