469,623 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

Inject DLL

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
Nov 15 '05 #1
5 6037

You must use PInvoke() and the attribute [dllImport

I hope this help
Nov 15 '05 #2
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

--
HTH
B\rgds
100

"Nim" <Ni*@ms.it> wrote in message
news:Y6*********************@twister2.libero.it...
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

Nov 15 '05 #3
Nim
Yes i would like to do a windows sochet hook


Stoitcho Goutsev (100) [C# MVP] wrote:
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

--
HTH
B\rgds
100

"Nim" <Ni*@ms.it> wrote in message
news:Y6*********************@twister2.libero.it...
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


Nov 15 '05 #4
Nim
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 ?


Stoitcho Goutsev (100) [C# MVP] wrote:
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

--
HTH
B\rgds
100

"Nim" <Ni*@ms.it> wrote in message
news:Y6*********************@twister2.libero.it...
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


Nov 15 '05 #5
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.
--
B\rgds
100

"Nim" <Ni*@ms.it> wrote in message
news:S%*********************@twister1.libero.it...
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 ?


Stoitcho Goutsev (100) [C# MVP] wrote:
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
--
HTH
B\rgds
100

"Nim" <Ni*@ms.it> wrote in message
news:Y6*********************@twister2.libero.it...
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


Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Christopher H. Laco | last post: by
2 posts views Thread by andysideas | last post: by
reply views Thread by Fabien Penso | last post: by
1 post views Thread by yanir | last post: by
3 posts views Thread by Angel | last post: by
1 post views Thread by =?Utf-8?B?SkhpbGJDUk0=?= | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.