diff --git a/Contrib/NSISdl/ReadMe.txt b/Contrib/NSISdl/ReadMe.txt index 35bcaac9..5f7fb364 100644 --- a/Contrib/NSISdl/ReadMe.txt +++ b/Contrib/NSISdl/ReadMe.txt @@ -25,6 +25,7 @@ This dll can be used from NSIS to download files via http. How to use (for another example, see waplugin.nsi in the nsis directory): Pass the url and filename on the stack + You can also pass /TIMEOUT=### to set the timeout in milliseconds Result is returned in $0 "cancel" if cancelled "success" if success @@ -37,6 +38,7 @@ Example: ; make the call to download Push "http://www.xcf.berkeley.edu/~yaroslav/photos/mike/mike1-full.jpg" Push "$INSTDIR\test.jpg" + ; Push /TIMEOUT=10000 ; 10 seconds timeout CallInstDLL $TEMP\nsdtmp09.dll download ; for a quiet install, use download_quiet ; delete DLL from temporary directory diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index 1f9bcb25..8b112576 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -355,6 +355,11 @@ __declspec(dllexport) void download (HWND parent, g_stacktop = stacktop; popstring (filename); + lstrcpyn(buf, filename, 10); + if (!lstrcmp(buf, "/TIMEOUT=")) { + g_timeout_ms=my_atoi(filename+9); + popstring (filename); + } popstring (url); HANDLE hFile = CreateFile(filename,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,0,NULL); diff --git a/Plugins/nsisdl.dll b/Plugins/nsisdl.dll index 48580831..99512be1 100644 Binary files a/Plugins/nsisdl.dll and b/Plugins/nsisdl.dll differ