c++ - How to find free memory within a specific address range -
I want to write a small amount of memory within a specific address range of my process.
example
- Quantity of memory to allocate:
5 bytes
- Addresses Less bound for:
0x 00 40 00 00
- Upper limit for address:
0x 00 a0 00 00
The range in which I want to write is already allocated by the process, therefore, I can not allocate new memos only with VirtualAlloc
.
However, because the desired address space pages are used for the program code, they do not use 100%. There is enough space anywhere to write my 5 bytes.
What do I have to do to ensure that I can not overwrite the required memory?
I do not think there is a good, normal way to do what you want. Since it seems that you are talking about Windows and where the original location is about loading the PE, here are some assumptions that can help you.
If you are PE-directors, you can usually get dull position in there. See the areas before sections and works, depending on how the application was made, you can find areas between functions to fill with INT3, which will probably be sufficient for what you are looking for.
If you tell us what you are doing, especially trying to do it, we can probably help you more, you can patch the binary before loading it or run you Time to do everything?
Comments
Post a Comment