Results 1 to 11 of 11
  1. #1
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky

    [CoD4] COPY PASTE INSIDE K?

    Bored, have fun
    Did not test the toggles ingame yet, they worked fine before I added toggles.
    I know GetAsyncKeyState is not the way to go, its just a quick edit of this old code(that me and couch made when 1.7 patch was first released)

    dectected

    main.cpp:
    Code:
    #include <windows.h>
    #include "patch.h"
    
    bool bWallHack=false;
    bool bNoRecoil=false;
    bool bXHair=false;
    bool bNameTags=false;
    
    unsigned char *playerFlag = (unsigned char*)0x00445480;
    unsigned char xwallhackpatch[2] = { 0x6a, 0x12 }; // push 12, patched
    unsigned char owallhackpatch[2];// copy unpatched
    
    unsigned long *fireRecoil = (unsigned long*)0x00457D2E;
    unsigned char oRecoilPatch[5];
    
    unsigned long *xHair = (unsigned long*)0x00430B50;
    unsigned char oXHairPatch[10];
    
    unsigned long *xTeamcheck = (unsigned long*)0x0042E1AC; //Orig 0x0F 0x85 0xCE 0x00 0x00 0x00
    unsigned long *xVisible = (unsigned long*)0x0042E1CE; //Orig 0x74 0x25
    unsigned char oTeamCheckPatch[6] = { 0x0F, 0x85, 0xCE, 0x00, 0x00, 0x00 };
    unsigned char oVisiblePatch[2] = { 0x74, 0x25 };
    
    void doWallhack(void)
    {
    	unsigned long orig;
    	if(bWallHack==false)
    	{
    		VirtualProtect(playerFlag, sizeof(xwallhackpatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(playerFlag, &xwallhackpatch, sizeof(xwallhackpatch));
    		VirtualProtect(playerFlag, sizeof(xwallhackpatch), orig, &orig);
    		bWallHack=true;
    	}
    	else
    	{
    		VirtualProtect(playerFlag, sizeof(owallhackpatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(playerFlag, &owallhackpatch, sizeof(owallhackpatch));
    		VirtualProtect(playerFlag, sizeof(owallhackpatch), orig, &orig);
    		bWallHack=false;
    	}
    }
    
    // recoil offset + patch
    
    void doNoRecoil(void)
    {
    	unsigned long orig;
    	if(bNoRecoil==false)
    	{
    		writeNOP(fireRecoil, 5);
    		bNoRecoil=true;
    	}
    	else
    	{
    		VirtualProtect(fireRecoil, sizeof(oRecoilPatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(fireRecoil, &oRecoilPatch, sizeof(oRecoilPatch));
    		VirtualProtect(fireRecoil, sizeof(oRecoilPatch), orig, &orig);
    		bNoRecoil=false;
    	}
    }
    
    // xhair offset + patch
    
    void doXHair(void)
    {
    	unsigned long orig;
    	if(bXHair==false)
    	{
    		writeNOP(xHair, 10); // nop padding to prevent overwriting bytes
    		changeBYTEPTR(0xB8, xHair); //mov eax,
    		changeDWORDPTR(0x1, (unsigned long*)(xHair + 1)); // 1
    		changeBYTEPTR(0xC3, (unsigned long*)(xHair + 6)); //ret
    		bXHair=true;
    	}
    	else
    	{
    		VirtualProtect(xHair, sizeof(oXHairPatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(xHair, &oXHairPatch, sizeof(oXHairPatch));
    		VirtualProtect(xHair, sizeof(oXHairPatch), orig, &orig);
    		bXHair=false;
    	}
    }
    
    void doNametags(void)
    {
    	unsigned long orig;
    	if(bNameTags==false)
    	{
    		writeNOP(xTeamcheck, 6);
    		writeNOP(xVisible, 2);
    		bNameTags=true;
    	}
    	else
    	{
    		VirtualProtect(xTeamcheck, sizeof(oTeamCheckPatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(xTeamcheck, &oTeamCheckPatch, sizeof(oTeamCheckPatch));
    		VirtualProtect(xTeamcheck, sizeof(oTeamCheckPatch), orig, &orig);
    		VirtualProtect(xVisible, sizeof(oVisiblePatch), PAGE_EXECUTE_READWRITE, &orig);
    		memcpy(xVisible, &oVisiblePatch, sizeof(oVisiblePatch));
    		VirtualProtect(xVisible, sizeof(oVisiblePatch), orig, &orig);
    		bNameTags=false;
    	}
    }
    
    void InitBackups(void)
    {
    	unsigned long orig;
    	VirtualProtect(playerFlag, sizeof(owallhackpatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(owallhackpatch, playerFlag, sizeof(owallhackpatch));
    	VirtualProtect(playerFlag, sizeof(owallhackpatch), orig, &orig);
    
    	VirtualProtect(fireRecoil, sizeof(oRecoilPatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(oRecoilPatch, fireRecoil, sizeof(oRecoilPatch));
    	VirtualProtect(fireRecoil, sizeof(oRecoilPatch), orig, &orig);
    
    	VirtualProtect(xHair, sizeof(oXHairPatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(oXHairPatch, xHair, sizeof(oXHairPatch));
    	VirtualProtect(xHair, sizeof(oXHairPatch), orig, &orig);
    }
    
    void DisableAll(void)
    {
    	unsigned long orig;
    	//wallhack
    	VirtualProtect(playerFlag, sizeof(owallhackpatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(playerFlag, &owallhackpatch, sizeof(owallhackpatch));
    	VirtualProtect(playerFlag, sizeof(owallhackpatch), orig, &orig);
    	bWallHack=false;
    	
    	//recoil
    	VirtualProtect(fireRecoil, sizeof(oRecoilPatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(fireRecoil, &oRecoilPatch, sizeof(oRecoilPatch));
    	VirtualProtect(fireRecoil, sizeof(oRecoilPatch), orig, &orig);
    	bNoRecoil=false;
    
    	//crosshair
    	VirtualProtect(xHair, sizeof(oXHairPatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(xHair, &oXHairPatch, sizeof(oXHairPatch));
    	VirtualProtect(xHair, sizeof(oXHairPatch), orig, &orig);
    	bXHair=false;
    
    	//nametags
    	VirtualProtect(xTeamcheck, sizeof(oTeamCheckPatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(xTeamcheck, &oTeamCheckPatch, sizeof(oTeamCheckPatch));
    	VirtualProtect(xTeamcheck, sizeof(oTeamCheckPatch), orig, &orig);
    	VirtualProtect(xVisible, sizeof(oVisiblePatch), PAGE_EXECUTE_READWRITE, &orig);
    	memcpy(xVisible, &oVisiblePatch, sizeof(oVisiblePatch));
    	VirtualProtect(xVisible, sizeof(oVisiblePatch), orig, &orig);
    
    }
    
    void HackThread(void)
    {
    	InitBackups();
    	while(1)
    	{
    		if(GetAsyncKeyState(VK_NUMPAD0)&1) // Panic key
    		{
    			DisableAll();
    		}
    		if(GetAsyncKeyState(VK_NUMPAD1)&1)
    		{
    			doWallhack();
    		}
    		if(GetAsyncKeyState(VK_NUMPAD2)&1)
    		{
    			doNametags();
    		}
    		if(GetAsyncKeyState(VK_NUMPAD3)&1)
    		{
    			doNoRecoil();
    		}
    		if(GetAsyncKeyState(VK_NUMPAD4)&1)
    		{
    			doXHair();
    		}
    		Sleep(1);
    	}
    }
    
    BOOL __stdcall DllMain(HMODULE hinst, DWORD reason, void *useless)
    {
    	DisableThreadLibraryCalls(hinst);
    	if(reason == 1)
    	{
    		CreateThread(0, 0, (LPTHREAD_START_ROUTINE)HackThread, 0, 0, 0);
    	}
    	return TRUE;
    }
    patch.cpp:
    Code:
    #include <windows.h>
    /* Thanks NightGhost for the patch util's */
    
    void writeNOP(unsigned long *orig, int len)
    {
    	int i = 0;
    	unsigned long back;
    	VirtualProtect((void*)orig, len, PAGE_READWRITE, &back);
    	while(i < len) {
    		*(unsigned char*)(orig + i) = 0x90;
    		i++;
    	}
    	VirtualProtect((void*)orig, len, back, &back);
    }
    
    void changeDWORDPTR(unsigned long dest, unsigned long *orig)
    {
    	unsigned long back;
    	VirtualProtect((void*)orig, 4, PAGE_READWRITE, &back);
    	*(unsigned long*)(orig) = (unsigned long)(dest);
    	VirtualProtect((void*)orig, 4, back, &back);
    }
    
    void changeBYTEPTR(unsigned char dest, unsigned long *orig)
    {
    	unsigned long back;
    	VirtualProtect((void*)orig, 4, PAGE_READWRITE, &back);
    	*(unsigned char*)(orig) = (unsigned char)(dest);
    	VirtualProtect((void*)orig, 4, back, &back);
    }
    patch.h:
    Code:
    #ifndef _PATCH_H
    #define _PATCH_H
    
    void writeNOP(unsigned long *orig, int len);
    void changeDWORDPTR(unsigned long dest, unsigned long *orig);
    void changeBYTEPTR(unsigned char dest, unsigned long *orig);
    
    #endif // _PATCH_H
    Credits: Hell_Demon, Couch, NightGhost
    Ah we-a blaze the fyah, make it bun dem!

  2. #2
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    I dont play COD4, but does detected mean patched. Just wondering because I was gonna post:

    OMG DOESNT WORK

  3. The Following User Says Thank You to Lolland For This Useful Post:

    Hell_Demon (10-21-2009)

  4. #3
    BooYa's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    hre
    Posts
    111
    Reputation
    10
    Thanks
    19
    who cares, this is the c++ section and the source is to learn from, not to whine that the hack is detected when u copy and paste it

  5. #4
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    I dont whine. I imitate choobs. (It's how I am.)
    What does detected mean? Someone explain because my degenerate mind cannot comprehend such high levels of vocabulary

  6. The Following User Says Thank You to Lolland For This Useful Post:

    Hell_Demon (10-21-2009)

  7. #5
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by lolland View Post
    I dont whine. I imitate choobs. (It's how I am.)
    What does detected mean? Someone explain because my degenerate mind cannot comprehend such high levels of vocabulary
    Your kidding right? Oh and thanks for the code code HD. This will be nice to look at.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  8. #6
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    really nice code i can learn alot from it. btw try posting tuts about how to find the recoil or
    w/e address u think its hard to find. for example how do u find the wall address to write a wallhack for it?

  9. #7
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by Matrix_NEO006 View Post
    really nice code i can learn alot from it. btw try posting tuts about how to find the recoil or
    w/e address u think its hard to find. for example how do u find the wall address to write a wallhack for it?
    I leeched it like all other coders do =D
    J/K, download the engine's SDK, check for strings(I believe the recoil one was something like cg_firerecoil), search for it with olly, start looking at the function, find out(by testing/etc) which one controls spread, then nop it out for nospread ^^
    Ah we-a blaze the fyah, make it bun dem!

  10. #8
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    Quote Originally Posted by Hell_Demon View Post
    I
    download the engine's SDK
    what?? wth is engines sdk

  11. #9
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by Matrix_NEO006 View Post
    what?? wth is engines sdk
    What engine does CoD4 use? starts with Q :P now go and look up the engine ^^
    Ah we-a blaze the fyah, make it bun dem!

  12. #10
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by Hell_Demon View Post
    What engine does CoD4 use? starts with Q :P now go and look up the engine ^^
    Quake obviously...

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  13. #11
    Matrix_NEO006's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Posts
    240
    Reputation
    12
    Thanks
    33
    My Mood
    Lonely
    i knew it :|||

Similar Threads

  1. Copy Paste
    By rsousa98 in forum CrossFire Discussions
    Replies: 21
    Last Post: 08-25-2011, 02:15 AM
  2. Is there any way to copy/paste IN-GAME?
    By epshreeman5 in forum Suggestions, Requests & General Help
    Replies: 3
    Last Post: 08-10-2011, 11:39 AM
  3. [Release] Speed Up Your Mass Crossmodding Program (Copy, Paste Rename Fast)!!
    By Scyntrus in forum Combat Arms Mods & Rez Modding
    Replies: 43
    Last Post: 09-27-2010, 08:22 PM
  4. [Help]Copy & Paste Textbox[Solved]
    By ViittO in forum Visual Basic Programming
    Replies: 5
    Last Post: 03-20-2010, 09:17 PM
  5. Undetected Module - Copy And Paste
    By prompbesj in forum WarRock - International Hacks
    Replies: 7
    Last Post: 09-23-2007, 12:48 PM

Tags for this Thread