Advertisement
Guest User

C++ External

a guest
Aug 11th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <Windows.h>
  3. #include <iostream>
  4.  
  5. #define num0 0x60
  6. #define F6 0x75
  7.  
  8. DWORD pid = 0;
  9. DWORD buffer = 0;
  10. DWORD localHealth = 0;
  11. const DWORD localHealthBase = 0x01295540;
  12. const DWORD localHealthOffset1 = 0x24;
  13. const DWORD localHealthOffset2 = 0x10;
  14. const DWORD localHealthOffset3 = 0x500;
  15. const DWORD localHealthOffset4 = 0x6A0;
  16. const DWORD localHealthOffset5 = 0x2B0;
  17. -snip-
  18. int main()
  19. {
  20. int i = 0;
  21. HWND hWnd = FindWindowA(0, ("7 Days To Die"));
  22. GetWindowThreadProcessId(hWnd, &pid);
  23. HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
  24. std::cout << "Process ID: " << pid << std::endl; //outputs correct PID
  25. std::cout << localHealthBase << std::endl; //outputs correct Base Address
  26. ReadProcessMemory(pHandle,(void*)localHealthBase,&localHealth,sizeof(localHealth),NULL);
  27. //^^^I've tried with LPCVOID, LPCVOID*, and PBYTE* to no avail
  28. std::cout << localHealth << std::endl; //outputs 0
  29. -snip-
  30.  
  31. VS Output: (Though program does compile and run properly until ReadProcessMemory)
  32. -snip- *correct loading*
  33. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
  34. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
  35. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
  36. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
  37. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
  38. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file.
  39. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file.
  40. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
  41. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
  42. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
  43. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
  44. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
  45. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
  46. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
  47. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
  48. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
  49. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-timezone-l1-1-0.dll'. Cannot find or open the PDB file.
  50. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l2-1-0.dll'. Cannot find or open the PDB file.
  51. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-localization-l1-2-0.dll'. Cannot find or open the PDB file.
  52. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-synch-l1-2-0.dll'. Cannot find or open the PDB file.
  53. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-processthreads-l1-1-1.dll'. Cannot find or open the PDB file.
  54. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\api-ms-win-core-file-l1-2-0.dll'. Cannot find or open the PDB file.
  55. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
  56. '7Days.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement