Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.91 KB | None | 0 0
  1. #include <windows.h>
  2. #include <Tlhelp32.h>
  3. void killprocess(const char* filename)
  4. {
  5.     HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
  6.     PROCESSENTRY32 pEntry;
  7.     pEntry.dwSize = sizeof (pEntry);
  8.     BOOL hRes = Process32First(hSnapShot, &pEntry);
  9.     while (hRes)
  10.     {
  11.         if (strcmp(pEntry.szExeFile, filename) == 0)
  12.         {
  13.             HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, (DWORD) pEntry.th32ProcessID);
  14.             if (hProcess != NULL)
  15.             {
  16.                 TerminateProcess(hProcess, 0);
  17.                 CloseHandle(hProcess);
  18.             }
  19.         }
  20.         hRes = Process32Next(hSnapShot, &pEntry);
  21.     }
  22.     CloseHandle(hSnapShot);
  23. }
  24. int main()
  25. {
  26.     /* Accounts configuration */
  27.     const BYTE quantity = 5;
  28.     const char* account[quantity] = {"xvolian0",
  29.                                      "xvolian1",
  30.                                      "xvolian2",
  31.                                      "xvolian3",
  32.                                      "xvolian4"
  33.                                     };
  34.     BYTE current = quantity;
  35.     HKEY key;
  36.     RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key);
  37.     while (true)
  38.     {
  39.         for (BYTE i = 0; i<quantity; i++)
  40.         {
  41.             /* Numeric keypad */
  42.             if (GetAsyncKeyState(0x60+i) && i != current)
  43.             {
  44.                 killprocess("csgo.exe");
  45.                 killprocess("Steam.exe");
  46.                 RegSetValueEx(key, "AutoLoginUser", 0, REG_SZ, (LPBYTE)account[i], strlen(account[i]));
  47.                 ShellExecute(0, 0, "steam://rungameid/730", 0, 0, SW_SHOWNORMAL);
  48.                 current = i;
  49.             }
  50.         }
  51.         Sleep(125);
  52.         /* END key */
  53.         if (GetAsyncKeyState(0x23)) break;
  54.     }
  55.     RegCloseKey(key);
  56.     MessageBox(NULL,"The program has been closed.","Manager",MB_ICONINFORMATION);
  57.     return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement