Program location in memory
-
I am wondering how to find where a certain program is loaded into memory so I can access that section of RAM and read/change/ect the data. I do not know how to find where that program loaded itself into memory. I also don't really know how to access/change the data but I assume I can just create a pointer and move it along from the start of the memory block and figure it out from there. Which also reminds me, how can I tell the end of the memory location as well. So I guess I need to know how to find the block(start/end) of memory that a program has loaded itself into. I am just looking for links that show me how or explain it. But source code is always nice as well. Thanks
-
I am wondering how to find where a certain program is loaded into memory so I can access that section of RAM and read/change/ect the data. I do not know how to find where that program loaded itself into memory. I also don't really know how to access/change the data but I assume I can just create a pointer and move it along from the start of the memory block and figure it out from there. Which also reminds me, how can I tell the end of the memory location as well. So I guess I need to know how to find the block(start/end) of memory that a program has loaded itself into. I am just looking for links that show me how or explain it. But source code is always nice as well. Thanks
It's the operating system who load the program to memory, not program itself. You can appoint a base address when you compile a program. System try to load program on that address, if failed, it load program by it's own rule.Access other process's memory also has it's own rule. I suggest you read about the book <> by Jeffrey Richter.I thought there you can find the answer you want. Thinking in difference!
-
It's the operating system who load the program to memory, not program itself. You can appoint a base address when you compile a program. System try to load program on that address, if failed, it load program by it's own rule.Access other process's memory also has it's own rule. I suggest you read about the book <> by Jeffrey Richter.I thought there you can find the answer you want. Thinking in difference!
Thanks. :) I do know that the OS tries to place the program first then to the program. I am just wondering if the WINAPI or something in C++ allowed for finding where a program was loaded. For example, I want to find out where Minesweeper is loaded into memory so I can try to read its memory block and figure out what tiles are bombs. That is what I am aiming to do. I will try to find that book and see if it can yeild what I am looking for... given I am not exactly sure what the code will be that I want. Thanks again.
-
Thanks. :) I do know that the OS tries to place the program first then to the program. I am just wondering if the WINAPI or something in C++ allowed for finding where a program was loaded. For example, I want to find out where Minesweeper is loaded into memory so I can try to read its memory block and figure out what tiles are bombs. That is what I am aiming to do. I will try to find that book and see if it can yeild what I am looking for... given I am not exactly sure what the code will be that I want. Thanks again.
There's an MSDN article titled "Minimizing the Memory Footprint of Your Windows CE-based Program" by Douglas Boling that might give you some clues. See the "An Application's Address Space " section. I did not look to see what API was used.