Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Help] - D3D8 Vtable Hook

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
peter4d5
Cheater
Reputation: 0

Joined: 21 Dec 2010
Posts: 37

PostPosted: Thu Feb 02, 2012 9:34 pm    Post subject: [Help] - D3D8 Vtable Hook Reply with quote

D3D8 Vtable Hook

I found this and want to test in delphi, but don't know some syntax in delphi. Could anyone help please..TY

DWORD dwEndScene = VTableHook[35]; <====== What's syntax in delphi ?




//=======================================Vtable Hook====================================================================//
int D3D8BASE (void)
{
HMODULE D3D8BASE = NULL;
for (;D3D8BASE == NULL;Sleep(100))
D3D8BASE = LoadLibrary("d3d8.dll");
DWORD* VTableHook = 0;
DWORD hD3D8 = (DWORD)GetModuleHandle("d3d8.dll");
DWORD VIRTUALTABLE = FindPattern(hD3D8, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
memcpy(&VTableHook, (void*)(VIRTUALTABLE+2), 4);

DWORD dwEndScene = VTableHook[35]; // <-------------------- Here
DWORD dwDrawIndexedPrimitive = VTableHook[71];
DWORD dwSetStreamSource = VTableHook[83];
DWORD dwSetViewport = VTableHook[40];
DWORD dwSetRenderState = VTableHook[50];


pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunc((PBYTE)dwDrawIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive, 7);
pSetStreamSource = (oSetStreamSource)DetourFunc((PBYTE)dwSetStreamSource, (PBYTE)mySetStreamSource, 7);
pEndScene = (oEndScene)DetourFunc((PBYTE)dwEndScene, (PBYTE)myEndScene, 7);
pSetViewport = (oSetViewport)DetourFunc((PBYTE)dwSetViewport, (PBYTE)mySetViewport, 7);
pSetRenderState = (oSetRenderState)DetourFunc((PBYTE)dwSetRenderState, (PBYTE)mySetRenderState, 7);

return 0;
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);

if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3D8BASE, NULL, NULL, NULL);

}
return TRUE;
}

_________________
my name is peter4d5
Back to top
View user's profile Send private message
peter4d5
Cheater
Reputation: 0

Joined: 21 Dec 2010
Posts: 37

PostPosted: Fri Feb 03, 2012 11:00 am    Post subject: Reply with quote

no one?. DarkByte please... Only one sentence, not all..
_________________
my name is peter4d5
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25956
Location: The netherlands

PostPosted: Fri Feb 03, 2012 1:11 pm    Post subject: Reply with quote

Code:

DWORD dwEndScene = VTableHook[35];

is in delphi
Code:

var dwEndcene: DWORD
...
begin
dwEndScene := VTableHook[35];


and before you ask: dword *VTableHook is VTableHook: PDwordArray;

(note that if you have FPC and use native fpc syntax you can just use PDWORD instead of PDWORDARRAY)

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
peter4d5
Cheater
Reputation: 0

Joined: 21 Dec 2010
Posts: 37

PostPosted: Fri Feb 03, 2012 7:18 pm    Post subject: Reply with quote

Thank you verymuch. I will test it tonight.
_________________
my name is peter4d5
Back to top
View user's profile Send private message
peter4d5
Cheater
Reputation: 0

Joined: 21 Dec 2010
Posts: 37

PostPosted: Mon Feb 06, 2012 4:50 am    Post subject: Reply with quote

Case Closed...

But i have some question..
Why game freeze when exit, since i already hook reset and this problem occurs in some games and
may be d3d8 or d3d9 (specific games). In this case is Delta force : Black Hawk Down.

and please guide me how to hook window mode and Increase resolution in d3d8,d3d9.

Thank you.
Peter4d5.

----------------------------------------------------

hD3D8 = 6D9A0000
VIRTUALTABLE Base = 6D9C942C
VTableHook = 6D9A8308
dwReset = 6D9EE3B0
dwEndScene = 6D9D93A0

@OnResetCallBack = 13159930
@EndScene8Callback = 1315998C

pdword(VTableHook[14])^ := 8B55FF8B
pdword(VTableHook[35])^ := 8B55FF8B

@dwReset Hooked success
@EndScene8 Hooked success


pdword(VTableHook[14])^ := 76B57BE9
pdword(VTableHook[35])^ := 7805E7E9

[/url]

_________________
my name is peter4d5
Back to top
View user's profile Send private message
peter4d5
Cheater
Reputation: 0

Joined: 21 Dec 2010
Posts: 37

PostPosted: Mon Feb 06, 2012 6:38 pm    Post subject: Reply with quote

sorry, if my post don't follow site's rule, i can't edit it,
next time, i will correct it.

_________________
my name is peter4d5
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites