-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTinyDRPC.iss
92 lines (79 loc) · 2.87 KB
/
TinyDRPC.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define public Dependency_Path_NetCoreCheck "dependencies\"
#include "CodeDependencies.iss"
#define MyAppName "TinyDRPC"
#define MyAppVersion "1.2"
#define MyAppPublisher "michioxd"
#define MyAppURL "https://github.com/michioxd/TinyDRPC"
#define MyAppExeName "TinyDRPC.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{67E6850A-B68C-491D-8895-DD4B5D03139F}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile="LICENSE.txt"
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=commandline
OutputDir="dist"
OutputBaseFilename=TinyDRPC-setup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
AppMutex=Global\{#MyAppName}
[UninstallDelete]
Type: files; Name: "{app}\TinyDRPC.ini"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "dist\bin\r2r\*"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
function InitializeSetup: Boolean;
begin
#ifdef Dependency_Path_NetCoreCheck
Dependency_AddDotNet80Desktop;
#endif
Result := True;
end;
function IsAppRunning(const FileName: string): Boolean;
var
FWMIService: Variant;
FSWbemLocator: Variant;
FWbemObjectSet: Variant;
begin
Result := false;
FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
Result := (FWbemObjectSet.Count > 0);
FWbemObjectSet := Unassigned;
FWMIService := Unassigned;
FSWbemLocator := Unassigned;
end;
function InitializeUninstall(): Boolean;
begin
if IsAppRunning('{#MyAppExeName}') then
begin
MsgBox('The TinyDRPC is currently running. Please close it before continuing.', mbError, MB_OK);
Result := False;
end
else
Result := True;
end;