Archive: .onInstSuccess crashes


.onInstSuccess crashes
If I put a messagebox in .onInstSuccess function like

MessageBox MB_OK "Test" and then when the message box
shows up I try to move it around holding its window title -the installer crashes. It is reproducable on all systems in all sample plugins that come with the NSIS installations.

Help!


Unable to reproduce what you're referring, you better post a minimal example.

; The name of the installer
Name "Example1"

; The file to write
OutFile "example1.exe"

; The default installation directory
InstallDir $PROGRAMFILES\Example1

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

; Pages

Page directory
Page instfiles

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

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File example1.nsi

SectionEnd ; end the section

Function .onInstSuccess
StrCpy $0 0
start:
StrCmp $0 3 end
MessageBox MB_OK "Success!"
IntOp $0 $0 + 1
goto start
end:
FunctionEnd

InstallDir "$PROGRAMFILES\Test\"

Name "Test"
OutFile "Test.exe"

Section -Start

SetOutPath "$INSTDIR"
File "..\..\..\Bin\Release\Test.dll"
RegDLL "$INSTDIR\Test.dll"

MessageBox MB_OK "Test"

SectionEnd

Well, somehow when RegDLL is called, then MessageBox crashes the installer.


Provided that $INSTDIR has a valid path, it might be that for some reason regdll failed, check it with iferrors.


InstallDir "$PROGRAMFILES\Test\"

Name "Test"
OutFile "Test.exe"

Section -Start

SetOutPath "$INSTDIR"
File "..\..\..\Bin\Release\Test.dll"
RegDLL "$INSTDIR\Test.dll"
iferrors _Errors _NoErrors

_Errors:
MessageBox MB_OK "RegDLL failed."
goto _Done

_NoErrors:
MessageBox MB_OK "RegDLL succeeded"
goto _Done

_Done:
MessageBox MB_OK "Done"

SectionEnd

I always get "RegDLL succeeded" message. When I start moving the window around (message box), the installer crashes.

HEEEEEEEEEEEEEEEEELP! Test.dll was created via Visual Studio C++ 2005 - DllRegisterServer() does not have anything but the standard stuff.


All I can say is that I'm unable to reproduce the problem even with a dll which has not DllRegisterServer and therefore returns error.

InstallDir "$PROGRAMFILES\Test\"

Name "Test"
OutFile "Test.exe"

Section -Start

SetOutPath "$INSTDIR"
File "${NSISDIR}\Plugins\LangDLL.dll"
ClearErrors
RegDLL "$INSTDIR\LangDLL.dll"
IfErrors lb_error lb_success
lb_error:
MessageBox MB_OK "Error" IDOK end
lb_success:
MessageBox MB_OK "Success"
end:
SectionEnd

Function .onInstSuccess
StrCpy $0 0
start:
StrCmp $0 3 end
MessageBox MB_OK "Install Success!"
IntOp $0 $0 + 1
goto start
end:
FunctionEnd
NSIS 2.24