Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 16:32

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



D3D EndScene Hook Tutorial Frage

Discussion on D3D EndScene Hook Tutorial Frage within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2010
Posts: 10
Received Thanks: 1
D3D EndScene Hook Tutorial Frage

Hey, ich habe mir das Tutorial von purple.d1amond angeschaut, und habe als Test ( da ich noch nie ne D3D Funktion gehooked habe ) mal den Source aus dem Tut abgetippt und wollte ihn testen. Ich habe die .dll anschließend mit Winject in den Prozess von wow injected. Doch es passiert nichts, da wo eigentlich ein Rechteck sein sollte ( oben Rechts ) ist nichts )

Habe ich was falsch gemacht ? :

Code:
#include "stdafx.h"
#include <windows.h>
#include <cstdio>
#include <d3d9.h>
#include <d3dx9.h>

typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9);
EndScene_t pEndScene;

void DrawRect(LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color){

	D3DRECT rect = {X,Y,X+L,Y+H};

}


bool hkEndScene(LPDIRECT3DDEVICE9 pDevice){

const D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);

DrawRect( pDevice, 10, 10, 200, 200, txtPink);

return pEndScene(pDevice);

 }


void* DetourFunc(BYTE *src, const BYTE *dst, const int len)
{
	BYTE *jmp = (BYTE*)malloc(len+5);
	DWORD dwback;

	VirtualProtect(src, len, PAGE_READWRITE, &dwback);

	memcpy(jmp, src, len);	jmp += len;

	jmp[0] = 0xE9;
	*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;

	src[0] = 0xE9;
	*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;

	VirtualProtect(src, len, dwback, &dwback);

	return (jmp-len);
}



void InitHook()
{
HMODULE hModule = NULL;

   while(!hModule)
   {

      hModule = GetModuleHandleA("d3d9.dll");

Sleep(100);
}



unsigned dwBeginScene;
unsigned dwEndScene;
unsigned dwReset;
unsigned dwDrawIndexedPrimitive;
unsigned dwSetViewPort;
dwBeginScene = (DWORD)hModule + 0x87010;
dwEndScene = (DWORD)hModule + 0x871A0;
dwReset = (DWORD)hModule + 0x636B0;
dwDrawIndexedPrimitive = (DWORD)hModule + 0x88830;
dwSetViewPort = (DWORD)hModule + 0x82F70 ;



				
               
				pEndScene = (EndScene_t)(DetourFunc((PBYTE)dwEndScene,(PBYTE)hkEndScene, 5));


}


BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		
  CreateThread(0,0,(LPTHREAD_START_ROUTINE) InitHook,0,0,0);


	}
	return TRUE;
}
mfG
N1GHTLIFE is offline  
Old 07/20/2010, 12:38   #2

 
Adroxxx's Avatar
 
elite*gold: 15
Join Date: Nov 2005
Posts: 13,021
Received Thanks: 5,324
no questions forum

#moved
Adroxxx is offline  
Old 07/20/2010, 16:29   #3
 
P-a-i-n's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 1,258
Received Thanks: 396
wozu hast die BS, DIP, RES u.s.w drin wenn du es nicht aufrufst ? könntest eigentlich alles rauslöschen davon bis auf die endscene dann haste selber mehr überblick

PHP Code:
void Rechteck (LPDIRECT3DDEVICE9 Device_tint Xint Yint Lint HD3DCOLOR color)
{
D3DRECT rect = {XYX+LY+H};
Device_t->Clear(1, &rectD3DCLEAR_TARGETcolor00); // das hast du vergessen

zur not kannste es auch so machen bei 123456 kommt deine adresse rein das funktioniert ganz sicher was du davon nutzt ist deine sache was für dich einfacher ist

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

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

typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
tEndScene pEndScene = NULL;


D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);


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


void Rechteck (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
{
D3DRECT rect = {X, Y, X+L, Y+H};
Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); 
}


HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{  

	Rechteck (pDevice, 10, 10, 200, 200, txtPink);


    return pEndScene(pDevice); 
}
 
void Funktionen()
{
        HMODULE hModule = NULL;
        while( !hModule )
        {
                hModule = GetModuleHandleA( "d3d9.dll" );
                Sleep( 100 );							
        }
      
        pEndScene = (tEndScene )DetourFunc((PBYTE)  0x123456 ,(PBYTE)hkEndScene, 5); 
}

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

                CreateThread(0, 0, (LPTHREAD_START_ROUTINE) Funktionen, 0, 0, 0); 
				
                break;
        }
        return true;
}

void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
{															
    BYTE *jmp = (BYTE*)malloc(len+5);
    DWORD dwback;
    VirtualProtect(src, len, PAGE_READWRITE, &dwback);
    memcpy(jmp, src, len); jmp += len;
        jmp[0] = 0xE9;
    *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
    src[0] = 0xE9;
    *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
    VirtualProtect(src, len, dwback, &dwback);
    return (jmp-len);
}
P-a-i-n is offline  
Thanks
1 User
Old 07/24/2010, 20:42   #4
 
elite*gold: 0
Join Date: Mar 2010
Posts: 182
Received Thanks: 31
was ist endscence hook?
xlx00xlx is offline  
Old 10/03/2011, 20:04   #5
 
elite*gold: 0
Join Date: Jan 2010
Posts: 11
Received Thanks: 1
Quote:
Originally Posted by P-a-i-n View Post
wozu hast die BS, DIP, RES u.s.w drin wenn du es nicht aufrufst ? könntest eigentlich alles rauslöschen davon bis auf die endscene dann haste selber mehr überblick

PHP Code:
void Rechteck (LPDIRECT3DDEVICE9 Device_tint Xint Yint Lint HD3DCOLOR color)
{
D3DRECT rect = {XYX+LY+H};
Device_t->Clear(1, &rectD3DCLEAR_TARGETcolor00); // das hast du vergessen

zur not kannste es auch so machen bei 123456 kommt deine adresse rein das funktioniert ganz sicher was du davon nutzt ist deine sache was für dich einfacher ist

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

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

typedef HRESULT (WINAPI* tEndScene)(LPDIRECT3DDEVICE9 pDevice);
tEndScene pEndScene = NULL;


D3DCOLOR txtPink = D3DCOLOR_ARGB(255,255, 0, 255);


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


void Rechteck (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color)
{
D3DRECT rect = {X, Y, X+L, Y+H};
Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); 
}


HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice)
{  

	Rechteck (pDevice, 10, 10, 200, 200, txtPink);


    return pEndScene(pDevice); 
}
 
void Funktionen()
{
        HMODULE hModule = NULL;
        while( !hModule )
        {
                hModule = GetModuleHandleA( "d3d9.dll" );
                Sleep( 100 );							
        }
      
        pEndScene = (tEndScene )DetourFunc((PBYTE)  0x123456 ,(PBYTE)hkEndScene, 5); 
}

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

                CreateThread(0, 0, (LPTHREAD_START_ROUTINE) Funktionen, 0, 0, 0); 
				
                break;
        }
        return true;
}

void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
{															
    BYTE *jmp = (BYTE*)malloc(len+5);
    DWORD dwback;
    VirtualProtect(src, len, PAGE_READWRITE, &dwback);
    memcpy(jmp, src, len); jmp += len;
        jmp[0] = 0xE9;
    *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
    src[0] = 0xE9;
    *(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
    VirtualProtect(src, len, dwback, &dwback);
    return (jmp-len);
}
im compling this code with VC++ 2010, i make a .dll and im inject with NikM injector, and when in warrock log no happend nothing
jearca is offline  
Old 10/03/2011, 21:48   #6


 
Jeoni's Avatar
 
elite*gold: 966
Join Date: Apr 2010
Posts: 1,105
Received Thanks: 681
Of course nothing happened. P-a-i-n have posted a structure for the hook, but without the adress for the real endscene function.

@P-a-i-n:
Weisst du zufällig auch wie man die Adresse herausbekommt?
Jeoni is offline  
Reply


Similar Threads Similar Threads
d3d9.dll EndScene ?
07/19/2010 - General Coding - 7 Replies
Hey, ich wollte mal fragen ob es noch möglich ist die Funktion EndScene aus der d3d9.dll zu hooken. Weil bei mir findet IDA die Funktion EndSene nicht... Ich hab Windows 7 64 bit Professional. (In der d3d10.dll ist auch keine Funktion die EndSene heißt) mfG
D3D-Hook Frage
05/06/2010 - WarRock - 10 Replies
Hi, Ich habe eine Frage zu D3D Hooks. Ich hab jetzt hier gefragt, weil der Hack-Bereich ja no question ist. Zu meinem Problem: Ich hab mir mit Autoit nen recht gut funktionierenden Aimbot gebaut, dann habe ich auch nen Injector für die Hack dll´s gebastelt. Aber ich versuche jetzt nen D3D Hack/Hook zu schreiben für das ingame menü , cams,wireframe, Gegnererkennung für den aimbot in WR,... Jetzt meine Frage: Hat jemand nen Anhaltspunkt für mich wie ich damit am besten anfange z.b....
Frage zum Tutorial
02/21/2010 - Metin2 Private Server - 9 Replies
Im Tutorial steht: Wo/Was ist der Chinaclient?



All times are GMT +1. The time now is 16:32.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.