forked from intoolswetrust/jsignpdf
-
Notifications
You must be signed in to change notification settings - Fork 2
/
JSignPdf.iss
69 lines (62 loc) · 2.27 KB
/
JSignPdf.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
[Files]
Source: {#DistDir}\*; DestDir: {app}; Flags: recursesubdirs
[Setup]
AppName={#MyAppName}
AppId={#MyAppId}
AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=licenses\MPL-1.1.txt
OutputBaseFilename={#MyAppName}_setup_{#MyAppVersion}_wjre
VersionInfoVersion={#MyAppVersionWin}
VersionInfoCompany=Josef Cacek
VersionInfoDescription=JSignPdf adds digital signatures to PDF documents
AppPublisher=Josef Cacek
AppSupportURL=http://jsignpdf.sourceforge.net/
AppVersion={#MyAppVersion}
OutputDir={#OutputDir}
[Icons]
Name: {group}\JSignPdf {#MyAppVersion}; Filename: {app}\JSignPdf.exe; Components: ; WorkingDir: {app}
Name: {group}\InstallCert Tool; Filename: {app}\InstallCert.exe; Components: ; WorkingDir: {app}
Name: {group}\JSignPdf Guide; Filename: {app}\docs\JSignPdf_signed.pdf; Components:
Name: {group}\Uninstall {#MyAppName}; Filename: {uninstallexe}; Components:
[UninstallDelete]
;Name: {%USERPROFILE}\.JSignPdf; Type: files; Components:
[Code]
//********** Check if application is already installed
function MyAppInstalled: Boolean;
begin
Result := RegKeyExists(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1');
end;
//********** If app already installed, uninstall it before setup.
function InitializeSetup(): Boolean;
var
uninstaller: String;
oldVersion: String;
ErrorCode: Integer;
begin
if not MyAppInstalled then begin
Result := True;
Exit;
end;
RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1',
'DisplayName', oldVersion);
if (MsgBox(oldVersion + ' is already installed, it has to be uninstalled before installation. Continue?',
mbConfirmation, MB_YESNO) = IDNO) then begin
Result := False;
Exit;
end;
RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppID}_is1',
'QuietUninstallString', uninstaller);
Exec('>', uninstaller, '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
if (ErrorCode <> 0) then begin
MsgBox('Failed to uninstall previous version. . Please run {#MyAppName} uninstaller manually from Start menu or Control Panel and then run installer again.',
mbError, MB_OK );
Result := False;
Exit;
end;
Result := True;
end;