d3d hooking problem

02/12/2011 22:09 bammes#1
hey ich mach grad des d3d hooking tut von purple.d1amond und habe als erstes um zu testen obs geht den code kopiert und versucht zu testen.

problem is nur, dass warrock crasht direkt nachdem ich beim patcher auf spiel starten geklickt habe.

weis einer, warum es nicht geht?

PS die endscene adresse habe ich die richtige reingemacht.

code:
-->
->
>

PHP Code:
#pragma once
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")

#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT (WINAPItEndScene)(LPDIRECT3DDEVICE9 pDevice);
tEndScene pEndScene NULL;


D3DCOLOR txtPink D3DCOLOR_ARGB(255,2550255);


void Funktionen();
void *DetourFunc(BYTE *src, const BYTE *dst, const int len);


void Rechteck (LPDIRECT3DDEVICE9 Device_tint Xint Yint Lint HD3DCOLOR color)
{
D3DRECT rect = {XYX+LY+H};
Device_t->Clear(1, &rectD3DCLEAR_TARGETcolor00); 
}


HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{  

    
Rechteck (pDevice1010200200txtPink);


    return 
pEndScene(pDevice); 
}
 
void Funktionen()
{
        
HMODULE hModule NULL;
        while( !
hModule )
        {
                
hModule GetModuleHandleA"d3d9.dll" );
                
Sleep100 );                            
        }
      
        
pEndScene = (tEndScene )DetourFunc((PBYTE)  0x7542CE09 ,(PBYTE)hkEndScene5); 
}

int WINAPI DllMain(HINSTANCE hInst,DWORD reason,LPVOID reserved
{
        switch(
reason)
        {
        case 
DLL_PROCESS_ATTACH:

                
CreateThread(00, (LPTHREAD_START_ROUTINEFunktionen000); 
                
                break;
        }
        return 
true;
}

void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
{                                                            
    
BYTE *jmp = (BYTE*)malloc(len+5);
    
DWORD dwback;
    
VirtualProtect(srclenPAGE_READWRITE, &dwback);
    
memcpy(jmpsrclen); jmp += len;
        
jmp[0] = 0xE9;
    *(
DWORD*)(jmp+1) = (DWORD)(src+len jmp) - 5;
    
src[0] = 0xE9;
    *(
DWORD*)(src+1) = (DWORD)(dst src) - 5;
    
VirtualProtect(srclendwback, &dwback);
    return (
jmp-len);

02/12/2011 22:18 .ɖєaη#2
Poste es doch bitte in den Sticky <:
[Only registered and activated users can see links. Click Here To Register...]
#closerequest
02/12/2011 22:27 Mostey#3
#closed