我的主要课程如下所示:
#include "stdafx.h"
using namespace std;
class MemoryAddressing : Memory {
int _tmain(int argc, _TCHAR* argv[])
{
Memory mem;
int hp = Memory.ReadOffset(0x000000);
}
}
然后我有我的第二节课:
#include <windows.h>
#include <iostream>
using namespace std;
static class Memory {
public : static int ReadOffset(DWORD offset) {
DWORD address = 0x000000;
DWORD pid;
HWND hwnd;
int value = 0;
hwnd = FindWindow(NULL, L"");
if(!hwnd) {
cout << "error 01: Client not found, exiting...\n";
Sleep(2000);
}else {
GetWindowThreadProcessId(hwnd, &pid);
HANDLE handle = OpenProcess(PROCESS_VM_READ, 0, pid);
if(!handle) {
cout << "error 02: no permissions to read process";
}
else {
ReadProcessMemory(handle, (void*) offset, &value, sizeof(value), 0);
}
}
}
};
很明显,我正在尝试ReadOffset
从我的Memory
班级继承我班级的方法MemoryAddressing
。我不知道该怎么做,似乎班级无法交流。
我已经知道 Java 和 C#,但我认为 C++ 非常不同。