Inject DLL

  • Thread starter Thread starter Nim
  • Start date Start date
N

Nim

HI, I would like to know if it's possible inject a dll (create with c++)
into an application with c# like c++, and which instruction use c# for
do this
 
Hi Nim,

What do you mean by inject.
If you want to use a dll written in c++ form c# code go ahead use P\Invoke
and DllImport attribute. But don't forget that you can use only plain
c-style functions or global c++ function if you check the exact spelling of
the fuction name (c++ decorates function names).

If you want to use classes you can do it only with COM.

If you want to inject a DLL in running process which happens to host CLR
from another application you can do that using windows hooks, but I don't
see what you can do with that afterwards , so I suppose this is not the case
 
Yes i would like to do a windows sochet hook



Hi Nim,

What do you mean by inject.
If you want to use a dll written in c++ form c# code go ahead use P\Invoke
and DllImport attribute. But don't forget that you can use only plain
c-style functions or global c++ function if you check the exact spelling of
the fuction name (c++ decorates function names).

If you want to use classes you can do it only with COM.

If you want to inject a DLL in running process which happens to host CLR
from another application you can do that using windows hooks, but I don't
see what you can do with that afterwards , so I suppose this is not the case
 
Yes i would like to do a windows sochet hook for a specific process

I create a c# application that execute in separate thread a Win32
Process, than i create a c++ dll to hook socket of this process and i
would like, if it's possible, that my c# copy the my DLL in the process.

Some hears ago i do this project with c++ 6.0 and i hadn't any problem.

Now If it's possible in c# or exist other methods ?
 
Hi Nim,
IMHO it is not possible to set a windows hook written in c# into a different
process. Think of it. You need your targed process to host a CLR in order to
run a managed code.
 
Back
Top