Load an external DLL into ModScript Question


I wrote a C++ DLL which will be loaded from a ModScript. This DLL depends on some additional DLLs. The only solution to bring all this to work is to copy all additional DLLs into the system32 folder :(
I tried also the suggested ways from SBM documentation to set location to DLLs in PATH variable and to set registry key ScriptAppPath. The result was that my self-written DLL can be found directly in ModScript without an absolute path to it, but it seems that the additional DLLs are not expected at this location.

Is the system32 folder is the only place to store additional DLLs, or is it possible to store them in a better location on hard disk?

Thanks and Regards,
Responses (1)
  • Accepted Answer

    Tuesday, February 19 2019, 11:04 AM - #Permalink
    Hello Andre,

    I haven't checked this recently, but last time I did the search order Windows uses to locate DLLs is:

    1. The directory containing the executable that wants to load the DLL.
    2. The current directory, also known as the "Start in" directory.
    3. The %SystemRoot%\system32 directory (eg. C:\WINNT\system32).
    4. The %SystemRoot%\system directory (eg. C:\WINNT\system).
    5. The %SystemRoot% directory (eg. C:\WINNT).
    6. The directories specified in %PATH%, left to right.

    When the executable is IIS, #1 and #2 are not obvious (and likely a system directory, given it's an OS component), but the remainder well defined. You probably want to avoid all variants of %SystemRoot%, which gets us to %PATH%. This really ought to work, but a gotcha here is that PATH gets inherited by the executable at process startup, so changes to PATH normally don't get noticed until the process is restarted.

    If you did not already try restarting WWW Publishing Services (and anything App Pool related) after changing %PATH%, do so now. If that doesn't work, and it's an option, reboot the OS - this will ensure every single process inherits the new PATH. (And just in case: make sure you've updated the PATH in the System variables section, not the User variables one.)

    Hope this helps!

    - Richard.
    The reply is currently minimized Show
Your Reply

Recent Tweets