Archive: Problems with UpgradeDLL and MSXML4


Problems with UpgradeDLL and MSXML4
I have problems with the installation of msxml4 using UpgradeDLL.

This code works for MSXML3 but it fails for MSXML4.
(msxml4.dll will not be registered after this code)
:rolleyes:


!include UpgradeDLL.nsh

!ifndef MSXML_VERSION
!define MSXML_VERSION "msxml4"
!endif

!define REDIST_PATH "Redist\${MSXML_VERSION}"
!define PRODUCT_EXE "MyApp.exe"

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Section "-Install ${MSXML_VERSION}"

MessageBox MB_OK "*** Prepare setup for installing ${MSXML_VERSION} ***"
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}.dll" "$SYSDIR\${MSXML_VERSION}.dll" "$SYSDIR"

#1 RegDLL "$SYSDIR\${MSXML_VERSION}.dll"

!define UPGRADEDLL_NOREGISTER
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}a.dll" "$SYSDIR\${MSXML_VERSION}a.dll" "$SYSDIR"
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}r.dll" "$SYSDIR\${MSXML_VERSION}r.dll" "$SYSDIR"
!undef UPGRADEDLL_NOREGISTER

; Only increase DLL count on new installation
IfFileExists $INSTDIR\${PRODUCT_EXE} skipAddSharedDLL
Push $SYSDIR\${MSXML_VERSION}.dll
Call AddSharedDLL
Push $SYSDIR\${MSXML_VERSION}a.dll
Call AddSharedDLL
Push $SYSDIR\${MSXML_VERSION}r.dll
Call AddSharedDLL
skipAddSharedDLL:
SectionEnd

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Section "-un.Uninstall ${MSXML_VERSION}"

Push $SYSDIR\${MSXML_VERSION}.dll
Call un.DecrementSharedDLL
Push $SYSDIR\${MSXML_VERSION}a.dll
Call un.DecrementSharedDLL
Push $SYSDIR\${MSXML_VERSION}r.dll
Call un.DecrementSharedDLL

SectionEnd



The msxml files will be copied to system32 but my app fails if it uses xml functionallity.

If I try "regsvr32.exe msxml4.dll" my app works successfully.

Uncommenting comment #1 has the same effect,
the msxml4.dll will be registered sucessfully.

What is wrong with this code?

Solved: Problems with UpgradeDLL and MSXML4
I found out my problem. :up:

First I have to call the UpgradeDLL macro for the dlls which have not to be registered (msxml4a.dll and msxml4r.dll).
After this I can call the UpgradeDLL macro for the msxml4.dll. :o


!include UpgradeDLL.nsh

!ifndef MSXML_VERSION
!define MSXML_VERSION "msxml4"
!endif

!define REDIST_PATH "Redist\${MSXML_VERSION}"

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
Section "-Install ${MSXML_VERSION}"

!echo "*** Prepare setup for installing ${MSXML_VERSION} ***"

; upgrade the dll first which have not to be registered
!define UPGRADEDLL_NOREGISTER
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}a.dll" "$SYSDIR\${MSXML_VERSION}a.dll" "$SYSDIR"
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}r.dll" "$SYSDIR\${MSXML_VERSION}r.dll" "$SYSDIR"
!undef UPGRADEDLL_NOREGISTER

; upgrade the main xml file
!insertmacro UpgradeDLL "${REDIST_PATH}\${MSXML_VERSION}.dll" "$SYSDIR\${MSXML_VERSION}.dll" "$SYSDIR"

; Only increase DLL count on new installation
IfFileExists $INSTDIR\${PRODUCT_EXE} skipAddSharedDLL
Push $SYSDIR\${MSXML_VERSION}.dll
Call AddSharedDLL
Push $SYSDIR\${MSXML_VERSION}a.dll
Call AddSharedDLL
Push $SYSDIR\${MSXML_VERSION}r.dll
Call AddSharedDLL
skipAddSharedDLL:
SectionEnd

;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;
Section "-un.Uninstall ${MSXML_VERSION}"

Push $SYSDIR\${MSXML_VERSION}.dll
Call un.DecrementSharedDLL
Push $SYSDIR\${MSXML_VERSION}a.dll
Call un.DecrementSharedDLL
Push $SYSDIR\${MSXML_VERSION}r.dll
Call un.DecrementSharedDLL

SectionEnd