loading unmanaged dll

  • Thread starter Thread starter Aks
  • Start date Start date
A

Aks

Hi,
I have C# application "applic.exe" and a dll "dyna.dll"

whenever "applic.exe" or "dyna.dll" is loaded, I need them to also
load "test.dll" (unmanaged c++ dll).

I do not have sources of "applic.exe" or "dyna.dll"

Do I need to use linker here? or is there some way of rewriting
binaries to load "test.dll"

or is there any other way such that
whenever applic.exe or dyna.dll is started they automatically load
test.dll.

Thanking you in advance,
Akhila
 
Hi,


Aks said:
Hi,
I have C# application "applic.exe" and a dll "dyna.dll"

whenever "applic.exe" or "dyna.dll" is loaded, I need them to also
load "test.dll" (unmanaged c++ dll).

I do not have sources of "applic.exe" or "dyna.dll"

Do I need to use linker here? or is there some way of rewriting
binaries to load "test.dll"


How r u using test.dll ?

As the last resort you could use the Win32 LoadLibraryEx API


I'm not really sure right now, but I think that the compiler load the dll
for you if you are using P/invoke
 
Hi,
test.dll has code to register channel hooks in dll main. rest is by
callsbacks. so I am not calling any function of test.dll.

when a exe say client.exe is loaded the test.dll should be loaded as
part of the exe.

Is this possible thru reflection?

I am not sure, but code for LoadLibrary and Invoke should be added in
client.exe. and I do not have access to the code.

Is there any way for this.
TIA,
Akhila
 
| Hi,
| test.dll has code to register channel hooks in dll main. rest is by
| callsbacks. so I am not calling any function of test.dll.
|

If you don't call any function, what's the need to load the DLL? Bet you
need to call the functions to register the hooks.


| when a exe say client.exe is loaded the test.dll should be loaded as
| part of the exe.
|
| Is this possible thru reflection?
|
No, Reflection is a managed thing, you can't use it to load/call unmanaged
code libraries.

| I am not sure, but code for LoadLibrary and Invoke should be added in
| client.exe. and I do not have access to the code.
|

You can't do anything if you don't have access to the source code.

| Is there any way for this.

Nope.

Willy.
 
Aks said:
Hi,
I have C# application "applic.exe" and a dll "dyna.dll"

whenever "applic.exe" or "dyna.dll" is loaded, I need them to also
load "test.dll" (unmanaged c++ dll).

I do not have sources of "applic.exe" or "dyna.dll"

Do I need to use linker here? or is there some way of rewriting
binaries to load "test.dll"

or is there any other way such that
whenever applic.exe or dyna.dll is started they automatically load
test.dll.

Thanking you in advance,
Akhila

Hi Aks,

What do you mean "dyna.dll" is loaded? I can understand
loading "applic.exe"... you just mean when it is executed, yes?

I'm also not sure what you mean by loading "test.dll", is this some random
call to a "LoadLibrary" routine? Or do you also need to execute functions
and whatnot? Can you provide any further information?

-- Tom Spink
 
If dyna.dll is a com+ dll. it gets loaded into the memory whenever a
client calls new().
the code to register channelhooks is in DLLmain() itself. I need not
have to call any method for this.

when I have access to code of applic.exe,
I add a reference to test.dll,
in Main function call new() on one test.dlls classes
when applic.exe is built, test.dll is linked with it. and whenever
applic.exe runs it will load test.dll

now if I do not have code of applic.exe, I guess there is no other way
to include test.dll in applic.exe and call test.dll method. :-(
-Akhila
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top