-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ardufocus-ascom-setup.iss
179 lines (144 loc) · 7.46 KB
/
ardufocus-ascom-setup.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
;
; Script generated by the ASCOM Driver Installer Script Generator 6.4.0.0
; Generated by João Brázio on 17/03/2019 (UTC)
;
#define ApplicationName 'ASCOM Ardufocus Focuser Driver'
#define ApplicationVersion GetFileVersion('.\LocalServer\bin\x86\Release\ASCOM.Ardufocus.exe')
[Setup]
AppID={{ef54f4d1-4259-4943-8785-8259e844ba19}
AppName={#ApplicationName}
AppVerName={#ApplicationName} {#ApplicationVersion}
AppVersion={#ApplicationVersion}
VersionInfoVersion={#ApplicationVersion}
AppPublisher=João Brázio <joao@brazio.org>
AppPublisherURL=mailto:joao@brazio.org
AppSupportURL=https://github.com/jbrazio/ardufocus-ascom/issues
AppUpdatesURL=https://github.com/jbrazio/ardufocus-ascom/releases
MinVersion=0,6.1.7600
DisableDirPage=yes
DisableWelcomePage=false
DisableStartupPrompt=false
DisableProgramGroupPage=yes
OutputDir="."
Compression=lzma
SolidCompression=yes
OutputBaseFilename="ardufocus-ascom-{#SetupSetting("AppVersion")}-setup"
UninstallFilesDir="{cf}\ASCOM\Uninstall\Focuser\ASCOM.Ardufocus"
WizardImageFile=".\Common\Resources\setup.bmp"
DefaultDirName="{cf}\ASCOM\Focuser"
LicenseFile=".\LICENSE.txt"
DefaultGroupName=Ardufocus
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Dirs]
Name: "{app}\ASCOM.Ardufocus"
Name: "{cf}\ASCOM\Uninstall\Focuser\ASCOM.Ardufocus"
[Files]
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.exe"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.GUI.exe"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.Setup.exe"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.Common.dll"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.Focuser.dll"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LocalServer\bin\x86\Release\ASCOM.Ardufocus.GUI.exe.config"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\LICENSE.txt"; DestDir: "{app}\ASCOM.Ardufocus"
Source: ".\Common\Documentation\README.html"; DestDir: "{app}\ASCOM.Ardufocus"; Flags: isreadme
[Icons]
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
Name: "{group}\Ardufocus GUI"; Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.GUI.exe"; WorkingDir: "{app}\ASCOM.Ardufocus"
Name: "{group}\Ardufocus Setup"; Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.Setup.exe"; WorkingDir: "{app}\ASCOM.Ardufocus"
Name: "{group}\Ardufocus Server (Debug)"; Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.exe"; WorkingDir: "{app}\ASCOM.Ardufocus"
Name: "{commondesktop}\Ardufocus GUI"; Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.GUI.exe"; WorkingDir: "{app}\ASCOM.Ardufocus"
[Run]
Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.exe"; Parameters: "/regserver"
[UninstallRun]
Filename: "{app}\ASCOM.Ardufocus\ASCOM.Ardufocus.exe"; Parameters: "/unregserver"
; DCOM setup for COM local Server, needed for TheSky
[Registry]
#define AppClsid "{{61b31228-9461-42be-b84b-17755d376522}"
#define AppClsid2 "{{a2103f51-1b24-4f54-8c41-948361123ff4}"
; set the DCOM access control for TheSky on the Focuser interface
Root: HKCR; Subkey: CLSID\{#AppClsid}; ValueType: string; ValueName: AppID; ValueData: {#AppClsid}
Root: HKCR; Subkey: AppId\{#AppClsid}; ValueType: string; ValueData: "ASCOM ShortName Focuser Driver"
Root: HKCR; Subkey: AppId\{#AppClsid}; ValueType: string; ValueName: AppID; ValueData: {#AppClsid}
Root: HKCR; Subkey: AppId\{#AppClsid}; ValueType: dword; ValueName: AuthenticationLevel; ValueData: 1
; set the DCOM access control for TheSky on the Focuser interface
Root: HKCR; Subkey: CLSID\{#AppClsid2}; ValueType: string; ValueName: AppID; ValueData: {#AppClsid2}
Root: HKCR; Subkey: AppId\{#AppClsid2}; ValueType: string; ValueData: "ASCOM ShortName Focuser Driver"
Root: HKCR; Subkey: AppId\{#AppClsid2}; ValueType: string; ValueName: AppID; ValueData: {#AppClsid2}
Root: HKCR; Subkey: AppId\{#AppClsid2}; ValueType: dword; ValueName: AuthenticationLevel; ValueData: 1
; set the DCOM key for the executable as a whole
Root: HKCR; Subkey: AppId\ASCOM.Ardufocus.exe; ValueType: string; ValueName: AppID; ValueData: {#AppClsid}
; CAUTION! DO NOT EDIT - DELETING ENTIRE APPID TREE WILL BREAK WINDOWS!
Root: HKCR; Subkey: AppId\{#AppClsid}; Flags: uninsdeletekey
Root: HKCR; Subkey: AppId\{#AppClsid2}; Flags: uninsdeletekey
Root: HKCR; Subkey: AppId\ASCOM.Ardufocus.exe; Flags: uninsdeletekey
[Code]
const
REQUIRED_PLATFORM_VERSION = 6.4; // Set this to the minimum required ASCOM Platform version for this application
//
// Function to return the ASCOM Platform's version number as a double.
//
function PlatformVersion(): Double;
var
PlatVerString : String;
begin
Result := 0.0;
try
if RegQueryStringValue(HKEY_LOCAL_MACHINE_32, 'Software\ASCOM','PlatformVersion', PlatVerString) then
begin
// Successfully read the value from the registry
// Create a double from the X.Y Platform version string
Result := StrToFloat(PlatVerString);
end;
except
// Indicate in the return value that an exception was generated
ShowExceptionMessage;
Result:= -1.0;
end;
end;
//
// Before the installer UI appears, verify that the required ASCOM Platform version is installed.
//
function InitializeSetup(): Boolean;
var
PlatformVersionNumber : double;
begin
Result := FALSE;
// Get the installed Platform version as a double
PlatformVersionNumber := PlatformVersion();
// Check whether we have the minimum required Platform or newer
If PlatformVersionNumber >= REQUIRED_PLATFORM_VERSION then
Result := TRUE
else
if PlatformVersionNumber = 0.0 then
MsgBox('No ASCOM Platform is installed. Please install Platform ' +
Format('%3.1f', [REQUIRED_PLATFORM_VERSION]) + ' or later from http://www.ascom-standards.org', mbCriticalError, MB_OK)
else
MsgBox('ASCOM Platform ' + Format('%3.1f', [REQUIRED_PLATFORM_VERSION]) +
' or later is required, but Platform '+ Format('%3.1f', [PlatformVersionNumber]) +
' is installed. Please install the latest Platform before continuing; you will find it at http://www.ascom-standards.org', mbCriticalError, MB_OK);
end;
//
// Code to enable the installer to uninstall previous versions of itself when a new version is installed
//
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
UninstallExe: String;
UninstallRegistry: String;
begin
if (CurStep = ssInstall) then // Install step has started
begin
// Create the correct registry location name, which is based on the AppId
UninstallRegistry := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}' + '_is1');
// Check whether an extry exists
if RegQueryStringValue(HKLM, UninstallRegistry, 'UninstallString', UninstallExe) then
begin
// Entry exists and previous version is installed so run its uninstaller quietly after informing the user
MsgBox('Setup will now remove the previous version.', mbInformation, MB_OK);
Exec(RemoveQuotes(UninstallExe), ' /SILENT', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
//Give enough time for the install screen to be repainted before continuing
sleep(1000);
end
end;
end;