Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

ok i have 3 files

target.exe, sample.dll, injector.exe

the target.exe has a code something like these..
C++
int a = 2, b = 3, c;
a + b = c;


and the injector.exe has also a code like this..
C++
int c = 5;


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
Posted

1 solution

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

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

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


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 :
C#
PropertyInfo prop = obj.GetType().GetProperty("PropForMyC", BindingFlags.Public | BindingFlags.Instance);
if(null != prop && prop.CanWrite)
{
    prop.SetValue(obj, 5, null);
}



Thanks,

Kuthuparakkal
 
Share this answer
 
Comments
Ronni2013 27-Aug-12 11:37am    
can i also hook my injector to the target.exe ?
Kuthuparakkal 27-Aug-12 11:41am    
need more info plz

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900