From cbace0dba3de7d43b81f3ebbfd164aed85b8cf21 Mon Sep 17 00:00:00 2001 From: Markson Date: Tue, 27 Jun 2023 20:20:43 +0800 Subject: [PATCH] inno-installer: fix stop service before installation --- install/windows-inno/windows_arm64.iss | 22 +++++----------------- install/windows-inno/windows_x86_64.iss | 22 +++++----------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/install/windows-inno/windows_arm64.iss b/install/windows-inno/windows_arm64.iss index 7cc57151..d1163c4f 100644 --- a/install/windows-inno/windows_arm64.iss +++ b/install/windows-inno/windows_arm64.iss @@ -70,22 +70,10 @@ Type: files; Name: "{app}\v2rayA-service.err.log" Type: files; Name: "{app}\v2rayA-service.err.log.old" [Code] -function InitializeSetup(): Boolean; -var - ResultCode: integer; +function InitializeSetup() : Boolean; +var + ResultCode: Integer; begin - if FileExists('{dir}\v2rayA-service.exe') then - begin - if Exec(ExpandConstant('{sys}\sc.exe'), 'stop v2rayA', '', SW_HIDE, - ewWaitUntilTerminated, resultcode) then - begin - if (resultcode <> 0) then - begin - MsgBox('Failed to stop current v2rayA service, installation cannot continue, please try again!', mbInformation, MB_OK); - Result := False; - Exit; - end; - end; - end; Result := True; -end; \ No newline at end of file + Exec('cmd.exe', '/C sc.exe stop v2rayA', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); +end \ No newline at end of file diff --git a/install/windows-inno/windows_x86_64.iss b/install/windows-inno/windows_x86_64.iss index 3349e782..bd2a31e0 100644 --- a/install/windows-inno/windows_x86_64.iss +++ b/install/windows-inno/windows_x86_64.iss @@ -70,22 +70,10 @@ Type: files; Name: "{app}\v2rayA-service.err.log" Type: files; Name: "{app}\v2rayA-service.err.log.old" [Code] -function InitializeSetup(): Boolean; -var - ResultCode: integer; +function InitializeSetup() : Boolean; +var + ResultCode: Integer; begin - if FileExists('{dir}\v2rayA-service.exe') then - begin - if Exec(ExpandConstant('{sys}\sc.exe'), 'stop v2rayA', '', SW_HIDE, - ewWaitUntilTerminated, resultcode) then - begin - if (resultcode <> 0) then - begin - MsgBox('Failed to stop current v2rayA service, installation cannot continue, please try again!', mbInformation, MB_OK); - Result := False; - Exit; - end; - end; - end; Result := True; -end; \ No newline at end of file + Exec('cmd.exe', '/C sc.exe stop v2rayA', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); +end \ No newline at end of file