Writing to address based on offset?
I was wondering how to write to an address value based on offset value after getting the base address of a program?
For example I have this:
But that's writing to a specific address. I'd like to get the base memory address of the program and then write the values to an address based on an offset.
For example I have this:
Code:
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
if (CreateProcess(L"test.exe", NULL,NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi))
{
HANDLE processHandle = OpenProcess(PROCESS_VM_WRITE, FALSE, pi.dwProcessId);
void (*ADDRESS) = (void*)0x402CB6;
BYTE buffer[1] = {0xEB};
int lengthOfBuffer = 1;
WriteProcessMemory(pi.hProcess, ADDRESS, buffer, lengthOfBuffer, 0);
CloseHandle(processHandle);
ResumeThread(pi.hThread);
}

