granddemon
IS-IT--Management
I am testing out the ReadProcessMemory and WriteProcessMemory functions just for fun (I believe I am going to have to use them in the future, so I am just practicing with them now), but ReadProcessMemory always returns an error. It only returns a 0, so I have no idea what that means or what went wrong. Here is the code snippet I am using:
----------------------------------------------------
int addr = 0x400000;
BYTE buffer = 0;
bool dummy = true;
if (ReadProcessMemory(Process.m_hProcess,(void*)addr,&buffer,1,NULL) == 0) {
MessageBox("There was an error reading the process's memory","Error",MB_ICONWARNING);
init_passed = false;
break;
}
--------------------------------------------------
As you probably guessed, my error message box is popping up.
I am hoping to read one byte starting at the beginning of the process (0x400000) just to see it work, but I can't even get that going. Process.m_hProcess should contain the right information (I debugged the program and it contains 0x000007c4 which I assume is the right value for my other window...). I figure the problem is probably something with either my buffer or addr variable as I was unsure what to do with those.
Any pointers in the right direction would be greatly appreciated. Thanks infinitely in advance,
GrandDemon
----------------------------------------------------
int addr = 0x400000;
BYTE buffer = 0;
bool dummy = true;
if (ReadProcessMemory(Process.m_hProcess,(void*)addr,&buffer,1,NULL) == 0) {
MessageBox("There was an error reading the process's memory","Error",MB_ICONWARNING);
init_passed = false;
break;
}
--------------------------------------------------
As you probably guessed, my error message box is popping up.
I am hoping to read one byte starting at the beginning of the process (0x400000) just to see it work, but I can't even get that going. Process.m_hProcess should contain the right information (I debugged the program and it contains 0x000007c4 which I assume is the right value for my other window...). I figure the problem is probably something with either my buffer or addr variable as I was unsure what to do with those.
Any pointers in the right direction would be greatly appreciated. Thanks infinitely in advance,
GrandDemon