unknowncheats uc-forum.com ucdownloads ucdownloads.com

Go Back   UC-Tutorials - Multiplayer Game Hacking and Cheat Tutorials > First-Person Shooters > Other FPS Games

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


Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2010, 05:03 AM
disco disco is offline
Administrator
 
Join Date: Feb 2010
Posts: 271
Default KoS Wallhack

Posted by shqiptari.




Hi, I downloaded KOS and using Roverturbos D3D9 inteface hook I made this wallhack, as I can only really do D3D this is it, I hope this can be a platform on which you guys can build on and share.

Most characters are logged but as the game has a LOD feature I couldn't log all of them.

Credits: Roverturbo, Me and everyone else who has contributed to this wallhack

PHP Code:
#include <windows.h>
#include <d3d9.h>
#pragma comment(lib, "d3d9.lib")
#include <d3dx9.h>
#pragma comment(lib, "d3dx9.lib")
float ScreenCenterX 0.0f;
float ScreenCenterY 0.0f;
bool Xhair;
bool Chams;
int texnum;
int m_Stride;
LPDIRECT3DTEXTURE9 Red,Yellow,Green,Blue,Purple,Pink,Orange,Black,White;
D3DCOLOR colRed D3DCOLOR_XRGB(25500);
D3DVIEWPORT9 g_ViewPort;
 
typedef HRESULT (WINAPICreateDevice_Prototype) (LPDIRECT3D9UINTD3DDEVTYPEHWNDDWORDD3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
typedef HRESULT (WINAPIReset_Prototype) (LPDIRECT3DDEVICE9D3DPRESENT_PARAMETERS*);
typedef HRESULT (WINAPIEndScene_Prototype) (LPDIRECT3DDEVICE9);
typedef HRESULT (WINAPIDrawIndexedPrimitive_Prototype)(LPDIRECT3DDEVICE9D3DPRIMITIVETYPEINTUINTUINTUINTUINT);
CreateDevice_Prototype CreateDevice_Pointer NULL;
Reset_Prototype Reset_Pointer NULL;
EndScene_Prototype EndScene_Pointer NULL;
DrawIndexedPrimitive_Prototype DrawIndexedPrimitive_Pointer NULL;
HRESULT WINAPI Direct3DCreate9_VMTable (VOID);
HRESULT WINAPI CreateDevice_Detour (LPDIRECT3D9UINTD3DDEVTYPEHWNDDWORDD3DPRESENT_PARAMETERS*, LPDIRECT3DDEVICE9*);
HRESULT WINAPI Reset_Detour (LPDIRECT3DDEVICE9D3DPRESENT_PARAMETERS*);
HRESULT WINAPI EndScene_Detour (LPDIRECT3DDEVICE9);
HRESULT WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE9D3DPRIMITIVETYPEINTUINTUINTUINTUINT);
DWORD WINAPI VirtualMethodTableRepatchingLoopToCounterExtensionRepatching(LPVOID);
PDWORD Direct3D_VMTable NULL;
 
BOOL WINAPI DllMain(HINSTANCE hinstModuleDWORD dwReasonLPVOID lpvReserved)
{
if(
dwReason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hinstModule);
if(
Direct3DCreate9_VMTable() == D3D_OK)
return 
TRUE;
}
return 
FALSE;
}
 
HRESULT WINAPI Direct3DCreate9_VMTable(VOID)
{
LPDIRECT3D9 Direct3D_Object Direct3DCreate9(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[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
{
*(
PDWORD)&CreateDevice_Pointer Direct3D_VMTable[16];
*(
PDWORD)&Direct3D_VMTable[16] = (DWORD)CreateDevice_Detour;
if(
VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
return 
D3DERR_INVALIDCALL;
}
else
return 
D3DERR_INVALIDCALL;
return 
D3D_OK;
}
HRESULT GenerateTexture(IDirect3DDevice9 *pD3DdevIDirect3DTexture9 **ppD3DtexDWORD colour32)
{
if( 
FAILED(pD3Ddev->CreateTexture(8810D3DFMT_A4R4G4B4D3DPOOL_MANAGEDppD3DtexNULL)) )
return 
E_FAIL;
 
WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
|(
WORD)(((colour32>>20)&0xF)<<8)
|(
WORD)(((colour32>>12)&0xF)<<4)
|(
WORD)(((colour32>>4)&0xF)<<0);
D3DLOCKED_RECT d3dlr;
(*
ppD3Dtex)->LockRect(0, &d3dlr00);
WORD *pDst16 = (WORD*)d3dlr.pBits;
for(
int xy=0xy 8*8xy++)
*
pDst16++ = colour16;
(*
ppD3Dtex)->UnlockRect(0);
return 
S_OK;
}
 
HRESULT WINAPI CreateDevice_Detour(LPDIRECT3D9 Direct3D_ObjectUINT AdapterD3DDEVTYPE DeviceTypeHWND FocusWindow,
DWORD BehaviorFlagsD3DPRESENT_PARAMETERSPresentationParameters,
LPDIRECT3DDEVICE9Returned_Device_Interface)
{
HRESULT Returned_Result CreateDevice_Pointer(Direct3D_ObjectAdapterDeviceTypeFocusWindowBehaviorFlags,
PresentationParametersReturned_Device_Interface);
 
DWORD dwProtect;
if(
VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), PAGE_READWRITE, &dwProtect) != 0)
{
*(
PDWORD)&Direct3D_VMTable[16] = *(PDWORD)&CreateDevice_Pointer;
CreateDevice_Pointer NULL;
if(
VirtualProtect(&Direct3D_VMTable[16], sizeof(DWORD), dwProtect, &dwProtect) == 0)
return 
D3DERR_INVALIDCALL;
}
else
return 
D3DERR_INVALIDCALL;
if(
Returned_Result == D3D_OK)
{
Direct3D_VMTable = (PDWORD)*(PDWORD)*Returned_Device_Interface;
*(
PDWORD)&Reset_Pointer = (DWORD)Direct3D_VMTable[16];
*(
PDWORD)&EndScene_Pointer = (DWORD)Direct3D_VMTable[42];
*(
PDWORD)&DrawIndexedPrimitive_Pointer = (DWORD)Direct3D_VMTable[82];
if(
CreateThread(NULL0VirtualMethodTableRepatchingLoopToCounterExtensionRepatchingNULL0NULL) == NULL)
return 
D3DERR_INVALIDCALL;
}
 
return 
Returned_Result;
}
 
HRESULT WINAPI Reset_Detour(LPDIRECT3DDEVICE9 Device_InterfaceD3DPRESENT_PARAMETERSPresentationParameters)
{
return 
Reset_Pointer(Device_InterfacePresentationParameters);
}
 
HRESULT WINAPI EndScene_Detour(LPDIRECT3DDEVICE9 Device_Interface)
{
Device_Interface->GetViewport(&g_ViewPort);
ScreenCenterX = (float)g_ViewPort.Width 2;
ScreenCenterY = (float)g_ViewPort.Height 2;
GenerateTexture(Device_Interface, &RedD3DCOLOR_ARGB (255,255,,));
GenerateTexture(Device_Interface, &YellowD3DCOLOR_ARGB (255,255,255,));
GenerateTexture(Device_Interface, &GreenD3DCOLOR_ARGB (255,,255,));
GenerateTexture(Device_Interface, &BlueD3DCOLOR_ARGB (255,,,255));
GenerateTexture(Device_Interface, &PurpleD3DCOLOR_ARGB (255,102,,153));
GenerateTexture(Device_Interface, &PinkD3DCOLOR_ARGB (255,255,20 ,147));
GenerateTexture(Device_Interface, &OrangeD3DCOLOR_ARGB (255,255,165,));
GenerateTexture(Device_Interface, &BlackD3DCOLOR_ARGB (255,,,));
GenerateTexture(Device_Interface, &WhiteD3DCOLOR_ARGB (255,255,255,255));
if (
Xhair)
{
D3DRECT rec2 = {ScreenCenterX-8ScreenCenterYScreenCenterX+8ScreenCenterY+1};
D3DRECT rec3 = {ScreenCenterXScreenCenterY-8ScreenCenterX+1ScreenCenterY+8};
Device_Interface->Clear(1, &rec2D3DCLEAR_TARGET,colRed00);
Device_Interface->Clear(1, &rec3D3DCLEAR_TARGET,colRed00);
}
if(
GetAsyncKeyState(VK_F1)&1){Xhair=!Xhair;}
if(
GetAsyncKeyState(VK_F2)&1){Chams=!Chams;}
return 
EndScene_Pointer(Device_Interface);
}
 
HRESULT WINAPI DrawIndexedPrimitive_Detour(LPDIRECT3DDEVICE9 Device_InterfaceD3DPRIMITIVETYPE TypeINT BaseIndex,
UINT MinIndexUINT NumVerticesUINT StartIndexUINT PrimitiveCount)
{
LPDIRECT3DVERTEXBUFFER9 Stream_Data;
UINT Offset 0;
UINT Stride 0;
if(
Device_Interface->GetStreamSource(0, &Stream_Data, &Offset, &Stride) == D3D_OK)
Stream_Data->Release();
texnum=(NumVertices*100000)+PrimitiveCount;
if (
Chams)
{
if(
m_Stride==64 &&
texnum==38100636||texnum==8600144||//Head
texnum==160502262||texnum==173701916||texnum==233202809||texnum==155102162||texnum==243202958||texnum==113501506||texnum==102201072)//Body
{
Device_Interface->SetRenderState(D3DRS_ZENABLED3DZB_FALSE);
Device_Interface->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
Device_Interface->SetTexture(0,Pink);
DrawIndexedPrimitive_Pointer(Device_InterfaceTypeBaseIndexMinIndexNumVerticesStartIndexPrimitiveCount);
Device_Interface->SetRenderState(D3DRS_ZENABLED3DZB_TRUE);
Device_Interface->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
Device_Interface->SetTexture(0,Orange);
}
}
return 
DrawIndexedPrimitive_Pointer(Device_InterfaceTypeBaseIndexMinIndexNumVerticesStartIndexPrimitiveCount);
}
 
DWORD WINAPI VirtualMethodTableRepatchingLoopToCounterExtensionRepatching(LPVOID Param)
{
UNREFERENCED_PARAMETER(Param);
while(
1)
{
Sleep(100);
*(
PDWORD)&Direct3D_VMTable[42] = (DWORD)EndScene_Detour;
*(
PDWORD)&Direct3D_VMTable[82] = (DWORD)DrawIndexedPrimitive_Detour;
*(
PDWORD)&Direct3D_VMTable[16] = (DWORD)Reset_Detour;
}
return 
1;

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
kos, wallhack

Thread Tools
Display Modes

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



All times are GMT. The time now is 05:22 AM.