Talk:ExecDos plug-in: Difference between revisions
No edit summary |
|||
Line 107: | Line 107: | ||
If we are talking about Detailed window, just use /DETAILED option. Otherwise you should supply window handle. | If we are talking about Detailed window, just use /DETAILED option. Otherwise you should supply window handle. | ||
BTW would be better to send requests to NSIS forum. I found these messages today (Febr. 23, 2009) only. | BTW would be better to send requests to NSIS forum. I found these messages today (Febr. 23, 2009) only. | ||
=Newbie trying to insall ExecDoss= | |||
*Hi, i been searching for details on this. I read somewhere that i just put the ExecDos.dll into the plugin of NSIS which i did, but to no avail. Compiling my nsi keep returning ''Invalid command ExecDos::exec''. Will appreciate some pointers. Rgds. - Red1 |
Revision as of 11:03, 3 January 2011
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 variables 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.
It's also interesting to note that nsExec::exec also appears to have this problem.
visualcsharpcoder "at" hotmail dawt com if you want to email me about this problem.
Stack issues: confirmed
Corruption is a strong word: it looks like ExecDos::exec /DETAILED just pushes an extra empty value on the stack:
Name "Test" OutFile "Test.exe" Section "Foo" Dumpstate::debug ; Stack: empty ExecDos::exec "c:\windows\system32\ping.exe 127.0.0.1" "" "" Dumpstate::debug ; Stack: "0" ExecDos::exec /DETAILED "c:\windows\system32\ping.exe 127.0.0.1" "" "" Dumpstate::debug ; Stack: "0", "", "0" ; Expected: "0", "0" SectionEnd
Workaround: When using /DETAILED, Pop to check the exit code, then Pop again to clear out the extra value. I have not checked the behavior of /DETAILED /ASYNC.
I do not see this same behavior using any of the nsExec functions.
66.150.169.146 21:30, 6 November 2008 (UTC)
Takhir: This is feature, not bug. Last parameter is optional, for 'to window' it defines target window handle and not required if window specified by /DETAILED option. Another words - use ExecDos::exec /DETAILED "c:\windows\system32\ping.exe 127.0.0.1" ""
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?
Takhir: WINBASE.H(758):#define INFINITE 0xFFFFFFFF // Infinite timeout
An example showing how to redirect the output to the main log window would be great!
Takhir: If we are talking about Detailed window, just use /DETAILED option. Otherwise you should supply window handle. BTW would be better to send requests to NSIS forum. I found these messages today (Febr. 23, 2009) only.
Newbie trying to insall ExecDoss
- Hi, i been searching for details on this. I read somewhere that i just put the ExecDos.dll into the plugin of NSIS which i did, but to no avail. Compiling my nsi keep returning Invalid command ExecDos::exec. Will appreciate some pointers. Rgds. - Red1