Advertisement
N-am

Untitled

Sep 28th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <windows.h>
  4.  
  5. int newdata = 1000;
  6.  
  7.  
  8.  
  9. void ShowError(DWORD dwErrorCode)
  10. {
  11. TCHAR* lpMessageBuffer;
  12.  
  13. FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (TCHAR*)&lpMessageBuffer, 0, NULL);
  14.  
  15. MessageBox(HWND_DESKTOP, lpMessageBuffer, NULL, MB_OK | MB_ICONINFORMATION);
  16.  
  17. LocalFree(lpMessageBuffer);
  18. }
  19.  
  20. int main()
  21. {
  22. HWND hWnd = FindWindow(0, "GTA:SA:MP");
  23. if(hWnd == 0)
  24. {
  25. ShowError(GetLastError());
  26. }
  27. else
  28. {
  29. DWORD ProcessID;
  30. GetWindowThreadProcessId(hWnd, &ProcessID);
  31. HANDLE handleprocess = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, ProcessID);
  32. if(!handleprocess)
  33. {
  34. ShowError(GetLastError());
  35. }
  36. else{
  37. int hack = WriteProcessMemory(handleprocess, (LPVOID)0xB7CE50, &newdata, (DWORD)sizeof(newdata), NULL);
  38. if(hack > 0)
  39. {
  40. //printf("success!");
  41. }
  42. else{
  43. ShowError(GetLastError());
  44. }
  45. }
  46. CloseHandle(handleprocess);
  47.  
  48. }
  49.  
  50. //getchar();
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement