使用C#从另一个进程调用一个函数 [英] Using c# to call a function from another process

查看:154
本文介绍了使用C#从另一个进程调用一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造我自己的学习目的的内存修改程序。我的一个朋友,我想触发另​​一个节目中指出的功能。

I'm creating a memory modifying program for my own learning purposes. A friend of mine pointed out a function in another program that I want to trigger.

该功能在其他程序0x004B459C。我知道如何读取和写入内存,但我怎么能触发我的程序这个功能。我没有源这个其他程序。

The function is at 0x004B459C in the other program. I know how to read and write memory, but how can I trigger this function from my program. I do not have the source to this other program.

我的问题是,我需要,如果我知道这个十六进制code,还是我只是写东西的内存来触发此注入功能?

My question is do I need to inject the function if I know this hex code, or do I just write something to memory to trigger this?

推荐答案

想一下你真正想要的。你想其他的进程来执行此功能。过程不执行code,它是执行code线程。如果你想在其他的进程调用这个函数作为它的正常操作的一部分,你必须弄清楚的投入等,这将使得其他进程的线程之一调用它。一般来说,你将运行,破坏了其它过程中的风险任何其他方式。它可以注入一个线程到另一个进程,并把它叫你感兴趣的功能(见的​​ CreateRemoteThread的)。如果此功能旨在消息泵线程上被调用,你可以的注入消息钩子到其他进程,它发送一个特殊的消息,并从你的钩子调用它。有一些更多的方式(APC),但这些仍而收效甚微更加复杂。

Think a bit about what you really want. You want the other process to execute this function. Processes don't execute code, it's threads that execute code. If you want the other process to call this function as a part of it's normal operations, you will have to figure out inputs etc. which will make one of the other process's threads call it. Generally speaking, any other way you will be running the risk of corrupting the other process. It is possible to inject a thread into another process and have it call the function you're interested in (see CreateRemoteThread). If this function is intended to be called on the message pump thread, you could inject a message hook into the other process, send it a special message and call it from your hook. There are a few more ways (APC) but these are still more complicated for little gain.

这篇关于使用C#从另一个进程调用一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆