Guest User

Untitled

a guest
Sep 29th, 2010
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.90 KB | None | 0 0
  1. /*Hello and welcome to the "MW2_HACK.h" file that includes the following things:
  2. -Stats Addressesions
  3. -2 Memory Write Functions
  4. -1 Get Proccess Functions
  5. ETC, ETC, ETC*/
  6.  
  7. //Declarations
  8. #ifndef MW2HACK_H
  9. #define MW2HACK_H
  10. #include <windows.h>
  11. #include <cstdlib>
  12. #include <iostream>
  13. #include <cstdio>
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <tlhelp32.h>
  17.  
  18. using namespace std;
  19.  
  20. #define Game_Process_Name "iw4mp" //Modern Warfare 2
  21.  
  22. BYTE JMP[1] = {0xEB};  //JMP Byte
  23. BYTE Nop2[2] = {0x90, 0x90};  //Nop2 Bytes
  24. BYTE Nop6[6] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90};  //Nop6 Bytes
  25.  
  26. //Stats Addresses Credits::DNA
  27. #define XP 0x01B2B81C
  28. #define SCORE 0x01B2B82C
  29. #define WINS 0x01B2B864
  30. #define LOSSES 0x01B2B868
  31. #define TIES 0x01B2B86C
  32. #define WSTREAK 0x01B2B870
  33. #define KILLS 0x01B2B830
  34. #define HEADSHOTS 0x01B2B844
  35. #define ASSISTS 0x01B2B840
  36. #define KSTREAK 0x01B2B834
  37. #define DEATHS 0x01B2B838
  38. #define TIMEPLAYED 0x01B2B850
  39. #define PRESTIGE 0x01B2B824
  40.  
  41. //Perks Addresses Credits::DNA
  42. #define Marathon 0x01B2BF6B
  43. #define SteadyAim 0x01B2BF6C
  44. #define Ninja 0x01B2BF6D
  45. #define Scrambler 0x01B2BF6E
  46. #define SleightOfHand 0x01B2BF6F
  47. #define Bling 0x01B2BF70
  48. #define StoppingPower 0x01B2BF71
  49. #define Hardline 0x01B2BF72
  50. #define OneManArmy 0x01B2BF73
  51. #define ColdBlooded 0x01B2BF74
  52. #define LastStand 0x01B2BF75
  53. #define Scavenger 0x01B2BF76
  54. #define Commando 0x01B2BF77
  55. #define SitRep 0x01B2BF78
  56. #define LightWeight 0x01B2BF79
  57. #define DangerClose 0x01B2BF7A
  58.  
  59. //                                                                === Main Functions.... ===
  60. void WriteMemory(DWORD Address, void* bytes, DWORD Size) {                                       //Write Proccess Function 1 Credits::war3zdude92 a.k.a Archangel
  61.     DWORD flOldProtect = 0;
  62.     VirtualProtect((void*)Address, Size, PAGE_EXECUTE_READWRITE, &flOldProtect);
  63.     memcpy((void*) Address, bytes, Size);
  64.     VirtualProtect((void*)Address, Size, flOldProtect, &flOldProtect);
  65. }
  66.  
  67. //Send Command To Console Function
  68. void (__cdecl *SendCommandToConsole)(int a1,int a2,char *cvar)=(void (__cdecl *)(int,int,char *))0x00000;
  69.  
  70. //Other....Credits::jaBBa
  71.  
  72. DWORD GetProcessPID(char* processName);
  73. BOOL PatchMemory(HANDLE processH, LPVOID address, BYTE* patch, DWORD size);
  74.  
  75.  
  76. BOOL PatchMemory(HANDLE processH, LPVOID address, BYTE* patch, DWORD size)       //Write Memory Function 2 Cretis::jaBBa
  77. {
  78.     DWORD rBuf = 0;
  79.     DWORD dwOldProt;
  80.  
  81.     if (VirtualProtectEx(processH,address,size,PAGE_EXECUTE_READWRITE,&dwOldProt) == 0) { //Delete if you want, not necessary
  82.         printf("\nError VirtualProtectEx %X",GetLastError());
  83.         return FALSE;
  84.     }
  85.  
  86.     WriteProcessMemory(processH,address,patch,size,&rBuf); //writeprocess
  87.  
  88.     if(rBuf == 0) {
  89.         return FALSE;
  90.     }
  91.  
  92.     printf("\nPatch Address: 0x%08X",address); //print out which adress was patched
  93.  
  94.     VirtualProtectEx(processH,address,size,dwOldProt,NULL); //delete if you want
  95.  
  96.     return TRUE;
  97. }
  98. #endif /*MW2HACK_H*/
Advertisement
Add Comment
Please, Sign In to add comment