Archive: problems registering DLL files


problems registering DLL files
I'm having some problems getting NSIS to properly register several DLLs. Only these particular DLLs are giving me a problem:

!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
In the install.log file It show the following lines:
IfFileExists: file "C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtsffile.dll" exists, jumping 0
Error registering DLL: Could not load C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtsffile.dll
Jump: 611
IfFileExists: file "C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtspkg.dll" exists, jumping 0
Error registering DLL: Could not load C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtspkg.dll
Jump: 654
IfFileExists: file "C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtspump.dll" exists, jumping 0
Error registering DLL: Could not load C:\Program Files\Common Files\Mustang Shared\DTS Tools\dtspump.dll
Jump: 697
IfFileExists: file "C:\Program Files\Common Files\Mustang Shared\DTS Tools\axscphst.dll" exists, jumping 0
Error registering DLL: Could not load C:\Program Files\Common Files\Mustang Shared\DTS Tools\axscphst.dll
Jump: 740
IfFileExists: file "C:\Program Files\Common Files\Mustang Shared\DTS Tools\custtask.dll" exists, jumping 0
Error registering DLL: Could not load C:\Program Files\Common Files\Mustang Shared\DTS Tools\custtask.dll
Jump: 783
Any items what could be causing the problem?

I should also add that registering the files manually with regsvr32.exe works fine.


No clue about this but as a starter you could try putting quotation marks around REBOOT_NOTPROTECTED.


Make sure that all of the DLL's dependencies are in place and that they can be found. In your case, you probably just need to use:

SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
SetOutPath sets the current working directory. That's one of the places Windows looks for dependencies.

Originally posted by kichik
Make sure that all of the DLL's dependencies are in place and that they can be found. In your case, you probably just need to use:
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
SetOutPath sets the current working directory. That's one of the places Windows looks for dependencies.
You were right. These DLLs require various RLL files (resource files) to be in the \Resource\1033\ subdirectory, while the fiels *were* being put there first, apparently it couldn't find them becuase the output path was the sysdir at the time of registration.

So rule-of-thumb now: If your files require RLL files, you must set the output path first if you us the new InstallLib macros.

Here is the new, complete script to install the SQL Server 2000 DTS files:
  ; MS SQL Server (DTS) Components
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\Resources\1033"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtsffile.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtspkg.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtspump.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\axscphst.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtsrun.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\custtask.rll"
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqlresld.dll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtsrun.exe"
SetOutPath $SYSDIR
File "C:\Windows\System32\sqlunirl.dll"
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"

What about a problem with InstallLib where it crashes the installer on WinXP and it doesn't crash on Win2000 (I try to register
few OCX files) ?

I use clean installs of Win2K and WinXP and the installer crashes every time (I use Virtual PC as well as "live" PC to test it)

WinXP Error:

AppName: setup.exe
AppVer: 0.0.0.0
ModName: msvcrt.dll
ModVer: 7.0.2600.1106
Offset: 000216af

It installs w/o a problem on clean installations of WinME, Win98SE and Win2K.


SetOutPath $INSTDIR
!insertmacro InstallLib RegDLL $ALREADY_INSTALLED REBOOT_PROTECTED ctListBar.ocx $INSTDIR\ctListBar.ocx $INSTDIR
!insertmacro InstallLib RegDLL $ALREADY_INSTALLED REBOOT_PROTECTED ctNavBar.ocx $INSTDIR\ctNavBar.ocx $INSTDIR
!insertmacro InstallLib RegDLL $ALREADY_INSTALLED REBOOT_PROTECTED ctToolBar.ocx $INSTDIR\ctToolBar.ocx $INSTDIR
; Shortcuts to Somewhere in Start Menu and on Desktop
CreateDirectory "$SMPROGRAMS\Somewhere"
CreateShortCut "$SMPROGRAMS\Somewhere\Somewhere.lnk" "$INSTDIR\Somewhere.exe"
CreateShortCut "$DESKTOP\Somewhere.lnk" "$INSTDIR\Somewhere.exe"


Brings the following errors:
[...]
Extract: C:\Program Files\Somewhere\ctListBar.ocx
Could not load: C:\Program Files\Somewhere\ctListBar.ocs
Extract: C:\Program Files\Somewhere\ctListBar.ocx
Could not load: C:\Program Files\Somewhere\ctListBar.ocs
Extract: C:\Program Files\Somewhere\ctListBar.ocx
Could not load: C:\Program Files\Somewhere\ctListBar.ocs
Create folder C:\Documets and Settings\All Users\Start Menu\Somewhere

and then it crashed with the mentioned error.

Any ideas ?

Probably a missing dependency. It is also possible the OCX is not compatible with Windows XP.


I can register them manually using RegSvr32.exe.

Hmm, I did create a simple installer which just registers those OCXs and it worked. I must have messed something with my script. I will check it now.


Finally got it nailed - it turned out that the OCX files had to be registered before other DLLs (even if the DLLs didn't require those OCX files at all)

Now it works perfectly under WinXP, Win2K, etc :)


Originally posted by mike1998
You were right. These DLLs require various RLL files (resource files) to be in the \Resource\1033\ subdirectory, while the fiels *were* being put there first, apparently it couldn't find them becuase the output path was the sysdir at the time of registration.

So rule-of-thumb now: If your files require RLL files, you must set the output path first if you us the new InstallLib macros.

Here is the new, complete script to install the SQL Server 2000 DTS files:
  ; MS SQL Server (DTS) Components
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\Resources\1033"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtsffile.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtspkg.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtspump.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\axscphst.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\dtsrun.rll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\custtask.rll"
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqlresld.dll"
File "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtsrun.exe"
SetOutPath $SYSDIR
File "C:\Windows\System32\sqlunirl.dll"
SetOutPath "$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtsffile.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspkg.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\dtspump.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\axscphst.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
!insertmacro InstallLib REGDLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED \
"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools\custtask.dll" \
"$PROGRAMFILES\Common Files\Mustang Shared\DTS Tools"
The Best Solution, Congratulations!

This worked for me as well when I was trying to register FoxPro 9 Runtimes even though I wasn't using RLL files. Thanks!