Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 07, 2020 To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Could you advise me how to do these steps on D? Which libs should I import? 1. My programm gets a path to exe file 2. My programm starts that exe file and writes into it 2 commands 3. Programm gets access to exe file memory 4. Programm gets data from process memory and writes it into data.bin file which is in the same directory. As I said, which libs do I need and how to get access to other process memory. Also, can I make this as a driver, but if yes, how to code driver on D? |
April 08, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quantium | On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote:
> Could you advise me how to do these steps on D? Which libs should I import?
> 1. My programm gets a path to exe file
> 2. My programm starts that exe file and writes into it 2 commands
> 3. Programm gets access to exe file memory
> 4. Programm gets data from process memory and writes it into data.bin file which is in the same directory.
> As I said, which libs do I need and how to get access to other process memory.
> Also, can I make this as a driver, but if yes, how to code driver on D?
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.
What are you trying to do?
|
April 09, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Net | On 09/04/2020 4:25 AM, Net wrote:
> On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote:
>> Could you advise me how to do these steps on D? Which libs should I import?
>> 1. My programm gets a path to exe file
>> 2. My programm starts that exe file and writes into it 2 commands
>> 3. Programm gets access to exe file memory
>> 4. Programm gets data from process memory and writes it into data.bin file which is in the same directory.
>> As I said, which libs do I need and how to get access to other process memory.
>> Also, can I make this as a driver, but if yes, how to code driver on D?
>
> 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.
Yes you can, in all modern operating systems.
It is used for debugging.
|
April 08, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Net | On Wednesday, 8 April 2020 at 16:25:01 UTC, Net wrote:
> On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote:
>> Could you advise me how to do these steps on D? Which libs should I import?
>> 1. My programm gets a path to exe file
>> 2. My programm starts that exe file and writes into it 2 commands
>> 3. Programm gets access to exe file memory
>> 4. Programm gets data from process memory and writes it into data.bin file which is in the same directory.
>> As I said, which libs do I need and how to get access to other process memory.
>> Also, can I make this as a driver, but if yes, how to code driver on D?
>
> 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.
>
> 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.
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?
|
April 08, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quantium | 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!" |
April 08, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Wednesday, 8 April 2020 at 20:46:48 UTC, H. S. Teoh wrote:
> 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
I'm trying to do this because I have very special programm that makes some calculations and on every calculation there is a hash in RAM. I need to get a one of hash values from a .bin file, and replace them. I mean hash in RAM of the programm is added to end of .bin file, and one of hashes from that file (I set up sorting algorithm by myself) is in RAM of programm.
|
April 09, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quantium | On Wednesday, 8 April 2020 at 21:04:42 UTC, Quantium wrote:
> I'm trying to do this because I have very special programm that makes some calculations and on every calculation there is a hash in RAM. I need to get a one of hash values from a .bin file, and replace them. I mean hash in RAM of the programm is added to end of .bin file, and one of hashes from that file (I set up sorting algorithm by myself) is in RAM of programm.
This sounds very similar to how one would try to circumvent a file integrity check in a Windows program.
Anyway, messing with another, isolated processes is stuff that is highly specific to each operating system. Anyway, there are no generic answers to your question. This is hardcore systems programming. You should rather look at your OS documentation to see what is provided there.
|
April 09, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gregor Mückl | > Anyway, messing with another, isolated processes is stuff that is highly specific to each operating system. Anyway, there are no generic answers to your question. This is hardcore systems programming. You should rather look at your OS documentation to see what is provided there.
Ok. For training example, we're using Windows 10 Por. We can use WinAPI. Are there any D libs to use WinAPI?
|
April 09, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quantium | On Thursday, 9 April 2020 at 17:23:19 UTC, Quantium wrote:
>> Anyway, messing with another, isolated processes is stuff that is highly specific to each operating system. Anyway, there are no generic answers to your question. This is hardcore systems programming. You should rather look at your OS documentation to see what is provided there.
>
> Ok. For training example, we're using Windows 10 Por. We can use WinAPI. Are there any D libs to use WinAPI?
I mean Win 10 Pro, misprint :)
|
April 09, 2020 Re: To get memory from another process. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Quantium | On Thursday, 9 April 2020 at 17:23:19 UTC, Quantium wrote:
> We can use WinAPI. Are there any D libs to use WinAPI?
import core.sys.windows.windows;
it is all built in.
|
Copyright © 1999-2021 by the D Language Foundation