How do I loop through the application memory?
I've written my own C# app that contains a int (int intfoo = 1234;
) and a string (string stringfoo = "This is a test string";
).
And now I'm working on a memory reader that is supposed to loop through and find those values.
How do I loop, what is the starting point and what is the endpoint? I've read somewhere that start is 0x00100000 and other places its 0x00400000. And for my little app that uses 7372 kB, what would t开发者_C百科he end be?
And finally, how do i loop through to find my intfoo
and stringfoo
?
If you want to manipulate memory, use an unmanaged language.
Managed languages/Frameworks like .NET, Mono and Java are specifically designed that you do not screw around with the memory in any form. The framework manages this completely for you. Therefor it's hard to even access it, though possible. But things are turning really ugly from there.
Use a language which is designed to handle memory manipulation of any kind, like C or C++.
If you want to access those values, use the variables.
If you want to read blocks of raw memory in your application, don't use a managed environment. Use the Windows API directly - VirtualQuery.
Read up on virtual memory so you understand that a memory address (a pointer) is not some address into your physical RAM; it's abstracted by the OS.
If this is really homework, I really would love to have a talk with your professor. This is an absurd assignment, with no practical purpose.
精彩评论