To get memory from another process.

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Apr 8 20:46:48 UTC 2020


On Wed, Apr 08, 2020 at 08:16:27PM +0000, Quantium via Digitalmars-d-learn wrote:
> On Wednesday, 8 April 2020 at 16:25:01 UTC, Net wrote:
[...]
> > As far I know, you can't access other's program memory in any modern
> > operating system.  That's managed and protected by the OS through
> > virtual addressing.

On Linux, you can access process memory using the virtual file
/proc/$pid/mem, where $pid is the process ID.  But you need root access
for this to work, and you also need to know how the memory is mapped in
the process (reading from an unmapped offset will return I/O error).


> > What are you trying to do?
> 
> Now I know that programm even at Administrator mode cannot do this.
> Only system permission can do that. Or a driver on a kernel-level
> (zero level).  So now the question is how to code driver, which gets
> other process' memory on D.

This question has nothing to do with D.  You need to know how your OS
works, and whether it has an interface that provides the access you
want.  The programming language cannot give you this, and is also
irrelevant as far as performing this operation is concerned; if you have
an API that can do this, you can do it in any language.


> Also, I know antiviruses will try to block this driver so I'll test it
> with no antiviruses and Microsoft Defender off. Or if I'm mistaking
> anywhere and this is impossible on Windows, is it possible on Linux?

You didn't answer the question.  Why are you trying to access another
process's memory?  Without knowing what you're trying to do, it's hard
to give you a more specific answer.


T

-- 
Music critic: "That's an imitation fugue!"


More information about the Digitalmars-d-learn mailing list