Advertisement
Guest User

Untitled

a guest
Aug 11th, 2018
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <iostream>
  3. #include <vector>
  4. #include <TlHelp32.h>
  5. #include <tchar.h>
  6.  
  7. using namespace std;
  8.  
  9. DWORD dwGetModuleBaseAddress(TCHAR *lpszModuleName, DWORD pID) {
  10. DWORD dwModuleBaseAddress = 0;
  11. HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID);
  12. MODULEENTRY32 ModuleEntry32 = { 0 };
  13. ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
  14.  
  15. if (Module32First(hSnapshot, &ModuleEntry32))
  16. {
  17. do {
  18. if (_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
  19. {
  20. dwModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
  21. break;
  22. }
  23. } while (Module32Next(hSnapshot, &ModuleEntry32));
  24.  
  25.  
  26.  
  27. }
  28. CloseHandle(hSnapshot);
  29. return dwModuleBaseAddress;
  30. }
  31.  
  32.  
  33.  
  34.  
  35. int main() {
  36. DWORD pID;
  37. DWORD off1, off2, off3, off4;
  38. DWORD baseAddress;
  39. DWORD crossID;
  40. int currentCrossID;
  41. char moduleName[] = "client_panorama.dll";
  42. HWND hGameWindow;
  43. HANDLE pHandle;
  44.  
  45. hGameWindow = FindWindow(NULL, "Counter-Strike: Global Offensive");
  46. GetWindowThreadProcessId(hGameWindow, &pID);
  47. pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
  48.  
  49.  
  50.  
  51.  
  52.  
  53. //Get Handles
  54. DWORD clientBase = dwGetModuleBaseAddress(_T(moduleName), pID);
  55.  
  56. ReadProcessMemory(pHandle, (LPCVOID)(clientBase + 0x04C28FC4), &baseAddress, sizeof(baseAddress), NULL);
  57. ReadProcessMemory(pHandle, (LPCVOID)(baseAddress + 0x18), &off1, sizeof(off1), NULL);
  58. ReadProcessMemory(pHandle, (LPCVOID)(off1 + 0x24), &off2, sizeof(off2), NULL);
  59. ReadProcessMemory(pHandle, (LPCVOID)(off2 + 0x4), &off3, sizeof(off3), NULL);
  60. crossID = off3 + 0x68;
  61.  
  62.  
  63. do {
  64. ReadProcessMemory(pHandle, (LPCVOID)(crossID), &currentCrossID, 4, NULL);
  65. cout << "CrossID: " << currentCrossID << std::endl;
  66. system("cls");
  67. if (currentCrossID > 0) {
  68. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
  69. Sleep(15);
  70. mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
  71.  
  72.  
  73. }
  74.  
  75.  
  76.  
  77. } while (true);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement