Advertisement
Guest User

Untitled

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