Advertisement
Guest User

Untitled

a guest
Dec 27th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. // xxx.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <Windows.h>
  6. #include <iostream>
  7. #include <strsafe.h>
  8.  
  9. using namespace std;
  10.  
  11. int _tmain(int argc, _TCHAR* argv[])
  12. {
  13.  
  14.     long address = 0x000AA870;
  15.     int newvalue = 200000;
  16.     DWORD newvaluesize = sizeof(newvalue);
  17.  
  18.     HWND hWnd = FindWindow(NULL, TEXT("Solitär"));
  19.     HANDLE pHandle;
  20.     DWORD pid;
  21.  
  22.     if(hWnd != 0) {
  23.         cout << "Notepad gefunden";
  24.         GetWindowThreadProcessId(hWnd, &pid);
  25.         pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); // Handle beziehen
  26.     }
  27.     else {
  28.         cout << "Notepad nicht gefunden";
  29.     }
  30.  
  31.     if(pHandle !=0) {
  32.         WriteProcessMemory(pHandle, (LPVOID)address, &newvalue, newvaluesize, 0);  
  33.         cout << "Written to memory successfully\n";
  34.         getchar();
  35.     }
  36.     else {
  37.         cout << "Couldn't get handle.\n";
  38.         getchar();
  39.     }
  40.     CloseHandle(pHandle);
  41.  
  42.     getchar();
  43.  
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement