vovan333

it works bleeg

Nov 5th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2. #include <Psapi.h>
  3. #include <stdio.h>
  4. #include <string>
  5. typedef std::string string;
  6.  
  7. class Process
  8. {
  9.     private:
  10.     HANDLE Handle;
  11.  
  12.     public:
  13.     int Id;
  14.  
  15.     Process(int id)
  16.     {
  17.         Handle = OpenProcess(PROCESS_QUERY_INFORMATION, false, id);
  18.         Id = id;
  19.     }
  20.  
  21.     string GetFileName()
  22.     {
  23.         TCHAR tCharFn[MAX_PATH];
  24.         char charFn[MAX_PATH];
  25.         GetProcessImageFileName(Handle, tCharFn, 10000);
  26.         wcstombs(charFn, tCharFn, wcslen(tCharFn) + 1);
  27.         return charFn;
  28.     }
  29.  
  30.     void Terminate()
  31.     {
  32.         TerminateProcess(Handle, 0);
  33.     }
  34.  
  35.     void WriteMemory(unsigned long start, byte* bytes)
  36.     {
  37.         WriteProcessMemory(Handle, LPVOID(start), bytes, sizeof(bytes), nullptr);
  38.     }
  39.  
  40.     byte* ReadMemory(unsigned long start, unsigned long bytesLength)
  41.     {
  42.         LPVOID result;
  43.         ReadProcessMemory(Handle, LPVOID(start), result, SIZE_T(bytesLength), nullptr);
  44.         return (byte*)result;
  45.     }
  46. };
  47.  
  48. class Console
  49. {
  50.     public:
  51.     static void WriteLine(string message)
  52.     {
  53.         Write(message + "\r\n");
  54.     }
  55.  
  56.     static void Write(string message)
  57.     {
  58.         printf(message.c_str());
  59.     }
  60. };
  61.  
  62. int main()
  63. {
  64.     int pid = 6460;
  65.     Process googleChrome(pid);
  66.     Console::WriteLine(googleChrome.GetFileName());
  67.     Sleep(100000);
  68.     return 0;
  69. }
Add Comment
Please, Sign In to add comment