ive been reading around the website and googling to try and find a conclusive answer to what im trying to do, but i didnt find one that answers all my questions.
i have two processes. one has an integer variable which i want to change by a second process. i know how to read/write to specific memory locations, but i only know how to do it on the native process addresses.
i dont understand createremotethread. is it possible i get the cleanest, simplest example of manipulating memory of a process not native to the running program? assuming both programs are running, of course.
thanks in advance
EDIT: i got some answers about my question from other sources. i just want to understand how do i write a vairable to a memory location, say:
WriteProcessMemory(phandle,(void*)address,val,sizeof(val),NULL);
this seems to have no effect, assuming the val is a bool:
while(true){
key=getch();
if(key=='1'){
if(val)val=false;
else val=true;
WriteProcessMemory(phandle,(void*)address,&val,sizeof(val),NULL);
}
bool val2;
ReadProcessMemory(phandle, (void*)address, &val2, sizeof(val2), NULL);
cout<<val2<<endl;
}
always shows 0. why?
issue solved, i had to use HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
instead of HANDLE phandle = OpenProcess(PROCESS_VM_READ, 0, pid)