Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.21 KB | None | 0 0
  1. // mod.cpp : Defines the exported functions for the DLL application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. std::string testString = "SexyDog";
  7.  
  8. DWORD pid = 0;
  9.  
  10. HANDLE H;
  11.  
  12. #pragma warning(disable:4996)
  13.  
  14. void init()
  15. {
  16.  
  17.     WriteByteInt((LPVOID)0x00663A8D, 1920);
  18.     WriteByteInt((LPVOID)0x00663A95, 1080);
  19.     WriteByteInt((LPVOID)0x0019F9FC, 1920);
  20.     WriteByteInt((LPVOID)0x0019FA00, 1080);
  21.  
  22.     //std::string newValue = "hugo";
  23.     char* str = (char*)0x00716A0C;
  24.  
  25.  
  26.     HANDLE curHandle = OpenProcess(PROCESS_ALL_ACCESS, TRUE, pid);
  27.  
  28.     void* addr = update;
  29.  
  30.     std::vector<unsigned char> addrVec = intToBytes(((int)(addr)-(5)) - 0x006BDAD8);
  31.  
  32.  
  33.     BYTE bytes[] = { 0xE8,addrVec[3],addrVec[2],addrVec[1],addrVec[0],0x90,0x90,0xC3 };
  34.  
  35.  
  36.     DWORD tID = GetMainThreadId();
  37.     HANDLE hToken;
  38.     int yoWTF = GetLastError();
  39.  
  40.  
  41.  
  42.     int yoWTFx2 = GetLastError();
  43.     DWORD old;
  44.  
  45.  
  46.     VirtualProtect((LPVOID)(0x006BDAD8), sizeof(bytes), PAGE_EXECUTE_READWRITE, &old);
  47.  
  48.     SIZE_T bytesWritten = 0;
  49.     WriteProcessMemory(curHandle, (LPVOID)(0x006BDAD8), bytes, sizeof(bytes), &bytesWritten);
  50.     int error = GetLastError();
  51.     //VirtualProtect((LPVOID)(0x006BDAD8), sizeof(bytes), old, NULL);
  52.  
  53.     std::ofstream myfile;
  54.     myfile.open("output.txt");
  55.     myfile << GetCurrentThreadId() << " : " << error << " " << " : " << curHandle << " : " << bytesWritten << " " << " " << yoWTFx2 << " : " << " : " << pid;
  56.     myfile.close();
  57.  
  58.     //unsigned char* c = (unsigned char*)(0x006BDAD8);
  59.  
  60.  
  61.     char* c = (char*)&error;
  62.     VirtualProtect(update, 3000, PAGE_EXECUTE_READWRITE, NULL);
  63.     VirtualProtect(str, 4, PAGE_EXECUTE_READWRITE, &old);
  64.     char buffer[] = "M o d L o a d  ";
  65.     for (int i = 1; i < 15; i += 2)
  66.         buffer[i] = 0;
  67.     memcpy(str, buffer, 16);
  68.     VirtualProtect(str, 4, old, NULL);
  69. }
  70.  
  71.  
  72. void WriteByteInt(LPVOID pointer, int i)
  73. {
  74.     DWORD old;
  75.     int* loc = &i;
  76.     VirtualProtect(pointer, 4, PAGE_EXECUTE_READWRITE, &old);
  77.     memcpy(pointer, loc, 4);
  78.     VirtualProtect((LPVOID)0x77810F34, 4, old, NULL);
  79. }
  80.  
  81. typedef void*(*GetCurPlayer)(void*, void*);
  82. GetCurPlayer getCurPlayer = (GetCurPlayer)0x00621040;
  83. typedef void(*VOIDFUNCTION)(void);
  84. VOIDFUNCTION func = (VOIDFUNCTION)0x0059110A;
  85. bool allocedConsole = false;
  86.  
  87. typedef std::vector<void*> CleanVector;
  88. typedef int(*INTFUNCTION)(void);
  89. typedef DWORD(*FUNCTIONCALL)();
  90. FUNCTIONCALL fCall = (FUNCTIONCALL)0x00571D40;
  91.  
  92. INTFUNCTION getSomething = (INTFUNCTION)0x006B6240;
  93.  
  94. extern "C" void __cdecl  update()
  95. {
  96.     std::cout << "HELP" << std::endl;
  97.     if (GetAsyncKeyState(0x45))
  98.     {
  99.         void* p = getCurPlayer((void*)0x03BE1D01,(void*)0x03CA0348);
  100.  
  101.         //  int* p = (int*)getSomething();
  102.         std::ofstream myfile;
  103.         myfile.open("playerlocationpls.txt");
  104.         //myfile <<  p;
  105.         myfile.close();
  106.     }
  107.     if (GetAsyncKeyState(0x43))
  108.     {
  109.         CleanVector* cv = (CleanVector*)0x0077DEC4;
  110.         std::ofstream myfile;
  111.         myfile.open("objectDump.txt");
  112.         myfile << cv->size();
  113.         myfile.close();
  114.     }
  115.  
  116. }
  117.  
  118. void SetStartPointer(int* pointer)
  119. {
  120.     DWORD old;
  121.  
  122.     VirtualProtect((void*)0x00714EE0, 4, PAGE_EXECUTE_READWRITE, &old);
  123.     memcpy(pointer, pointer, 4);
  124. }
  125.  
  126.  
  127. std::vector<unsigned char> intToBytes(int paramInt)
  128. {
  129.     std::vector<unsigned char> arrayOfByte(4);
  130.     for (int i = 0; i < 4; i++)
  131.         arrayOfByte[3 - i] = (paramInt >> (i * 8));
  132.     return arrayOfByte;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement