c - Access process memory directly -



c - Access process memory directly -

simple question:

is possible, , how possible, acess virtual memory of programme directly?

to specific, instead of typing

int somevalue = 5;

can this:

virtualmemory[0x0] = (int)5;

i'm asking because want values stored next each other nice , little memory map.

when assembler basics, processor stores values straight after each other , wondering how in c.

thanks of replies.

cheers,

lucky

not exactly, because in source code don't know memory address programme going "loaded into". memory addresses in programme encoded in "offset start of program" type manner.

part of "process loader"'s responsibility in copying programme memory add together "base offset pointer" other offesets, "names" describing memory addresses refer actual memory addresses instead of "offsets origin of program".

that's thing, if encoded directly, 2 programs needed same set of addresses couldn't run @ same time without corrupting each other's shared memory. in addition, loading programme different starting address not possible, walking outside of memory of programme (nearly guaranteed if relocate programme without rewriting memory address references) going raise segfault in operating system's memory management monitors.

also need name start at, , means offsets bound variable names. much easier fishing around in heap based off of alloc'd item find start of programme loaded in memory (because c programming language doesn't capture address in-language variable name, , layout scheme dependent).

c memory-management virtual-memory

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -