简体   繁体   English

如何注入/挂接正在运行的进程以从中获取信息?

[英]How can I inject/hook into a running process to get information from it?

I'm trying to learn about injecting/hooking running processes. 我正在尝试学习有关注入/挂钩正在运行的进程。

I have a game running, and in the game you can type /coord to get a print of what your current X, Y coordinates are. 我正在运行一个游戏,在游戏中您可以键入/ coord以获取当前X,Y坐标的打印内容。 Basically I want to just have this done automatically through a program so I was looking into how I might do this with C# but I'm not exactly sure what I would google to start to learn how exactly I might do this, basically I just want a small GUI that will update the X/Y position automatically as I move around. 基本上,我只是想通过一个程序自动完成此操作,所以我一直在研究如何使用C#进行此操作,但是我不确定自己会如何使用google来开始学习如何精确地执行此操作,基本上我只是想一个小的GUI,它将在我四处移动时自动更新X / Y位置。

I'm not exactly sure where to start if anybody can just point me in the right direction that would be great. 我不确定如果有人能指出正确的方向,那将是一个很好的起点。

If this is too off-topic / broad feel free to close it, sorry for any inconvenience. 如果这太离题了/随意关闭它,给您带来的不便,敬请原谅。

This is not really possible with c# only, unless the game is also written in c#, and you can somehow convince the game to load your module. 仅使用c#确实不可能做到这一点,除非游戏也是用c#编写的,并且您可以以某种方式说服游戏加载模块。

Otherwise, there will need to be atleast a native stub that starts up the .net runtime. 否则,将至少需要一个用于启动.net运行时的本机存根。

See this for an example of injecting native code in an application: http://www.codeproject.com/Articles/4610/Three-Ways-to-Inject-Your-Code-into-Another-Proces 请参见此示例,以了解如何在应用程序中注入本机代码: http : //www.codeproject.com/Articles/4610/Three-Ways-to-Inject-Your-Code-into-Another-Proces

This native code can then bootstrap whatever intermediate language you will use. 然后,该本地代码可以引导您将使用的任何中间语言。

On the other hand, reading the process memory can be done from any language that can use the Windows API, using OpenProcess, ReadProcessMemory, CloseHandle . 另一方面,可以使用OpenProcess, ReadProcessMemory, CloseHandle从可以使用Windows API的任何语言读取进程内存。

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

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