Hooking DirectXDevice.Present() Function Using DLLInjector?

c++ / delphi package - dll injection and api hooking
Post Reply
mayurgadhave
Posts: 5
Joined: Tue Sep 19, 2006 12:19 pm
Location: Pune
Contact:

Hooking DirectXDevice.Present() Function Using DLLInjector?

Post by mayurgadhave »

I am able to Hook Present() Function By inserting code below in the
HookDirect3D.dll but i dont get the device pointer
using which i want to draw rectangle using REC in the game.

Here is my code
HRESULT WINAPI Present9Callback(PVOID self, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
D3DRECT rec = {100,1,150,50};
DevicePTR->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255,255,0),0 ,0);
MessageBox(NULL, "presenting", "dude!", MB_OK);
return Present9Next(self, pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion);
}

and
declarartion
PVOID (WINAPI *Direct3DCreate9Next) (DWORD sdkVersion);


HRESULT (WINAPI *CreateDevice9Next) (PVOID self, DWORD adapter, DWORD devType, HWND wnd, DWORD flags, PVOID params, PVOID* device);


HRESULT (WINAPI *Present9Next) (PVOID self, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);

How do i get DevicePTR
Post Reply