将DLL注入目标进程(问题) [英] injecting dll to the target process(question)

查看:63
本文介绍了将DLL注入目标进程(问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



好的,我有3个文件

target.exe sample.dll injector.exe

target.exe 具有这样的代码..



ok i have 3 files

target.exe, sample.dll, injector.exe

the target.exe has a code something like these..

int a = 2, b = 3, c;
a + b = c;



injector.exe 也有这样的代码..



and the injector.exe has also a code like this..

int c = 5;



在我的 injector.exe 注入 sample.dll target.exe
后 我想将 int c = 5 (从jector.exe)发送到 target.exe . (如何?)


我猜 sample.dll 中有某种功能?


在此先感谢



after my injector.exe inject the sample.dll to the target.exe
i want to send int c = 5(from injector.exe) to the target.exe. (How?)


im guessing theres some kind of function in the sample.dll ?


thanks in advance

推荐答案

为私有成员c定义一个属性(获取设置).

然后,您可以使用反射设置属性.让属性名称为"PropForMyC"

Define a Property(get set) for the private member c.

Then you can set the property using reflection. Let Property Name is "PropForMyC"

private int c;
Public int PropForMyC
{
get {return c;}
set {c = value;}
}



假设您的Target.exe具有一个具有上述属性的对象(类).将此对象设为obj
现在您可以像这样使用:



Suppose you have your Target.exe has an object(class) that has the above mentioned Property. Let this object be obj
Now you can use like this :

PropertyInfo prop = obj.GetType().GetProperty("PropForMyC", BindingFlags.Public | BindingFlags.Instance);
if(null != prop && prop.CanWrite)
{
    prop.SetValue(obj, 5, null);
}




谢谢,

Kuthuparakkal




Thanks,

Kuthuparakkal


这篇关于将DLL注入目标进程(问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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