focht
February 1st, 2004, 09:09
Greetings,
while working on plugin which is splitted into some dlls with implicit linkage, i'm facing the problem of OS loader dll search path.
Usually this wouldnt be a problem - if one puts _all_ the custom dlls into ollydbg main app directory.
But this is tedious.
Due to the increasing number of plugins i use a subdirectory ".\Plugins" and pointed ollydbg "plugin path" option to it.
This doesnt work on plugins which have additional custom dlls implicitly linked.
They dont get found by OS loader (of course).
Ollydbg iterates thru all the *.dll files in specified plugin directory and tries to load em using LoadLibrary().
LoadLibrary() uses the following paths to look for additional (implicit) modules :
- directory from which the application loaded.
- current directory.
- system directory.
- 16-bit system directory.
- windows directory.
- directories that are listed in the PATH environment variable.
- redirection file (which overrides given path to match app directory first)
- _BaseDllDirectory (using new Set/GetDllDirectory() APIs, XP SP1+)
As you see the "custom" plugin directory is never by searched by loader.
A (backwards) portable solution would be using SetCurrentDirectory() to plugin directory before calling LoadLibrary().
This gets the plugin the chance to resolve implicit dll references.
The current directory can be later be restored back to old value.
(any custom dll must not use delay load feature)
For now i have to use the "ugly" way to dump the additional dlls into ollydbg directory or modify PATH env variable for additional plugin path.
Would be nice if ollydbg has option to influence plugin loader mechanism to include plugin directory to resolve implicit references.
Regards,
A. Focht
PS: explicit dll linkage is _not_ an option for me.
while working on plugin which is splitted into some dlls with implicit linkage, i'm facing the problem of OS loader dll search path.
Usually this wouldnt be a problem - if one puts _all_ the custom dlls into ollydbg main app directory.
But this is tedious.
Due to the increasing number of plugins i use a subdirectory ".\Plugins" and pointed ollydbg "plugin path" option to it.
This doesnt work on plugins which have additional custom dlls implicitly linked.
They dont get found by OS loader (of course).
Ollydbg iterates thru all the *.dll files in specified plugin directory and tries to load em using LoadLibrary().
LoadLibrary() uses the following paths to look for additional (implicit) modules :
- directory from which the application loaded.
- current directory.
- system directory.
- 16-bit system directory.
- windows directory.
- directories that are listed in the PATH environment variable.
- redirection file (which overrides given path to match app directory first)
- _BaseDllDirectory (using new Set/GetDllDirectory() APIs, XP SP1+)
As you see the "custom" plugin directory is never by searched by loader.
A (backwards) portable solution would be using SetCurrentDirectory() to plugin directory before calling LoadLibrary().
This gets the plugin the chance to resolve implicit dll references.
The current directory can be later be restored back to old value.
(any custom dll must not use delay load feature)
For now i have to use the "ugly" way to dump the additional dlls into ollydbg directory or modify PATH env variable for additional plugin path.
Would be nice if ollydbg has option to influence plugin loader mechanism to include plugin directory to resolve implicit references.
Regards,
A. Focht
PS: explicit dll linkage is _not_ an option for me.