NO

Author Topic: DLL and Depends.exe  (Read 7870 times)

JohnF

  • Guest
DLL and Depends.exe
« on: March 14, 2005, 05:25:48 PM »
I've this DLL that Depends.exe says there are errors.

edit -image removed

The dll works ok, but can't find esfadu.dll or mpr.dll

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
DLL and Depends.exe
« Reply #1 on: March 14, 2005, 07:51:18 PM »
Hi John,
In effect its true that there is an error the point is that you haven't triggered it yet!
Let me explain: the program is telling you that the missing library is a "delay-loaded" type library not a standard one.
There two flavours of libraries the "normal" and the "delayed". The normal libraries are searched and loaded by the module loader as soon as the process is created and the main executable is loaded in memory. If this library cannot be found you immediatly get a complain from the loader.
The "delayed" libraries are libraries that are NOT loaded during the executable loading, but only when you call a funtion that is in that library.
If you want more information check on MSDN, also take a look at the MS PE format paper.
In plain words you hanot yet used any function from that library, but as soon you'll try to use one you'll get the error.
Hope to have been clear enough, if you need more carification please feel free to ask.
F.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
DLL and Depends.exe
« Reply #2 on: March 14, 2005, 07:57:49 PM »
Not sure I understand - where is the bug?

A DLL file marked as delay-loaded will only cause problems if the code actually tries to call a function in it. This is a common reason why the DLL is marked as delay-loaded in the first place - it might not exist on all systems. The code will do some checks and then call the DLL if it seems appropriate. This is easier than using LoadLibrary and GetProcAddress (the delay-load support code will do this automagically).

EFSADU.DLL is a Microsoft file that seems to handle file encryption. I don't know much about it, but maybe only needed on NTFS partition?

Pelle
/Pelle

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
DLL and Depends.exe
« Reply #3 on: March 14, 2005, 08:03:04 PM »
Hi Pelle,
I mean in first place that is not a bug absolutely, and that an error could happen if the missing library is not correctly handled. The delay loading could be used to avoid strong memory usage for rarely used functions.
F.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
DLL and Depends.exe
« Reply #4 on: March 14, 2005, 08:15:04 PM »
Pelle,
you're right this is a library for EFS (encrypted File System) that should work on XP NTFS partitions.
Anyway I was wondering on what could happen if, running on XP, an encryption/decryption is required and the library is missing...
F.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

JohnF

  • Guest
DLL and Depends.exe
« Reply #5 on: March 14, 2005, 08:27:47 PM »
Quote from: "Pelle"
Not sure I understand - where is the bug?

A DLL file marked as delay-loaded will only cause problems if the code actually tries to call a function in it. This is a common reason why the DLL is marked as delay-loaded in the first place - it might not exist on all systems. The code will do some checks and then call the DLL if it seems appropriate. This is easier than using LoadLibrary and GetProcAddress (the delay-load support code will do this automagically).

EFSADU.DLL is a Microsoft file that seems to handle file encryption. I don't know much about it, but maybe only needed on NTFS partition?

Pelle


Well basicaly I'm asking why the DLL has two DLL's linked that are not asked for by me. I'm not really up on this delayed loading stuff.

Will have to read some more.

Thanks Frankie for your replies.

John

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
DLL and Depends.exe
« Reply #6 on: March 14, 2005, 08:34:47 PM »
John,
you're welcome, anyway all this simply means:
1) You are not using an OS that supports encrypted files
    or
2) You never requested to encrypt/decrypt anything
enjoy
F.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
DLL and Depends.exe
« Reply #7 on: March 14, 2005, 11:12:54 PM »
Quote from: "JohnF"
Well basicaly I'm asking why the DLL has two DLL's linked that are not asked for by me. I'm not really up on this delayed loading stuff.

This was introduced in MSVC 5 or 6, I don't remember exactly.

The short answer is that if you use the linker option /DELAYLOAD:dllname, the linker will arrange for a helper function to be called when/if a function is called from this DLL. The helper function will use LoadLibrary on the first call, and also GetProcAddress, to patch the executable to go directly to the function on future calls. A slightly smarter version of the otherwise common sequence LoadLibrary, GetProcAddress, call ..., FreeLibrary. As long as you don't try to call a function in the DLL, nothing bad will happen to you.

Another neat feature is that the helper function can be replaced, so the DLL might be extracted from the resources, fetched over the Internet or what ever you can imagine.

I have attached the default version for Pelles C (normally lives in delayimp.lib).

Pelle
/Pelle

JohnF

  • Guest
DLL and Depends.exe
« Reply #8 on: March 15, 2005, 07:27:03 AM »
Thanks for the explanation - I should have started this thread in 'General discussions' not 'Bug reports'.

John