Advertisement
hoosier18

console name changer

Sep 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include <iostream>
  2.  #include <windows.h>
  3.  #include <string>
  4. using namespace std;
  5. // FindWindow();
  6. // GetWindowsThreadProcessId();
  7. // OpenProcess();
  8. // WriteProcessMemory();
  9. // CloseHandle();
  10. int main()  
  11. {  
  12.    HWND hWnd = FindWindowA(0, "Alliance of Valiant Arms");
  13.    if(hWnd == 0)
  14.    {
  15.       cerr << "Unable to find the window" << endl << endl;
  16.    }
  17.    else{
  18.   clog << "Found Window" << endl << endl;;
  19.   DWORD PId;
  20.   GetWindowThreadProcessId(hWnd, &PId);
  21.   HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, PId);
  22.   if (!hProcess){
  23.   cerr << "Unable to Open Process" << endl << endl;;
  24.   }
  25.   else{
  26.   clog << "Opened Process" << endl << endl;;
  27.   string newvalue;
  28.   cout << "Enter the new nickname: " << endl;
  29.   cin >> newvalue;
  30.   cout << endl << endl;
  31.   int isSuccessful = WriteProcessMemory(hProcess, (LPVOID)0x00000, &newvalue , sizeof(newvalue), NULL);
  32.   if(isSuccessful > 0){
  33.   clog << "Process Memory Written" << endl << endl;;
  34.   }else{
  35.       cerr << "Cannot write process memory." << endl << endl;;
  36.   }
  37.   }
  38.   }
  39.  system("PAUSE");
  40.  system("CLS");
  41. return main();
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement