Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. // FindWindow();
  5. // GetWindowThreadProcessId();
  6. // OpenProcess();
  7. // WriteProcessMemory();
  8. // CloseHandle();
  9.  
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14. HANDLE hToken;
  15. OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS,&hToken);
  16. TOKEN_PRIVILEGES TP;
  17. LookupPrivilegeValue(0,"SeDebugPrivilege",&TP.Privileges[0].Luid);
  18. TP.PrivilegeCount=1;
  19. TP.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
  20. AdjustTokenPrivileges(hToken,0,&TP,sizeof(TOKEN_PRIVILEGES),0,0);
  21.  
  22. {
  23. int newValue = 500;
  24.  
  25. HWND hWnd = FindWindow(0, "MicroVolts");
  26. if (hWnd == 0)
  27. {
  28. cerr << "Cannot find window." << endl;
  29. }
  30. else
  31. {
  32. DWORD pId;
  33. GetWindowThreadProcessId(hWnd, &pId);
  34.  
  35. HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
  36. void* pRPM=(void*)ReadProcessMemory;
  37. WriteProcessMemory(hProc,pRPM,"\xEB\xFE",2,0);
  38. if (!hProc)
  39. {
  40. cerr << "Cannot open process." << endl;
  41. }
  42. else
  43. {
  44. int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x102BEC8, &newValue, (DWORD)sizeof(newValue), NULL);
  45.  
  46. if (isSuccessful > 0)
  47. {
  48. clog << "SpeedHack Enabled." << endl;
  49. }
  50. else
  51. {
  52. cerr << "Cannot write process memory." << endl;
  53. }
  54. CloseHandle(hProc);
  55. }
  56. }
  57. system("PAUSE");
  58. return 0;
  59. {
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement