#include <iostream>
#include "windows.h"
int main()
{
int PID;
int Memory;
int Buffer;
std::cout << "Process ID: ";
std::cin >> PID;
HANDLE hHandle = OpenProcess(PROCESS_ALL_ACCESS, 0, PID);
if (hHandle == INVALID_HANDLE_VALUE) {
std::cerr << "An error occured. Error: " << GetLastError();
return 1;
}
std::cout << "Memory address: ";
std::cin >> std::hex >> Memory;
std::cout << "=========================" << std::endl;
ReadProcessMemory(hHandle, LPCVOID(Memory), &Buffer, sizeof(Memory) + 1, 0);
std::cout << "Handle ID: " << hHandle << std::endl;
std::cout << "Handle address: " << &hHandle << std::endl;
std::cout << "Memory address: " << Memory << std::endl;
std::cout << "Hexadecimal memory address: " << std::hex << Memory << std::endl;
std::cout << "Read value is " << Buffer << "." << std::endl;
std::system("pause");
return 0;
}