Old 28th May 2019, 08:16   #1
Tessan
Junior Member
 
Join Date: May 2019
Posts: 1
MessageBox causes NSIS installer/uninstaller to terminate

Hi,
I made a bugfix on an old product running on Windows Server 2003. The installer is created from NSIS 2.46 (I also tried NSIS 3.04) but terminates immediately without trace when it is supposed to open a MessageBox. The installer works fine on Windows7 and Windows 10. Code sample, function called from .onInit:

Function IsOcpInstalled
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "DisplayName"
StrCmp $0 "" ContinueInstallation
MessageBox MB_ICONEXCLAMATION|MB_OK "A version of the OCP is already installed! Please uninstall it first"

ContinueInstallation:

FunctionEnd

When a previous OCP is installed, the messagebox never shows and the installer terminates. If no OCP previously installed, the installer continues until it gets to another function requesting user to make a selection. For instance if a license is not found, a MessageBox is supposed to request user to select whether to continue or to cancel the installation. This never happens, the installer immediately terminates.

I commented out all usage of MessagBoxes and the installer works fine also on Windows Server 2003. I have searched the web and found others with similar issues but not related to NSIS. Is there anyone that knows whether this is a known problem and if there is a solution already available?

Currently my workaround is to only allow MessageBox if installer running on OS from Windows 7 and up. If that is not the case a default selection is made and a notifcation is written to an install log. However I think it is better to have an instant interaction with the user.
Tessan is offline   Reply With Quote
Old 28th May 2019, 16:31   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,097
MessageBox should not crash!

What happens if you call it directly (for 2.46 and 3 ansi):
Quote:
Section
System::Call 'USER32::MessageBoxA(i$hwndParent,t "World", t "Hello", i 0)'

System::Call '*(&l4, i$hwndParent, i0, t "Indirect World", t "Hello", i 0, i0,i0,i0,i0)i.r1'
System::Call 'USER32::MessageBoxIndirectA(ir1)'
System::Free $1
SectionEnd
?

Does this machine have 3rd-party anti-virus? Utility applications that hooks things?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
messagebox winserver2003

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump