Talk:ExecDos plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
===Possible stack corruption=== | |||
I believe there is a problem with ExecDos corrupting the stack, or corrupting global variables: | |||
<pre> | |||
Function DatabaseScriptExecuted | |||
; Stack: <Script.sql> <MyDB> <localhost> <C:\CMDSQL.EXE> | |||
MessageBox MB_OK "$0 $1 $2 $3 $4 $5" | |||
; Displays: "1422944 0001_TableExists.sql True 0 1" | |||
Exch $3 ; Database script filename | |||
; Stack: <Old_$3> <MyDB> <localhost> <C:\CMDSQL.EXE> | |||
Exch | |||
; Stack: <MyDB> <Old_$3> <localhost> <C:\CMDSQL.EXE> | |||
Exch $2 ; Database name | |||
; Stack: <Old_$2> <Old_$3> <localhost> <C:\CMDSQL.EXE> | |||
Exch 2 | |||
; Stack: <localhost> <Old_$3> <Old_$2> <C:\CMDSQL.EXE> | |||
Exch $1 ; Database host | |||
; Stack: <Old_$1> <Old_$3> <Old_$2> <C:\CMDSQL.EXE> | |||
Exch 3 | |||
; Stack: <C:\CMDSQL.EXE> <Old_$3> <Old_$2> <Old_$1> | |||
Exch $0 ; SQLCMD.EXE path | |||
; Stack: <Old_$0> <Old_$3> <Old_$2> <Old_$1> | |||
Push $4 | |||
; Stack: <Old_$4> <Old_$0> <Old_$3> <Old_$2> <Old_$1> | |||
Push $5 | |||
; Stack: <Old_$5> <Old_$4> <Old_$0> <Old_$3> <Old_$2> <Old_$1> | |||
ExecDos::exec /DETAILED /TIMEOUT=20000 '"$0" -S $1 -d $2 -Q "select count(*) from dbo.DatabaseScript where ScriptFilename = $\'$3$\'" -o "$PLUGINSDIR\DatabaseScriptExecuted.out"' '' '' | |||
Pop $4 ; Pop the result off the stack first, before popping rest of saved global variabled | |||
Pop $5 | |||
Pop $4 | |||
Pop $0 | |||
Pop $3 | |||
Pop $2 | |||
Pop $1 | |||
MessageBox MB_OK "$0 $1 $2 $3 $4 $5" | |||
; Displays: "0 True 0 1422944 1" | |||
</pre> | |||
Note that if I move the block of script that pops my saved global variables and the message box to BEFORE the call to ExecDos::exec, the global variables are the same as when the function was entered. | |||
visualcsharpcoder "at" hotmail dawt com if you want to email me about this problem. | |||
===Timeouts=== | |||
TIMEOUT | TIMEOUT | ||
TOTAL execution time, milliseconds, for example /TIMEOUT=10000. Default is big enough. Short timeouts may cause app to | TOTAL execution time, milliseconds, for example /TIMEOUT=10000. Default is big enough. Short timeouts may cause app to |
Revision as of 04:30, 28 July 2008
Possible stack corruption
I believe there is a problem with ExecDos corrupting the stack, or corrupting global variables:
Function DatabaseScriptExecuted ; Stack: <Script.sql> <MyDB> <localhost> <C:\CMDSQL.EXE> MessageBox MB_OK "$0 $1 $2 $3 $4 $5" ; Displays: "1422944 0001_TableExists.sql True 0 1" Exch $3 ; Database script filename ; Stack: <Old_$3> <MyDB> <localhost> <C:\CMDSQL.EXE> Exch ; Stack: <MyDB> <Old_$3> <localhost> <C:\CMDSQL.EXE> Exch $2 ; Database name ; Stack: <Old_$2> <Old_$3> <localhost> <C:\CMDSQL.EXE> Exch 2 ; Stack: <localhost> <Old_$3> <Old_$2> <C:\CMDSQL.EXE> Exch $1 ; Database host ; Stack: <Old_$1> <Old_$3> <Old_$2> <C:\CMDSQL.EXE> Exch 3 ; Stack: <C:\CMDSQL.EXE> <Old_$3> <Old_$2> <Old_$1> Exch $0 ; SQLCMD.EXE path ; Stack: <Old_$0> <Old_$3> <Old_$2> <Old_$1> Push $4 ; Stack: <Old_$4> <Old_$0> <Old_$3> <Old_$2> <Old_$1> Push $5 ; Stack: <Old_$5> <Old_$4> <Old_$0> <Old_$3> <Old_$2> <Old_$1> ExecDos::exec /DETAILED /TIMEOUT=20000 '"$0" -S $1 -d $2 -Q "select count(*) from dbo.DatabaseScript where ScriptFilename = $\'$3$\'" -o "$PLUGINSDIR\DatabaseScriptExecuted.out"' '' '' Pop $4 ; Pop the result off the stack first, before popping rest of saved global variabled Pop $5 Pop $4 Pop $0 Pop $3 Pop $2 Pop $1 MessageBox MB_OK "$0 $1 $2 $3 $4 $5" ; Displays: "0 True 0 1422944 1"
Note that if I move the block of script that pops my saved global variables and the message box to BEFORE the call to ExecDos::exec, the global variables are the same as when the function was entered.
visualcsharpcoder "at" hotmail dawt com if you want to email me about this problem.
Timeouts
TIMEOUT TOTAL execution time, milliseconds, for example /TIMEOUT=10000. Default is big enough. Short timeouts may cause app to
be terminated.
And how this Default big is?
An example showing how to redirect the output to the main log window would be great!