daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 16th, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <windows.h>
  2. #include <iostream>
  3. #include <tlhelp32.h>
  4. #include <conio.h>
  5. #include <stdio.h>
  6. using namespace std;
  7.  
  8. #define BaseOffset          0xBAFA8
  9.  
  10. #define Offset1             0x50
  11.      
  12. #define Offset2             0x14
  13.  
  14. #define Addressname         "Solitaire.exe"
  15.  
  16. bool SetDebugPrivileges();
  17.  
  18. int main(){
  19.  
  20.     HWND hWnd;
  21.     HANDLE handle;
  22.     DWORD ID;
  23.     DWORD Punkte;
  24.     DWORD rw;
  25.     int Points;
  26.     DWORD baseptr;
  27.     DWORD basepptr;
  28.     LPCTSTR  WindowName = "Solitär";
  29.  
  30.     cout << "Suche nach Prozess..." << endl;
  31.    
  32.     do{
  33.         Sleep(1000);
  34.         hWnd = FindWindow( NULL, WindowName);
  35.     }while(!hWnd);
  36.  
  37.     system("cls");
  38.  
  39.     GetWindowThreadProcessId(hWnd, &ID);
  40.  
  41.     DWORD BaseAddress = (DWORD) GetModuleHandle(Addressname);
  42.  
  43.     SetDebugPrivileges();
  44.  
  45.     handle = OpenProcess(PROCESS_ALL_ACCESS, false, ID);
  46.  
  47.     ReadProcessMemory(handle, (void*) (BaseAddress + BaseOffset), &baseptr, sizeof(baseptr), &rw);
  48.  
  49.     ReadProcessMemory(handle, (void*) (baseptr+Offset1), &basepptr, sizeof(basepptr), &rw);
  50.  
  51.     ReadProcessMemory(handle, (void*) (basepptr+Offset2), &Punkte, sizeof(Points), &rw);
  52.  
  53.     cout << "du hast " << Punkte << " Punkte." << endl;
  54.  
  55.     while(true){
  56.  
  57.         cout << "Deine Punkte werden gesetzt auf: " << endl;
  58.         cin >> Points;
  59.  
  60.         WriteProcessMemory(handle, (void*) (basepptr+Offset2), &Points, sizeof(Points), &rw);
  61.  
  62.         system("cls");
  63.     }
  64.  
  65.     CloseHandle(handle);
  66.  
  67.     return 0;
  68. }
  69.  
  70. bool SetDebugPrivileges(){
  71.         HANDLE hToken;
  72.         TOKEN_PRIVILEGES tokenPriv;
  73.         tokenPriv.PrivilegeCount = 1;
  74.  
  75.         if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
  76.                 return false;
  77.  
  78.         if(!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tokenPriv.Privileges[0].Luid))
  79.                 return false;
  80.         tokenPriv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  81.  
  82.         if(!AdjustTokenPrivileges(hToken, false, &tokenPriv, sizeof(TOKEN_PRIVILEGES), NULL, NULL))
  83.                 return false;
  84.         return true;
  85. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top