From bac5b7679de087f893d15737d0ad02bddc577515 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 17 Nov 2019 16:34:30 +0100 Subject: [PATCH] Use killproc.exe instead in nsi --- dist/windows/strawberry.nsi.in | 36 ++++++++-------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/dist/windows/strawberry.nsi.in b/dist/windows/strawberry.nsi.in index 54a7c8f83..359538e3e 100644 --- a/dist/windows/strawberry.nsi.in +++ b/dist/windows/strawberry.nsi.in @@ -68,13 +68,12 @@ SetCompressor /SOLID lzma !include "MUI2.nsh" !include "FileAssociation.nsh" !include "Capabilities.nsh" +!include LogicLib.nsh +!include x64.nsh !define MUI_ICON "strawberry.ico" !define MUI_COMPONENTSPAGE_SMALLDESC -!define MUI_FINISHPAGE_RUN -!define MUI_FINISHPAGE_RUN_TEXT "Run Strawberry" -!define MUI_FINISHPAGE_RUN_FUNCTION "RunStrawberry" ; Installer pages !insertmacro MUI_PAGE_WELCOME @@ -144,16 +143,14 @@ Function .onInit FunctionEnd -Function RunStrawberry - ShellExecAsUser::ShellExecAsUser "" "$INSTDIR/strawberry.exe" "" -FunctionEnd - Section "Delete old files" oldfiles SectionEnd Section "Strawberry" Strawberry SetOutPath "$INSTDIR" + nsExec::Exec '"$INSTDIR\killproc.exe" strawberry.exe' + File "strawberry.exe" File "strawberry-tagreader.exe" File "strawberry.ico" @@ -243,6 +240,8 @@ Section "Strawberry" Strawberry File "libxine-2.dll" !endif + File "killproc.exe" + ; Register Strawberry with Default Programs Var /GLOBAL AppIcon Var /GLOBAL AppExe @@ -406,28 +405,8 @@ Section "Uninstaller" SectionEnd Section "Uninstall" - ; Kill strawberry.exe if it's running - ; This calling convention is retarded... - StrCpy $0 "strawberry.exe" - KillProc::FindProcesses - StrCmp $1 "-1" wooops - StrCmp $0 "0" completed - - DetailPrint "Killing running strawberry.exe..." - - StrCpy $0 "strawberry.exe" - KillProc::KillProcesses - StrCmp $1 "-1" wooops - - Sleep 2000 - Goto completed - - wooops: - DetailPrint "-> Error: Something went wrong while killing running strawberry.exe" - Abort - - completed: + nsExec::Exec '"$INSTDIR\killproc.exe" strawberry.exe' ; Delete all the files @@ -602,6 +581,7 @@ Section "Uninstall" Delete "$INSTDIR\xine-plugins\xineplug_post_visualizations.dll" !endif + Delete "$INSTDIR\killproc.exe" Delete "$INSTDIR\Uninstall.exe" ; Remove the installation folders.