My answer is relevant for when you are writing the application, whereas zxcdw's answer is relevant for accessing memory that belongs to another application. You'll have a variable representing the timer, and you'll just read from the variable. Your example of a timer in a game is a great example of where you wouldn't need to worry about the underlying memory allocation. The language constructs and OS effectively obscure that concern for you. Most of the time, you don't have to worry about specific memory access within your program. Otherwise, memory access is handled through the class or variable that was created. C and C++ are the best known for using the concept of pointers to indicate / track where the memory is located. Releasing the memory back to the OS may either be done explicitly or through a garbage collector.Īccessing the memory within the application depends upon how it was allocated. Each language has a number of ways to allocate memory, so this is just a brief overview. Languages like C allow for block requests for specific sizes, whereas other languages like C++, C#, and Java allow for requests through the use of keywords like new. Generally, the application has to request the memory but that functionality may be obscured to the programmer because of the language. )Īn application is given a range of memory by the OS. This is quite trivial task, but does not contribute to answering the question so I've left it out as an exercise to the reader. In practice you'd have to find the target process' process ID, and then attach your rogue process to the target process to gain the ability to modify its memory space. In our example, you would use this function to overwrite the timer variable in the target process with your own desired value, effectively changing the timer in the game. With Windows, there's a WinAPI call named WriteProcessMemory which can be used to write pre-defined data to a given address within the target process' memory space. How this is done depends on the operating system. Second step is to modify the data in that particular address. Taking the address of that variable within the process' memory space is just a matter of a mouse click with a memory editor. This process pins down the candidates every iteration until there's only the exact variable left. advance the timer) and look for matches again. Common way is to look for a certain value(for example the value of the timer) in target process' memory space, then change the target value(e.g. This is usually done with a tool called memory editor(a debugger would do too, in some cases) which can use various methods to find the location of a variable in the process memory. But to simplify things a bit:Ĭonsidering your example of " reading the timer in a game of mines":įirst step is to find the memory address. This is a somewhat tricky and even complex question, in a sense that you can go quite deep with this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |