Registering dll on reboot - dependency problems
Hi folks. I'm using the UpgradeDLL macro to upgrade DLLs in
"$PROGRAMFILES\${COMPANY_NAME}\Shared\${PRODUCT_NAME}"
When the DLL needs to be upgraded, but is in use, this macro cunningly extracts the file to a temporary location and copies it over the actual location at reboot. In order to reregister the DLL, the macro also adds the following entry to the RunOnce registry key.
"C:\WINNT\SYSTEM32\rundll32.exe" "C:\Program Files\Company\Shared\Product\TheDll.dll",DllRegisterServer
Unfortunately, this does not work for me. This is because TheDll.dll has a static dependency (that I cannot change) on AnotherDll.dll that also resides in "$PROGRAMFILES\${COMPANY_NAME}\Shared\${PRODUCT_NAME}". Due to the way rundll32.exe uses LoadLibrary{1}, it does not search my installation directory for dependencies, and so fails to load TheDll.dll. This means TheDll.dll does not get reregistered and so the whole system doesn't work.
I have several choices[list=1][*]Bundle an appropriate version of regsvr32 with the installer and use this to do the RunOnce stuff instead of rundll32.[*]Stick with rundll32 and temporarily add my installation directory to the system path (will this then be used at the time RunOnce keys are executed?)[*]Find another, better, way to make the rundll32 trick work[/list=1]
Can anyone suggest a solution that works for Windows 9x onwards?
TIA - bidger
{1} See the MSDN info on LOAD_WITH_ALTERED_SEARCH_PATH and "the alternate file search strategy" that rundll32, unfortunately, does not use.