- Mesaj
- 28
- Çözümler
- 1
- Beğeni
- 10
- Puan
- 658
- Ticaret Puanı
- 0
Merhaba Metin2 bir pvp de Memory read yapmaya çalışıyorum fakat pid okumama rağmen HANDLE alınmıyor. Aynısını counter strike ta yapıyorum oluyor neden olabilir. Kaynak kodu ektedir.
C++:
// ConsoleApplication4.cpp : Defines the entry point for the console application.
//
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
DWORD address = 0x4B2FF564;
float value = 123456;
DWORD pid;
HWND hwnd;
hwnd = FindWindow(NULL, L"test");
//hwnd = FindWindow(NULL, L"Counter-Strike: Global Offensive");
if (!hwnd)
{
cout << "Window not found!\n";
cin.get();
}
GetWindowThreadProcessId(hwnd, &pid);
HANDLE phandle = OpenProcess(PROCESS_VM_READ, FALSE, pid);
ReadProcessMemory(phandle, (LPVOID)address, &value, sizeof(value), 0);
cout << "PiD: " << pid << "\n";
if (!phandle)
{
cout << "Could not get handle!\n";
cin.get();
}
while (1) //Forever, or until you force close the program
{
ReadProcessMemory(phandle, (void*)address, &value, sizeof(value), 0); //Read what is in "address" and store it in "value", then what is the size of what we are going to read which is "value",and finally the number of bytes read, but I dont care about that so I put a 0, or NULL
cout << value << "\n"; //Display it
Sleep(1000); //I was reading the timer which increases every second, so I made my program go through that loop every second
//return 0
}
}