Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

CreateDevice hook trouble
Old 08-16-2010, 09:27 AM   #1
n00bie

datastation123's Avatar

Join Date: Aug 2010
Posts: 4
Reputation: 10
Rep Power: 19
datastation123 has made posts that are generally average in quality
CreateDevice hook trouble

CreateDevice hooking detected...

Would advise me some method hooking CreateDevice or..

Roverturbo's base + codepatching

my method detected...

so I make it another method but game error...
PHP Code:
 
//=====================================================================================
// Roverturbo | www.uc-forum.com
#include <windows.h>
#include <d3d8.h>
#include <stdio.h>
#pragma comment(lib, "d3d8.lib")
//=====================================================================================
typedef HRESULT (WINAPICreateDevice_Prototype)        (LPDIRECT3D8UINTD3DDEVTYPEHWNDDWORDD3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE8*);
typedef HRESULT (WINAPIReset_Prototype)               (LPDIRECT3DDEVICE8D3DPRESENT_PARAMETERS*);
typedef HRESULT (WINAPIEndScene_Prototype)            (LPDIRECT3DDEVICE8);
typedef HRESULT (WINAPIDrawIndexedPrimitive_Prototype)(LPDIRECT3DDEVICE8D3DPRIMITIVETYPEUINTUINTUINTUINT);
CreateDevice_Prototype         CreateDevice_Pointer         NULL;
Reset_Prototype                Reset_Pointer                NULL;
EndScene_Prototype             EndScene_Pointer             NULL;
DrawIndexedPrimitive_Prototype DrawIndexedPrimitive_Pointer NULL;
HRESULT WINAPI Direct3DCreate8_VMTable    (VOID);
HRESULT WINAPI CreateDevice_Detour        (LPDIRECT3D8UINTD3DDEVTYPEHWNDDWORDD3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE8*);
void WINAPI Reset_Detour               (LPDIRECT3DDEVICE8D3DPRESENT_PARAMETERS*);
HRESULT WINAPI EndScene_Detour            (LPDIRECT3DDEVICE8);
void WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE8D3DPRIMITIVETYPEUINTUINTUINTUINT);
PDWORD Direct3D_VMTable NULL
//=====================================================================================
#define SIZE 5
BYTE checkByte[SIZE] = {0};
BYTE JMP[SIZE] = {0};
DWORD oldProtectmyProtect PAGE_EXECUTE_READWRITE;
DWORD pOrigMBAddress NULL;
DWORD JMPSize NULL;
BYTE backUp[SIZE] = { 0x90, };
BYTE tempJMP[SIZE] = { 0x90, };
#define rsSIZE 5
BYTE rscheckByte[rsSIZE] = {0};
BYTE rsJMP[rsSIZE] = {0};
DWORD rsoldProtectrsmyProtect PAGE_EXECUTE_READWRITE;
DWORD rspOrigMBAddress NULL;
DWORD rsJMPSize NULL;
BYTE rsbackUp[rsSIZE] = { 0x90, };
BYTE rstempJMP[rsSIZE] = { 0x90, };
//=====================================================================================
DWORD WINAPI CodePatching(LPVOID Param);
DWORD WINAPI haruvoid);
DWORD WINAPI goRsvoid);
DWORD WINAPI gogogovoid);
void Un();
void Ho();
void rsUn();
void rsHo();
bool sil false;
//=======================================================================================
DWORD WINAPI hanoi(LPVOID aaaa)
{
 *(
PDWORD)&DrawIndexedPrimitive_Pointer = (DWORD)0x6DE973A0;
 
CreateThread(NULL0CodePatchingNULL0NULL);
 return 
1;
}
BOOL WINAPI DllMain(HINSTANCE hinstModuleDWORD dwReasonLPVOID lpvReserved)
{
  if(
dwReason == DLL_PROCESS_ATTACH)
  {
    
DisableThreadLibraryCalls(hinstModule);
 
CreateThread(NULL0hanoiNULL0NULL);
    
    
//return TRUE;
  
}
  return 
TRUE;
}
//=====================================================================================
HRESULT WINAPI Direct3DCreate8_VMTable(VOID)
{
/*
  LPDIRECT3D8 Direct3D_Object = Direct3DCreate8(D3D_SDK_VERSION);
  if(Direct3D_Object == NULL)
  return D3DERR_INVALIDCALL;
  
  Direct3D_VMTable = (PDWORD)*(PDWORD)Direct3D_Object;
  Direct3D_Object->Release();
  DWORD dwProtect;
  if(VirtualProtect(&Direct3D_VMTable[15], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
  {
    *(PDWORD)&CreateDevice_Pointer = Direct3D_VMTable[15];
    *(PDWORD)&Direct3D_VMTable[15] = (DWORD)CreateDevice_Detour;
    if(VirtualProtect(&Direct3D_VMTable[15], sizeof(DWORD), dwProtect, &dwProtect) == 0)
    return D3DERR_INVALIDCALL;
  }
  else
  return D3DERR_INVALIDCALL;
  */
 
  
return D3D_OK;
}
//=====================================================================================
 
//=====================================================================================
void WINAPI Reset_Detour(LPDIRECT3DDEVICE8 Device_InterfaceD3DPRESENT_PARAMETERSPresentationParameters)
{
 if(
sil == true)
 {
  
rsUn();
  
Un();
  
Sleep(10);
 }
 
  
Reset_Pointer(Device_InterfacePresentationParameters);
  if(
sil == true)
  {
 
rsHo();
 
Ho();
  }
  
  
}
//=====================================================================================

//=====================================================================================
void WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE8 Device_InterfaceD3DPRIMITIVETYPE Type
                                           
UINT MinIndexUINT NumVerticesUINT StartIndexUINT PrimitiveCount)
{
 if(
sil == true)
  
Un(); // UnHook DIP
 
  
LPDIRECT3DVERTEXBUFFER8 Stream_Data;
  
UINT Stride 0;
  if(
Device_Interface->GetStreamSource(0, &Stream_Data, &Stride) == D3D_OK)
  
Stream_Data->Release();
  if(
Stride == 40 || Stride == 44 )
  {   
   
Device_Interface->SetRenderState(D3DRS_LIGHTING,false);
   
   
Device_Interface->SetRenderState(D3DRS_ZENABLED3DZB_FALSE);
   
Device_Interface->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
   
Device_Interface->SetRenderState(D3DRS_FILLMODED3DFILL_WIREFRAME);
   
Device_Interface->SetRenderState(D3DRS_CULLMODED3DCULL_CW);
   
Device_Interface->SetRenderState(D3DRS_CULLMODED3DCULL_CCW);
   
DrawIndexedPrimitive_PointerDevice_InterfaceTypeMinIndexNumVerticesStartIndexPrimitiveCount);
   
Device_Interface->SetRenderState(D3DRS_FILLMODED3DFILL_SOLID);
   
Device_Interface->SetRenderState(D3DRS_ZENABLED3DZB_TRUE);
   
Device_Interface->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
   
Device_Interface->SetRenderState(D3DRS_CULLMODED3DCULL_CW);
   
Device_Interface->SetRenderState(D3DRS_CULLMODED3DCULL_CCW);
  }
   
DrawIndexedPrimitive_Pointer(Device_InterfaceTypeMinIndexNumVerticesStartIndexPrimitiveCount);
    if(
sil == true)
   
Ho(); // Hook 
}
//=====================================================================================
DWORD WINAPI CodePatching(LPVOID Param)
{
 
UNREFERENCED_PARAMETER(Param);   
// *(PDWORD)&Direct3D_VMTable[14] = *(PDWORD)&Reset_Pointer;    
//    *(PDWORD)&Direct3D_VMTable[71] = *(PDWORD)&DrawIndexedPrimitive_Pointer;
 
 
haru(NULL);  
 return 
1;
}
DWORD WINAPI haruvoid)

 
Sleep(50000); // Pass GG
 
HANDLE h1 CreateThread(NULL0gogogoNULL0NULL);
// HANDLE h2 = CreateThread(NULL, 0, goRs, NULL, 0, NULL); 
// HANDLE h[2] = { h1, h2 };  
// WaitForMultipleObjects ( 2, h, TRUE, INFINITE);
 
WaitForSingleObjecth1INFINITE);
 
CloseHandleh1 );
// CloseHandle( h2 ); 
// *(PDWORD)&Direct3D_VMTable[14] = *(PDWORD)&Reset_Pointer;
// *(PDWORD)&Direct3D_VMTable[71] = *(PDWORD)&DrawIndexedPrimitive_Pointer;
 
 
return 1;
 
}
DWORD WINAPI goRsvoid)
{
 
// codepatching
 
int nj;
 
rsSIZE 5;
 for( 
0jnj++)
 {
  
rstempJMP[j] = 0x90;
 }
 
rstempJMP[n] = 0xE9;
 
 
rspOrigMBAddress = *(PDWORD)&Reset_Pointer ;   
 
rsJMPSize = (DWORD)Reset_Detour - (DWORD)rspOrigMBAddress rsSIZE
 
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTE_READWRITE, &rsoldProtect);
 
 
memcpy(rsbackUp, (const void*)rspOrigMBAddressrsSIZE);
 
memcpy(&rstempJMP[rsSIZE 4], &rsJMPSize4); 
 
memcpy((LPVOID)rspOrigMBAddress, (void *)rstempJMPrsSIZE);   
 
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTENULL); 
 return 
1;
}
DWORD WINAPI gogogovoid)

  
// codepatching
 
int nj;
 
SIZE 5;
 for( 
0jnj++)
 {
  
tempJMP[j] = 0x90;
 }
 
tempJMP[n] = 0xE9
 
pOrigMBAddress = *(PDWORD)&DrawIndexedPrimitive_Pointer ;  
 
 
JMPSize = (DWORD)DrawIndexedPrimitive_Detour - (DWORD)pOrigMBAddress SIZE;
 
 
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTE_READWRITE, &oldProtect);  
 
memcpy(backUp, (const void*)pOrigMBAddressSIZE);
 
memcpy(&tempJMP[SIZE 4], &JMPSize4); 
 
memcpy((LPVOID)pOrigMBAddress, (void *)tempJMPSIZE);    
 
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTENULL); 
  
sil true;
 return 
1;
}
void Un()

   
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTE_READWRITE, &oldProtect); 
   
memcpy((LPVOID)pOrigMBAddress, (void *)backUpSIZE);   
   
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTE_READNULL);
}
void Ho()

  
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTE_READWRITE, &oldProtect);
  
memcpy((LPVOID)pOrigMBAddress, (void *)tempJMPSIZE);      
  
VirtualProtect((LPVOID)pOrigMBAddressSIZEPAGE_EXECUTE_READNULL);
}
void rsUn()
{
   
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTE_READWRITE, &rsoldProtect);
   
memcpy((LPVOID)rspOrigMBAddress, (void *)rsbackUprsSIZE);      
   
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTE_READNULL);
}
void rsHo()
{
 
  
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTE_READWRITE, &rsoldProtect); 
  
memcpy((LPVOID)rspOrigMBAddress, (void *)rstempJMPrsSIZE);      
  
VirtualProtect((LPVOID)rspOrigMBAddressrsSIZEPAGE_EXECUTE_READNULL); 

Would advice me some method plz...T.T
datastation123 is offline

Reply With Quote

Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
createdevice, hook, trouble
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 11:19 AM.