Hack Forums
[C] [TuT] .DLL Injection (Games) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] [TuT] .DLL Injection (Games) (/showthread.php?tid=363480)

Pages: Pages 1 2


* - PoZHx - May 5, 2010

@The One:
Code
DWORD PCross = NULL;

_declspec(naked) void PremCross()
{
    __asm
    {
        jmp PCross;
    }
}

Would not jump to an address...
Within __ASM you shouldn't know the addresses
You should really push address onto stack and ret or
move the address into register (e.g. EAX) but that way is more detectable since your leaving modified register

You should really use some Code-Injection for your hacks instead of writting to memory with:
Code
*(float*)(ADR_SPEED) = 200;

Microsoft MSDetours ? If so it leaves behind 0xE8 bytes which are detectable by Anti-Cheating software.
Code
DetourFunc

Code
memcpy((LPBYTE*)ADR_PREMIUMCROSSHAIR1, (BYTE*)"\x0F\x84\x86\x01\x00\x00",6); // Function will be turned off

You have direct access to memory you don't have to call this internal function.

Tip/advise: You could made a function which backup previous bytes before modifying them.. which makes it easier to toogle options.

Finally your DLL code is very messy:
e.g.
Code
void HackThread() // HackThread makes the hack inject
{
for(;; )
{
SpeedHack(); // This puts the hack on.
}
Sleep(200); // Protect from overload
}

Why not just write it like:

Code
void HackThread() // HackThread makes the hack inject
{
for(;;Sleep(200))
{
// Your hack here instead of calling a function
}

Your not dealing with attach/deattach thread messages in your DLL
why not disable them? save you more memory

There is alot of other things i could suggest but i hope these have being helpful :)


* - The-One - May 5, 2010

(May 2, 2010 11:12 AM)Vibe Wrote:  Would this work in Counter-Strike ?
Yes it would.

(May 3, 2010 04:04 AM)ztrain Wrote:  how would you write something that scans for a memory address like cheat engine?
we are making a game in our programing class, and the teacher is going to have a rigged character. hes going to be standing there so i cant use CE to scan for addresses, so how would i do this in code?
Use a debugger? (IDA pro/Olly DBG)

(May 4, 2010 05:14 AM)Justsomeguy Wrote:  If i could +rep you i should do it very nice organized i suck at reading topics like this but this one totally helped me out thank you dude :)
No problem.

(May 5, 2010 10:13 AM)PoZHx Wrote:  @The One:
Code
DWORD PCross = NULL;

_declspec(naked) void PremCross()
{
    __asm
    {
        jmp PCross;
    }
}

Would not jump to an address...
Within __ASM you shouldn't know the addresses
You should really push address onto stack and ret or
move the address into register (e.g. EAX) but that way is more detectable since your leaving modified register

You should really use some Code-Injection for your hacks instead of writting to memory with:
Code
*(float*)(ADR_SPEED) = 200;

Microsoft MSDetours ? If so it leaves behind 0xE8 bytes which are detectable by Anti-Cheating software.
Code
DetourFunc

Code
memcpy((LPBYTE*)ADR_PREMIUMCROSSHAIR1, (BYTE*)"\x0F\x84\x86\x01\x00\x00",6); // Function will be turned off

You have direct access to memory you don't have to call this internal function.

Tip/advise: You could made a function which backup previous bytes before modifying them.. which makes it easier to toogle options.

Finally your DLL code is very messy:
e.g.
Code
void HackThread() // HackThread makes the hack inject
{
for(;; )
{
SpeedHack(); // This puts the hack on.
}
Sleep(200); // Protect from overload
}

Why not just write it like:

Code
void HackThread() // HackThread makes the hack inject
{
for(;;Sleep(200))
{
// Your hack here instead of calling a function
}

Your not dealing with attach/deattach thread messages in your DLL
why not disable them? save you more memory

There is alot of other things i could suggest but i hope these have being helpful :)

I've been using this way for a few years and it works fine for me.
I have a function with automatically gets the off bytes for a address.
Microsoft Detours will work, i'm using an bypass which bypass the whole anti cheat.


* - PoZHx - May 6, 2010

(May 5, 2010 11:08 AM)The-One Wrote:  I have a function with automatically gets the off bytes for a address.

Cool since i thought your actual coding was very uneffective and messy.

(May 5, 2010 11:08 AM)The-One Wrote:  Microsoft Detours will work, i'm using an bypass which bypass the whole anti cheat.

Yeah it may work but still it's more easy to detect and requires you to
accept Microsoft Detours Licence argeement and not very efficent as writting your own.


* - greed460 - May 7, 2010

Hah. I was about to write nearly the same as pozhx


* - The-One - May 8, 2010

(May 6, 2010 10:47 AM)PoZHx Wrote:  Cool since i thought your actual coding was very uneffective and messy.

(May 5, 2010 11:08 AM)The-One Wrote:  Microsoft Detours will work, i'm using an bypass which bypass the whole anti cheat.

Yeah it may work but still it's more easy to detect and requires you to
accept Microsoft Detours Licence argeement and not very efficent as writting your own.

True.

(May 7, 2010 02:24 PM)greed460 Wrote:  Hah. I was about to write nearly the same as pozhx

No problem then.


* - AntiH4x - May 8, 2010

That isnt a universal speed hack... There is more to hooking games than what you think... Why not just learn some DirectX & go from there =D

I was coding Aimbots/Bots for a variety of games, Unreal Tournament 2003/2004/Tactical Ops/Counter-Strike 1.6 etc, almost 3-4 years ago before joining the military.. I havent touched code since & I regret it..

This site is a MUST for game development!

http://forum.gamedeception.net

There IRC can be located here!

irc.rizon.net

#game-deception



You will be thanking me for this later, trust me! There all game coders so literally anything/everything you will/would ever need can be covered there! The IRC is laid back too!


* - Haxor94 - May 8, 2010

I have a hacking project but how i make it .exe so ppl can open it and shit please help me out :D?


* - The-One - May 8, 2010

(May 8, 2010 07:23 AM)Haxor94 Wrote:  I have a hacking project but how i make it .exe so ppl can open it and shit please help me out :D?

You have to compile/build it.