Always use our (ns)Exec

This commit is contained in:
Adam Demasi 2024-09-20 19:05:09 +09:30
parent 7a4e3100f2
commit 1c8cbeb5e9
No known key found for this signature in database
GPG key ID: 5D3B26B3D58C7D91
3 changed files with 6 additions and 14 deletions

View file

@ -54,8 +54,7 @@ void __declspec(dllexport) Exec(HWND hwndParent, int string_size, TCHAR *variabl
void __declspec(dllexport) ExecToLog(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) { void __declspec(dllexport) ExecToLog(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) {
g_hwndParent = hwndParent; g_hwndParent = hwndParent;
EXDLL_INIT(); EXDLL_INIT();
TRACE(L"exec with %i %ls", extra->exec_flags->status_update, (extra->exec_flags->status_update % 4) == 4 ? L"ignore" : L"lines"); ExecScript((extra->exec_flags->status_update % 4) ? MODE_LINES : MODE_IGNOREOUTPUT);
ExecScript((extra->exec_flags->status_update % 4) == 4 ? MODE_IGNOREOUTPUT : MODE_LINES);
} }
void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) { void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra) {

View file

@ -137,16 +137,11 @@ FunctionEnd
Var /GLOBAL Exec.Command Var /GLOBAL Exec.Command
Var /GLOBAL Exec.Name Var /GLOBAL Exec.Name
Var /GLOBAL Exec.InConsole
Function ExecWithErrorHandling Function ExecWithErrorHandling
Push $0 Push $0
${If} $Exec.InConsole == 1 LegacyUpdateNSIS::ExecToLog '$Exec.Command'
LegacyUpdateNSIS::ExecToLog '$Exec.Command' Pop $0
Pop $0
${Else}
ExecWait '$Exec.Command' $0
${EndIf}
${If} $0 == ${ERROR_SUCCESS_REBOOT_REQUIRED} ${If} $0 == ${ERROR_SUCCESS_REBOOT_REQUIRED}
SetRebootFlag true SetRebootFlag true
@ -186,7 +181,7 @@ FunctionEnd
!insertmacro ExecWithErrorHandling '${name}' '"$PLUGINSDIR\${filename}\spinstall.exe" /unattend /nodialog /warnrestart:600' !insertmacro ExecWithErrorHandling '${name}' '"$PLUGINSDIR\${filename}\spinstall.exe" /unattend /nodialog /warnrestart:600'
; If we successfully abort a shutdown, we'll get exit code 0, so we know a reboot is required. ; If we successfully abort a shutdown, we'll get exit code 0, so we know a reboot is required.
ExecWait "$WINDIR\system32\shutdown.exe /a" $0 ExecWait '"$WINDIR\system32\shutdown.exe" /a' $0
${If} $0 == 0 ${If} $0 == 0
SetRebootFlag true SetRebootFlag true
${EndIf} ${EndIf}
@ -202,7 +197,6 @@ FunctionEnd
!insertmacro DetailPrint "Extracting ${name} (${kbid})..." !insertmacro DetailPrint "Extracting ${name} (${kbid})..."
SetDetailsPrint none SetDetailsPrint none
CreateDirectory "$PLUGINSDIR\${kbid}" CreateDirectory "$PLUGINSDIR\${kbid}"
StrCpy $Exec.InConsole 1
!insertmacro ExecWithErrorHandling '${name} (${kbid})' '"$WINDIR\system32\expand.exe" -F:* "$0" "$PLUGINSDIR\${kbid}"' !insertmacro ExecWithErrorHandling '${name} (${kbid})' '"$WINDIR\system32\expand.exe" -F:* "$0" "$PLUGINSDIR\${kbid}"'
SetDetailsPrint lastused SetDetailsPrint lastused
@ -224,7 +218,6 @@ FunctionEnd
FindNext $0 $1 FindNext $0 $1
${Loop} ${Loop}
StrCpy $Exec.InConsole 0
${EnableX64FSRedirection} ${EnableX64FSRedirection}
!macroend !macroend

View file

@ -115,8 +115,8 @@ Function InstallIE6
${If} $0 == 1 ${If} $0 == 1
Call DownloadIE6 Call DownloadIE6
!insertmacro DetailPrint "Extracting Internet Explorer 6 SP1..." !insertmacro DetailPrint "Extracting Internet Explorer 6 SP1..."
ExecShellWait "" "$WINDIR\system32\expand.exe" '"$OUTDIR\ie6sp1.cab" -F:ie6setup.exe "$PLUGINSDIR"' SW_HIDE LegacyUpdateNSIS::Exec '"$WINDIR\system32\expand.exe" "$OUTDIR\ie6sp1.cab" -F:ie6setup.exe "$PLUGINSDIR"'
ExecShellWait "" "$WINDIR\system32\expand.exe" '"$OUTDIR\ie6sp1.cab" -F:iebatch.txt "$PLUGINSDIR"' SW_HIDE LegacyUpdateNSIS::Exec '"$WINDIR\system32\expand.exe" "$OUTDIR\ie6sp1.cab" -F:iebatch.txt "$PLUGINSDIR"'
!insertmacro DetailPrint "Installing Internet Explorer 6 SP1..." !insertmacro DetailPrint "Installing Internet Explorer 6 SP1..."
!insertmacro ExecWithErrorHandling 'Internet Explorer 6 SP1' '"$PLUGINSDIR\ie6setup.exe" /q' !insertmacro ExecWithErrorHandling 'Internet Explorer 6 SP1' '"$PLUGINSDIR\ie6setup.exe" /q'
${EndIf} ${EndIf}