简体   繁体   English

从另一个进程获取内存

[英]Grabbing memory from another process

in Windows, lets say I have used DLL Injection to get into another process. 在Windows中,可以说我已经使用DLL注入进入另一个进程。 I have also done some screencaptures of the memory on the process I have injected into and know the location of the data I want to pull out. 我还对注入的进程进行了一些屏幕截图,并知道了要提取的数据的位置。 Lets say there is data in the other process at 0xaaaaaaaa that contains a certain value. 可以说,另一个进程中的数据在0xaaaaaaaa处包含某个值。 How do I grab this value from that process so I can use it in my injecting app? 如何从该过程中获取此值,以便可以在注射应用程序中使用它? Since I am injected into the process, can I just use something like memcpy? 既然我已经被注入了流程,我是否可以使用像memcpy这样的东西?

memcpy(value, 0xaaaaaaaa, 10);

I'm assuming it's probably more involved than this? 我假设它可能比这更复杂?

EDIT: To the responses below, I don't see how WM_COPYDATA helps me as it is for sending data to another application, not for retrieving data FROM an existing application. 编辑:对于下面的响应,我看不到WM_COPYDATA是如何帮助我的,因为它是将数据发送到另一个应用程序,而不是从现有应用程序中检索数据。

In Windows every process addresses its own memory. 在Windows中,每个进程都处理自己的内存。 That means you cannot do something like memcpy having two pointers that point to memory of two different processes. 这意味着您无法执行像memcpy这样的具有两个指向两个不同进程的内存的指针的操作。

You can consider any option of interprocess communication: memory mapped files, sockets, named pipes, event window messages. 您可以考虑进程间通信的任何选项:内存映射文件,套接字,命名管道,事件窗口消息。

Here is more information about IPC 这是有关IPC的更多信息

试用WM_COPYDATA并从MSDN寻求帮助。

The following IPC mechanisms are supported by Windows: Windows支持以下IPC机制:

Clipboard 剪贴板
COM 通讯
Data Copy 资料复制
DDE DDE
File Mapping 文件映射
Mailslots 邮筒
Pipes 管子
RPC RPC
Windows Sockets Windows套接字

more details here Interprocess Communications 此处有更多详细信息进程间通信

in your case I would use WM_COPYDATA Message 在您的情况下,我将使用WM_COPYDATA消息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM