


#include "stdafx.h"
#include "stdafx.h"
#include <windows.h>
#include <shellapi.h>
#pragma comment(lib,"shell32.lib")
void __cdecl PushToConsole( const char* szCommand )
{
DWORD *L***ient = ( DWORD* )( 0x37775D68 );
void* CONoff = ( void* )*( DWORD* )( *L***ient + 0x208 );
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void MemCopy(void* Dest, const void* Src, int Len)
{
DWORD OldProtect;
DWORD OldProtect2;
VirtualProtect(Dest, Len, PAGE_EXECUTE_READWRITE, &OldProtect);
memcpy(Dest, Src, Len);
VirtualProtect(Dest, Len, OldProtect, &OldProtect2);
FlushInstructionCache(GetCurrentProcess(), Dest, Len);
DWORD GetAddressPtr(int index)
{
DWORD dwBase = *(DWORD*)dwDevicePointer;
if(dwBase == 0) return 0;
dwBase = *(DWORD*)dwBase;
if(dwBase == 0) return 0;
dwBase = *(DWORD*)dwBase;
if(dwBase == 0) return 0;
return dwBase+4*index;
}
DWORD GetD3DHSApi(int index)
{
DWORD dwVA = dwHSDevicePointer;
if(IsBadReadPtr((void*)dwVA, 4)) return 0;
dwVA = *(DWORD*)dwVA;
if(!dwVA || IsBadReadPtr((void*)dwVA, 0x200)) return 0;
return dwVA + (4*index);
}
#define HOOKD3DAPI(a, b) \
if(*(DWORD*)GetAddressPtr(b) != (DWORD)&hk##a) { \
p##a = (a##_t) *(DWORD*)GetAddressPtr(b); \
*(DWORD*)GetAddressPtr(b) = (DWORD)&hk##a; \
*(DWORD*)GetD3DHSApi(b) = (DWORD)&hk##a; \
}
DWORD WINAPI HookD3DApis(LPVOID)
{
bool bValid = false;
while(true) {
bValid = GetAddressPtr(0) > 0;
if(bValid) {
HOOKD3DAPI(Reset, 16)
HOOKD3DAPI(EndScene, 42)
HOOKD3DAPI(DrawIndexedPrimitive, 82)
HOOKD3DAPI(SetStreamSource, 100)
}
Sleep(300);
}
return 1;
}
dwHSDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(ehsvc), 0x90000, (PBYTE)"\x8B\x84\x11\x00\x00\x00\x00\x8B\x8D\xCC\x FD\xFF\xFF\x8B\x95", "xxx????xxxxxxxx");
if(dwHSDevicePointer) {
dwHSDevicePointer = *(DWORD*)(dwHSDevicePointer+3);
dwHSDevicePointer += 0x10;
}
DWORD dwTempDevicePointer = g_pTools->dwFindPattern((DWORD)GetModuleHandle(0), (DWORD)0xFFFFFFFF, (PBYTE)"\xA1\x00\x00\x00\x00\x89\x45\xF8\x8D", "x????xxxx");
if(dwTempDevicePointer) {
dwDevicePointer = *(DWORD*)(dwTempDevicePointer+1);
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
ShellExecute;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&main, NULL, 0,NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
#include "stdafx.h"
#include <windows.h>
#include <shellapi.h>
#pragma comment(lib,"shell32.lib")
void __cdecl PushToConsole( const char* szCommand )
{
DWORD *L***ient = ( DWORD* )( 0x3776FCC8 );
void* CONoff = ( void* )*( DWORD* )( *L***ient + 0x208 );
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void MemCopy(void* Dest, const void* Src, int Len)
{
DWORD OldProtect;
DWORD OldProtect2;
VirtualProtect(Dest, Len, PAGE_EXECUTE_READWRITE, &OldProtect);
memcpy(Dest, Src, Len);
VirtualProtect(Dest, Len, OldProtect, &OldProtect2);
FlushInstructionCache(GetCurrentProcess(), Dest, Len);
}
void main()
{
MessageBoxA(NULL," Mike's first hack ","Using Bravia's Source",MB_OK);
while (!IsGameReadyForHook()){
Sleep(20);
}
bool boxes = false;
bool fog = false;
bool ammo = false;
bool speed = false;
bool spread = false;
bool tracers = false;
bool showfps = false;
bool unlockcursor = false;
bool drawgun = false;
bool sjump = false;
bool recoil = false;
bool wireframe = false;
bool windows = false;
bool respawn = false;
bool act = false;
bool glitcher = false;
bool skeleton = false;
bool breath = false;
bool name = false;
bool nosway = false;
PushToConsole("FallDamageMinHeight 0.000000");
PushToConsole("FallDamageMaxHeight 0.000000");
PushToConsole("FallDamageMax 0.000000");
while(true){
if(GetAsyncKeyState(VK_NUMPAD1)<0){
if(boxes){
PushToConsole("ModelDebug_DrawBoxes 0");
PushToConsole("SkelModelStencil 0");
boxes = false;
} else {
PushToConsole("ModelDebug_DrawBoxes 1");
PushToConsole("SkelModelStencil 1");
boxes = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD2)<0){
if(fog){
PushToConsole("FogEnable 1");
fog = false;
} else {
PushToConsole("FogEnable 0");
fog = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD3)<0){
if(speed){
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 500.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 6000.000000");
PushToConsole("WalkVel 70.000000");
PushToConsole("FRunVel 285.000000");
PushToConsole("BRunVel 285.000000");
PushToConsole("SRunVel 285.000000");
PushToConsole("DuckVel 50.000000");
speed = false;
} else {
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 3000.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 3000.000000");
PushToConsole("WalkVel 3000.000000");
PushToConsole("FRunVel 3000.000000");
PushToConsole("BRunVel 3000.000000");
PushToConsole("SRunVel 3000.000000");
PushToConsole("DuckVel 3000.000000");
speed = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD4)<0){
if(spread){
PushToConsole("PerturbRotationEffect 3.000000");
PushToConsole("PerturbIncreaseSpeed 3.000000");
PushToConsole("PerturbDecreaseSpeed 9.000000");
PushToConsole("PerturbWalkPercent 0.500000");
PushToConsole("PerturbRecoil 9.000000");
PushToConsole("FireMovePerturb 9.000000");
PushToConsole("ZoomedFireMoveDuckPerturb 9.000000");
PushToConsole("ZoomedFireMovePerturb 9.000000");
PushToConsole("ZoomedFireDuckPerturb 9.000000");
spread = false;
} else {
PushToConsole("PerturbRotationEffect 0.000000");
PushToConsole("PerturbIncreaseSpeed 0.000000");
PushToConsole("PerturbWalkPercent 0.000000");
PushToConsole("PerturbFiringIncreaseSpeed 0.000000");
PushToConsole("PerturbRecoil 0.000000");
PushToConsole("FireMovePerturb 0.000000");
PushToConsole("ZoomedFireMoveDuckPerturb 0.000000");
PushToConsole("ZoomedFireMovePerturb 0.000000");
PushToConsole("ZoomedFireDuckPerturb 0.000000");
spread = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD5)<0){
if(tracers){
PushToConsole("ShowFirePath 0");
tracers = false;
} else {
PushToConsole("ShowFirePath 1");
tracers = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD6)<0){
if(sjump){
PushToConsole("JumpVel 330.000000");
sjump = false;
} else {
PushToConsole("JumpVel 660.000000");
sjump = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD7)<0){
if(showfps){
PushToConsole("ShowFps 0");
showfps = false;
} else {
PushToConsole("ShowFps 1");
showfps = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD8)<0){
if(unlockcursor){
PushToConsole("CursorCenter 1");
unlockcursor = false;
} else {
PushToConsole("CursorCenter 0");
unlockcursor = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD9)<0){
if(drawgun){
PushToConsole("drawguns 1");
drawgun = false;
} else {
PushToConsole("drawguns 0");
drawgun = true;
}
}
if(GetAsyncKeyState(VK_PRIOR)<0){
if(respawn){
PushToConsole("DyingTime 3500.000000");
respawn = false;
} else {
PushToConsole("DyingTime 0");
PushToConsole("DeadCameraTime 0");
respawn = true;
}
}
if(GetAsyncKeyState(VK_NEXT)<0){
if(act){
PushToConsole("ActivationDistance 10");
act = false;
} else {
PushToConsole("ActivationDistance 100000");
act = true;
}
}
if(GetAsyncKeyState(VK_F11)<0){
if(nosway){
PushToConsole("WeaponSway 1.000000");
nosway = false;
} else {
PushToConsole("WeaponSway 0.000000");
nosway = true;
}
}
if(GetAsyncKeyState(VK_F10)<0){
if(recoil){
PushToConsole("DuckDownCamOffSet -13.000000");
recoil = false;
} else {
PushToConsole("CamMaxPosYOffset 200.000000");
PushToConsole("DuckDownCamOffSet 1000.000000");
recoil = true;
}
}
if(GetAsyncKeyState(VK_F12)<0){
if(glitcher){
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 500.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 6000.000000");
PushToConsole("WalkVel 70.000000");
PushToConsole("FRunVel 285.000000");
PushToConsole("BRunVel 285.000000");
PushToConsole("SRunVel 285.000000");
PushToConsole("DuckVel 50.000000");
glitcher = false;
} else {
PushToConsole("BaseMoveAccel 90000.000000");
PushToConsole("StartAccel 90000.000000");
PushToConsole("MaxAccel 90000.000000");
PushToConsole("AccelInc 90000.000000");
PushToConsole("WalkVel 90000.000000");
PushToConsole("FRunVel 90000.000000");
PushToConsole("BRunVel 90000.000000");
PushToConsole("SRunVel 90000.000000");
glitcher = true;
}
}
if(GetAsyncKeyState(VK_UP)<0){
PushToConsole("PlayerGravity +800");
}
if(GetAsyncKeyState(VK_DOWN)<0){
PushToConsole("PlayerGravity -800");
}
if(GetAsyncKeyState(VK_MULTIPLY)<0){
PushToConsole("PlayerGravity 0");
}
if(GetAsyncKeyState(VK_INSERT)<0){
PushToConsole("ActivationDistance 1000");
}
if(GetAsyncKeyState(VK_F7)<0){
PushToConsole("FragSelf 1");
}
if(GetAsyncKeyState(VK_F6)<0){
if(ammo){
PushToConsole("IsAmmo 0");
PushToConsole("ShotsPerClip 0");
ammo = false;
} else {
PushToConsole("IsAmmo 1");
PushToConsole("ShotsPerClip 1");
ammo = true;
}
}
if(GetAsyncKeyState(VK_DELETE)<0){
PushToConsole("CrossHair_DefaultLength 50");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 2");
PushToConsole("CrosshairBarMin 100");
PushToConsole("CrosshairBarMax 100");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
}
if(GetAsyncKeyState(VK_HOME)<0){
if(wireframe){
PushToConsole("WireFrame 0");
wireframe = false;
} else {
PushToConsole("WireFrame 1");
wireframe = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD0)<0){
if(breath){
PushToConsole("ShowBreath 0");
breath = false;
} else {
PushToConsole("ShowBreath 1");
breath = true;
}
}
if(GetAsyncKeyState(VK_F9)<0){
if(skeleton){
PushToConsole("ModelDebug_DrawSkeleton 0");
skeleton = false;
} else {
PushToConsole("ModelDebug_DrawSkeleton 1");
skeleton = true;
}
}
if(GetAsyncKeyState(VK_END)<0){
if(windows){
PushToConsole("Windowed 0");
windows = false;
} else {
PushToConsole("Windowed 1");
windows = true;
}
}
if(GetAsyncKeyState(VK_MENU)<0){
if(name){
PushToConsole("ModeFullName 0");
name = false;
} else {
PushToConsole("ModeFullName 1");
name = true;
}
}
Sleep(20);
}
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
ShellExecute;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&main, NULL, 0,NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
1>------ Build started: Project: Compilehlp, Configuration: Release Win32 ------
1>Compiling...
1>Main.cpp
1>.\Main.cpp(6) : error C2143: syntax error : missing ';' before '*'
1>.\Main.cpp(6) : error C2065: 'ient' : undeclared identifier
1>.\Main.cpp(7) : error C2065: 'ient' : undeclared identifier
1>.\Main.cpp(35) : error C2601: 'GetAddressPtr' : local function definitions are illegal
1> .\Main.cpp(26): this line contains a '{' which has not yet been matched
1>.\Main.cpp(49) : error C2601: 'GetD3DHSApi' : local function definitions are illegal
1> .\Main.cpp(26): this line contains a '{' which has not yet been matched
1>.\Main.cpp(70) : error C2601: 'HookD3DApis' : local function definitions are illegal
1> .\Main.cpp(26): this line contains a '{' which has not yet been matched
1>.\Main.cpp(87) : error C2065: 'dwHSDevicePointer' : undeclared identifier
1>.\Main.cpp(87) : error C2065: 'g_pTools' : undeclared identifier
1>.\Main.cpp(87) : error C2227: left of '->dwFindPattern' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Main.cpp(87) : error C2065: 'ehsvc' : undeclared identifier
1>.\Main.cpp(87) : error C2153: hex constants must have at least one hex digit
1>.\Main.cpp(88) : error C2065: 'dwHSDevicePointer' : undeclared identifier
1>.\Main.cpp(89) : error C2065: 'dwHSDevicePointer' : undeclared identifier
1>.\Main.cpp(89) : error C2065: 'dwHSDevicePointer' : undeclared identifier
1>.\Main.cpp(90) : error C2065: 'dwHSDevicePointer' : undeclared identifier
1>.\Main.cpp(93) : error C2065: 'g_pTools' : undeclared identifier
1>.\Main.cpp(93) : error C2227: left of '->dwFindPattern' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>.\Main.cpp(95) : error C2065: 'dwDevicePointer' : undeclared identifier
1>.\Main.cpp(102) : error C2601: 'DllMain' : local function definitions are illegal
1> .\Main.cpp(26): this line contains a '{' which has not yet been matched
1>.\Main.cpp(116) : fatal error C1075: end of file found before the left brace '{' at '.\Main.cpp(26)' was matched
1>Build log was saved at "file://c:\Users\zackary.BIRDFAMILY\Documents\Visual Studio 2008\Projects\Compilehlp\Compilehlp\Release\BuildLog.htm"
1>Compilehlp - 20 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========