Index: win_installer/src/lams-start.nsi =================================================================== diff -u -rae13f2caa2572e368b592d80912e09782ce5a56a -r4f08a4b09d39d6ac6a50507d97eacda49bb40f96 --- win_installer/src/lams-start.nsi (.../lams-start.nsi) (revision ae13f2caa2572e368b592d80912e09782ce5a56a) +++ win_installer/src/lams-start.nsi (.../lams-start.nsi) (revision 4f08a4b09d39d6ac6a50507d97eacda49bb40f96) @@ -35,9 +35,80 @@ SetSilent silent FunctionEnd +# http://nsis.sourceforge.net/StrStr +# +!define StrStr "!insertmacro StrStr" + +!macro StrStr ResultVar String SubString + Push `${String}` + Push `${SubString}` + Call StrStr + Pop `${ResultVar}` +!macroend + +Function StrStr +/*After this point: + ------------------------------------------ + $R0 = SubString (input) + $R1 = String (input) + $R2 = SubStringLen (temp) + $R3 = StrLen (temp) + $R4 = StartCharPos (temp) + $R5 = TempStr (temp)*/ + + ;Get input from user + Exch $R0 + Exch + Exch $R1 + Push $R2 + Push $R3 + Push $R4 + Push $R5 + + ;Get "String" and "SubString" length + StrLen $R2 $R0 + StrLen $R3 $R1 + ;Start "StartCharPos" counter + StrCpy $R4 0 + + ;Loop until "SubString" is found or "String" reaches its end + ${Do} + ;Remove everything before and after the searched part ("TempStr") + StrCpy $R5 $R1 $R2 $R4 + + ;Compare "TempStr" with "SubString" + ${IfThen} $R5 == $R0 ${|} ${ExitDo} ${|} + ;If not "SubString", this could be "String"'s end + ${IfThen} $R4 >= $R3 ${|} ${ExitDo} ${|} + ;If not, continue the loop + IntOp $R4 $R4 + 1 + ${Loop} + +/*After this point: + ------------------------------------------ + $R0 = ResultVar (output)*/ + + ;Remove part before "SubString" on "String" (if there has one) + StrCpy $R0 $R1 `` $R4 + + ;Return output to user + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + Section - nsExec::ExecToStack 'sc.exe start LAMSv2' + nsExec::ExecToStack 'sc start LAMSv2' Pop $0 Pop $1 - MessageBox MB_OK "Started LAMSv2 service...$\r$\n$1." -SectionEnd \ No newline at end of file + ${StrStr} $2 $1 "START_PENDING" + ${If} $2 == "" + MessageBox MB_OK|MB_ICONSTOP "Could not start LAMSv2 service: $\r$\n$1" + ${Else} + MessageBox MB_OK "Started LAMSv2 service. Please wait a minute or two while LAMS starts up." + ${EndIf} +SectionEnd + Index: win_installer/src/lams-stop.nsi =================================================================== diff -u -rae13f2caa2572e368b592d80912e09782ce5a56a -r4f08a4b09d39d6ac6a50507d97eacda49bb40f96 --- win_installer/src/lams-stop.nsi (.../lams-stop.nsi) (revision ae13f2caa2572e368b592d80912e09782ce5a56a) +++ win_installer/src/lams-stop.nsi (.../lams-stop.nsi) (revision 4f08a4b09d39d6ac6a50507d97eacda49bb40f96) @@ -36,8 +36,8 @@ FunctionEnd Section - nsExec::ExecToStack 'sc.exe stop LAMSv2' + nsExec::ExecToStack 'sc stop LAMSv2' Pop $0 Pop $1 - MessageBox MB_OK "Stopping LAMSv2 service...$\r$\n$1." + MessageBox MB_OK "Stopped LAMSv2 service." SectionEnd \ No newline at end of file