hi. i got a small problem. i want to write a program that is able to "freeze" a memory address. by freezing i mean a memory address that doesn't/can't change its value. how do i do that? a timer solution would be too "unprofessional" i think. does anyobody have a "real professional" solution? thanks in advance!
Declare the variable in a segment and mark it read-only. This message was edited by karim, on 6/7/2001 3:17:24 PM
i want to freeze memory addresses of other processes (forgot to say that hehe). how does that work? set the memory address to read-only? if yes, how? maybe one of those VirtualProtect-API-Functions?
oh, and what, if the process tries to write to the address that i just set to read-only? there will be an exception or not?
any access to the other's process memory will generate exeption why u want to "freeze" the part of memory that belong to the other process??
VirtualProtectEx can change the access protection of any process. From the MSDN :
The VirtualProtectEx function changes the access protection on a region of committed pages in the virtual address space of a specified process. BOOL VirtualProtectEx( HANDLE hProcess, // handle to process LPVOID lpAddress, // region of committed pages SIZE_T dwSize, // size of region DWORD flNewProtect, // desired access protection PDWORD lpflOldProtect // old protection ); Parameters hProcess Handle to the process whose memory protection is to be changed. The handle must have PROCESS_VM_OPERATION access...You will have to make some tests.
thanks for the answers. i'll try out that virtualprotectex. i want to freeze addresses cause i'm writing some kind of a game hacking tool and i want it to be able to freeze the health stat (or whatever) in game.
Hakinomo, I think if you try this it will end up trashing the program when it attempts to write there, possible a better solution is to freeze it by readint the value initially, then writing the value back every 100 milliseconds or so. The best solution though is to find the piece of code which modifies this value, and NOP it out. umbongo