Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++/CLI
hi,
 
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;
 
and the injector.exe has also a code like this..
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 26-Aug-12 19:45pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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;}
}
 
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);
}
 

Thanks,
 
Kuthuparakkal
  Permalink  
Comments
Juan _dela_cruz at 27-Aug-12 11:37am
   
can i also hook my injector to the target.exe ?
Kuthuparakkal at 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)

  Print Answers RSS
0 OriginalGriff 210
1 Richard MacCutchan 100
2 kbrandwijk 90
3 ProgramFOX 80
4 Mukesh Bhagat 65
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100