Push instead of writing to $0

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2158 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
joostverburg 2003-02-14 20:20:35 +00:00
parent 835461d69a
commit a5257b1d26
3 changed files with 7 additions and 8 deletions

View file

@ -18,25 +18,24 @@
3. This notice may not be removed or altered from any source distribution.
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):
You can also pass /TIMEOUT=### to set the timeout in milliseconds
Result is returned in $0
Result is pushed to the stack
"cancel" if cancelled
"success" if success
otherwise, an error string describing the error
otherwise, an error string describing the error
NSISdl::download http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
or
NSISdl::download /TIMEOUT=30000 http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
then, check $0 for errors:
then, pop a value from the stack and for errors:
Pop $0
StrCmp $0 "success" yay
Abort "Error downloading file
yay:

View file

@ -393,13 +393,13 @@ __declspec(dllexport) void download (HWND parent,
}
if (g_cancelled) {
setuservariable(INST_0, "cancel");
pushstring("cancel");
DeleteFile(filename);
} else if (error == NULL) {
setuservariable(INST_0, "success");
pushstring("success");
} else {
DeleteFile(filename);
setuservariable(INST_0, error);
pushstring(error);
}
delete get;

Binary file not shown.