nsisdl::download crash on cancel?
I have found an intermittent crash when canceling nsisdl::download. I can reproduce this very easily. My installer tries to download Microsoft's .NET Framework 1.1 setup and, if the user cancels, asks them if they would like to try again. If I quickly click cancel and retry about 5-10 times, my installer will crash.
I created an isolated test case that shows the problems seems to be related to calling MessageBox after nsidl::download. Looping around nsidl::download and MessageBox crashes. Looping around just nsidl::download does NOT crash. Loop around just MessageBox does NOT crash. This implies nsidl::download and MessageBox are somehow working together to crash?
The crash is not a regular ol' bad pointer crash. It's a "Data Execution Prevention" crash. I'm using Windows XP SP2 with "DEP". This implies that nsisdl::download or MessageBox did something naughty to the stack.
I found some old threads (from 2003 and 2004) on this forum about nsisdl::download crashing behind firewalls or on cancel, but those threads claimed those bugs got fixed. I'm using NSIS 2.14.
thanks,
chris
Function MessageBoxAndDownloadLoop_CRASHES
nsidl_download:
nsisdl::download \
"http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe" \
"$PLUGINSDIR\dotnetfx.exe"
MessageBox MB_OK "Try again!"
goto nsidl_download ; try again!
FunctionEnd
Function MessageBoxLoop_DOESNT_CRASH
nsidl_download:
MessageBox MB_OK "Try again!"
goto nsidl_download ; try again!
FunctionEnd
Function DownloadLoop_DOESNT_CRASH
nsidl_download:
nsisdl::download \
"http://download.microsoft.com/download/a/a/c/aac39226-8825-44ce-90e3-bf8203e74006/dotnetfx.exe" \
"$PLUGINSDIR\dotnetfx.exe"
goto nsidl_download ; try again!
FunctionEnd