0

I'm trying to read memory, and get the values from Editbox's in my program, The caption part is working i tested it by putting a Valid address instead of MyAddress, and it worked fine. So the only problem i have is MyAddress, heres the code.

HANDLE hProcess;
DWORD ProcessId;
int Base = 0;
char MyCaption[300];
char MyAddress[300];
GetDlgItemText(hDlg, 2, MyCaption, sizeof(MyCaption));
GetDlgItemText(hDlg, 3, MyAddress, sizeof(MyAddress));
HWND hWindow = FindWindow(NULL, MyCaption);
GetWindowThreadProcessId(hWindow, &ProcessId);
hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, ProcessId);
ReadProcessMemory(hProcess, (void*)MyAddress, &Base, 4, NULL);
SetDlgItemInt(hDlg, 5, Base, TRUE);

I was hopeing a function would work. Manually putting a address in works.

void write(LPVOID addy) {
    int Base = 0;
    ReadProcessMemory(hProcess, addy, &Base, 4, NULL);
    WriteProcessMemory(hProcess, (void*)(Base + 0x728), "\x88\x13\x00\x00", 4, NULL);
}

void ReadOpen(HWND hDlg)
{
    DWORD ProcessId;
    int Base = 0;
    int Base2 = 0;
    char MyCaption[300];
    GetDlgItemText(hDlg, 2, MyCaption, sizeof(MyCaption));
    HWND hWindow = FindWindow(NULL, MyCaption);
    GetWindowThreadProcessId(hWindow, &ProcessId);
    hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, ProcessId);
    int address = GetDlgItemInt(hDlg, 3, NULL, FALSE);
    write((LPVOID)0x67FBF8);
}

using address doesnt work

void write(LPVOID addy) {
    int Base = 0;
    ReadProcessMemory(hProcess, addy, &Base, 4, NULL);
    WriteProcessMemory(hProcess, (void*)(Base + 0x728), "\x88\x13\x00\x00", 4, NULL);
}

void ReadOpen(HWND hDlg)
{
    DWORD ProcessId;
    int Base = 0;
    int Base2 = 0;
    char MyCaption[300];
    GetDlgItemText(hDlg, 2, MyCaption, sizeof(MyCaption));
    HWND hWindow = FindWindow(NULL, MyCaption);
    GetWindowThreadProcessId(hWindow, &ProcessId);
    hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, ProcessId);
    int address = GetDlgItemInt(hDlg, 3, NULL, FALSE);
    write((LPVOID)address);
}

using &address doesnt work.

void write(LPVOID addy) {
    int Base = 0;
    ReadProcessMemory(hProcess, addy, &Base, 4, NULL);
    WriteProcessMemory(hProcess, (void*)(Base + 0x728), "\x88\x13\x00\x00", 4, NULL);
}

void ReadOpen(HWND hDlg)
{
    DWORD ProcessId;
    int Base = 0;
    int Base2 = 0;
    char MyCaption[300];
    GetDlgItemText(hDlg, 2, MyCaption, sizeof(MyCaption));
    HWND hWindow = FindWindow(NULL, MyCaption);
    GetWindowThreadProcessId(hWindow, &ProcessId);
    hProcess = OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, ProcessId);
    int address = GetDlgItemInt(hDlg, 3, NULL, FALSE);
    write((LPVOID)&address);
}
4

0 回答 0