-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOSE.iss
96 lines (84 loc) · 3.29 KB
/
OSE.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
[Setup]
AppName=OSE v0.1.8
AppVerName=OSE v0.1.8
DefaultDirName={pf32}\OSE\
DefaultGroupName=Oblivion Save Editor
OutputDir=C:\Users\Grahame\Documents\VB6\OSE\Package\
AppID={{6EDB5158-B63E-466C-8976-47E75B99F350}
VersionInfoVersion=0.1.8
VersionInfoProductName=OSE
VersionInfoProductVersion=0.1.8
AppVersion=OSE v0.1.8
OutputBaseFilename=Install OSE 0.1.8
UsePreviousAppDir=true
UninstallDisplayIcon={app}\OSE.exe
UsePreviousGroup=false
SetupIconFile=C:\Users\Grahame\Documents\VB6\OSE\oblivion 48x48.ico
[Files]
Source: DLLs\comcat.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: DLLs\asycfilt.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile
Source: DLLs\olepro32.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: DLLs\oleaut32.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: DLLs\msvbvm60.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: ..\..\..\..\..\Windows\System32\MSCOMCTL.OCX; DestDir: {sys}; Flags: promptifolder regserver sharedfile
Source: OSE.exe; DestDir: {app}; Flags: promptifolder 32bit
Source: Factions.data; DestDir: {app}
Source: ..\..\..\..\..\Windows\System32\comdlg32.ocx; DestDir: {sys}; Flags: restartreplace uninsneveruninstall sharedfile regserver
Source: Spells.data; DestDir: {app}
Source: Items.data; DestDir: {app}
[Icons]
Name: {group}\OSE; Filename: {app}\OSE.exe; WorkingDir: {app}; IconFilename: {app}\OSE.exe; IconIndex: 0
[Dirs]
Name: {app}\Screenshot\
[Code]
/////////////////////////////////////////////////////////////////////
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
/////////////////////////////////////////////////////////////////////
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
// default return value
Result := 0;
// get the uninstall string of the old app
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;