Guest User

Untitled

a guest
Jun 21st, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. void FindPID()
  2. {
  3. if (!Okno)
  4. exit(1);
  5. else
  6. GetWindowThreadProcessId(Okno, &ProcessID);
  7. }
  8.  
  9. DWORD FindBaseAddress(LPSTR NameModule)
  10. {
  11. HANDLE AllModuleProcess = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcessID);
  12.  
  13. if (!AllModuleProcess)
  14. return NULL;
  15.  
  16. Entry.dwSize = sizeof(MODULEENTRY32);
  17.  
  18. BOOL bWhile = Module32First(AllModuleProcess, &Entry);
  19.  
  20. while (bWhile)
  21. {
  22. if (!strcmp(Entry.szModule, NameModule))
  23. {
  24. CloseHandle(AllModuleProcess);
  25.  
  26. return (DWORD)Entry.modBaseAddr;
  27. }
  28. bWhile = Module32Next(AllModuleProcess, &Entry);
  29. }
  30.  
  31. CloseHandle(AllModuleProcess);
  32. return NULL;
  33. }
  34.  
  35. void OneStart()
  36. {
  37. FindPID();
  38.  
  39. if (ProcessID == NULL)
  40. exit(1);
  41.  
  42. ProcesGry = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessID);
  43.  
  44. if (!ProcesGry)
  45. exit(1);
  46.  
  47. ClientGry = (DWORD)FindBaseAddress("client.dll");
  48.  
  49. if (ClientGry == NULL)
  50. exit(1);
  51.  
  52. EngineGry = (DWORD)FindBaseAddress("engine.dll");
  53.  
  54. if (EngineGry == NULL)
  55. exit(1);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment