I want to write a small amount of memory inside of a specific address range of my process.
Example
- amount of memory to allocate:
5 bytes
- lower bound for address:
0x 00 40 00 00
- upper bound for address:
0x 00 A0 00 00
The range in which I want to write is already allocated by the process. Therefore, I can't simply allocate new mem with VirtualAlloc
.
However, since the pages in the desired address space are used for program code, they are not 100% used. There exists enough space somewhere to write my 5 bytes.
What do I have to do to ensure that I don't overwrite necessary memory?