blob: 092345a5dc93f762d30df6de4674e888b86ff0fb [file] [log] [blame]
DRC180c0162010-10-27 07:20:27 +00001[Setup]
2#ifdef WIN64
3ArchitecturesInstallIn64BitMode=x64
4AppName=TigerVNC 64-bit
5AppVerName=TigerVNC 64-bit @VERSION@ (@BUILD@)
6#else
7AppName=TigerVNC
8AppVerName=TigerVNC v@VERSION@ (@BUILD@)
9#endif
10AppVersion=@VERSION@
11AppPublisher=TigerVNC project
12AppPublisherURL=http://tigervnc.org
13DefaultDirName={pf}\TigerVNC
14#ifdef WIN64
15DefaultGroupName=TigerVNC 64-bit
16#else
17DefaultGroupName=TigerVNC
18#endif
19LicenseFile=@CMAKE_SOURCE_DIR@\LICENCE.txt
20
Brian P. Hinz6a7f9082017-08-21 18:10:32 -040021[Dirs]
22; This directory is necessary to prevent the X509 file chooser from causing
23; an error dialog to appear when GetOpenFileName is called by SYSTEM account.
24Name: "{sys}\config\systemprofile\Desktop"
25
DRC180c0162010-10-27 07:20:27 +000026[Files]
27#ifdef BUILD_WINVNC
DRCc67db652011-11-08 08:51:04 +000028Source: "@CMAKE_CURRENT_BINARY_DIR@\win\winvnc\winvnc4.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace;
Brian Hinze8991312013-04-27 20:20:57 +000029Source: "@CMAKE_CURRENT_BINARY_DIR@\win\wm_hooks\wm_hooks.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace;
DRCc67db652011-11-08 08:51:04 +000030Source: "@CMAKE_CURRENT_BINARY_DIR@\win\vncconfig\vncconfig.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace;
DRC180c0162010-10-27 07:20:27 +000031#endif
DRCc67db652011-11-08 08:51:04 +000032Source: "@CMAKE_CURRENT_BINARY_DIR@\vncviewer\vncviewer.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace;
Peter Åstrand (astrand)6011f962017-11-29 09:11:29 +010033Source: "@CMAKE_SOURCE_DIR@\README.rst"; DestDir: "{app}"; Flags: ignoreversion
DRCe72b8052011-06-28 03:02:38 +000034Source: "@CMAKE_SOURCE_DIR@\LICENCE.TXT"; DestDir: "{app}"; Flags: ignoreversion
DRC180c0162010-10-27 07:20:27 +000035
36
37[Icons]
38Name: "{group}\TigerVNC Viewer"; FileName: "{app}\vncviewer.exe";
39Name: "{group}\Listening TigerVNC Viewer"; FileName: "{app}\vncviewer.exe"; Parameters: "-listen";
40
41#ifdef BUILD_WINVNC
42Name: "{group}\VNC Server (User-Mode)\Run VNC Server"; FileName: "{app}\winvnc4.exe"; Parameters: "-noconsole";
43Name: "{group}\VNC Server (User-Mode)\Configure VNC Server"; FileName: "{app}\vncconfig.exe"; Parameters: "-user";
44
45Name: "{group}\VNC Server (Service-Mode)\Configure VNC Service"; FileName: "{app}\vncconfig.exe"; Parameters: "-noconsole -service";
46Name: "{group}\VNC Server (Service-Mode)\Register VNC Service"; FileName: "{app}\winvnc4.exe"; Parameters: "-register";
47Name: "{group}\VNC Server (Service-Mode)\Unregister VNC Service"; FileName: "{app}\winvnc4.exe"; Parameters: "-unregister";
48Name: "{group}\VNC Server (Service-Mode)\Start VNC Service"; FileName: "{app}\winvnc4.exe"; Parameters: "-noconsole -start";
49Name: "{group}\VNC Server (Service-Mode)\Stop VNC Service"; FileName: "{app}\winvnc4.exe"; Parameters: "-noconsole -stop";
50#endif
DRCe72b8052011-06-28 03:02:38 +000051Name: "{group}\License"; FileName: "write.exe"; Parameters: "LICENCE.TXT"; WorkingDir: "{app}"; Flags: "useapppaths"
Peter Åstrand (astrand)6011f962017-11-29 09:11:29 +010052Name: "{group}\Read Me"; FileName: "write.exe"; Parameters: "README.rst"; WorkingDir: "{app}"; Flags: "useapppaths"
DRC180c0162010-10-27 07:20:27 +000053Name: "{group}\Uninstall TigerVNC"; FileName: "{uninstallexe}"; WorkingDir: "{app}";
54
55#ifdef BUILD_WINVNC
56[Tasks]
57Name: installservice; Description: "&Register new TigerVNC Server as a system service"; GroupDescription: "Server configuration:";
58Name: startservice; Description: "&Start or restart TigerVNC service"; GroupDescription: "Server configuration:";
59
60[Run]
61Filename: "{app}\winvnc4.exe"; Parameters: "-register"; Tasks: installservice
62Filename: "net"; Parameters: "start winvnc4"; Tasks: startservice
63#endif
Samuel Mannehed60c41932014-02-07 14:53:24 +000064
65#ifdef BUILD_WINVNC
66[Code]
67
68{--- IShellLink ---}
69
70const
71 CLSID_ShellLink = '{00021401-0000-0000-C000-000000000046}';
72 SLDF_RUNAS_USER = $2000;
73
74type
75 IShellLinkW = interface(IUnknown)
76 '{000214F9-0000-0000-C000-000000000046}'
77 procedure Dummy;
78 procedure Dummy2;
79 procedure Dummy3;
80 function GetDescription(pszName: String; cchMaxName: Integer): HResult;
81 function SetDescription(pszName: String): HResult;
82 function GetWorkingDirectory(pszDir: String; cchMaxPath: Integer): HResult;
83 function SetWorkingDirectory(pszDir: String): HResult;
84 function GetArguments(pszArgs: String; cchMaxPath: Integer): HResult;
85 function SetArguments(pszArgs: String): HResult;
86 function GetHotkey(var pwHotkey: Word): HResult;
87 function SetHotkey(wHotkey: Word): HResult;
88 function GetShowCmd(out piShowCmd: Integer): HResult;
89 function SetShowCmd(iShowCmd: Integer): HResult;
90 function GetIconLocation(pszIconPath: String; cchIconPath: Integer;
91 out piIcon: Integer): HResult;
92 function SetIconLocation(pszIconPath: String; iIcon: Integer): HResult;
93 function SetRelativePath(pszPathRel: String; dwReserved: DWORD): HResult;
94 function Resolve(Wnd: HWND; fFlags: DWORD): HResult;
95 function SetPath(pszFile: String): HResult;
96 end;
97
98 IShellLinkDataList = interface(IUnknown)
99 '{45E2B4AE-B1C3-11D0-B92F-00A0C90312E1}'
100 function AddDataBlock(pDataBlock : DWORD) : HResult;
101 function CopyDataBlock(dwSig : DWORD; var ppDataBlock : DWORD) : HResult;
102 function RemoveDataBlock(dwSig : DWORD) : HResult;
103 function GetFlags(var pdwFlags : DWORD) : HResult;
104 function SetFlags(dwFlags : DWORD) : HResult;
105 end;
106
107 IPersist = interface(IUnknown)
108 '{0000010C-0000-0000-C000-000000000046}'
109 function GetClassID(var classID: TGUID): HResult;
110 end;
111
112 IPersistFile = interface(IPersist)
113 '{0000010B-0000-0000-C000-000000000046}'
114 function IsDirty: HResult;
115 function Load(pszFileName: String; dwMode: Longint): HResult;
116 function Save(pszFileName: String; fRemember: BOOL): HResult;
117 function SaveCompleted(pszFileName: String): HResult;
118 function GetCurFile(out pszFileName: String): HResult;
119 end;
120
121var
122 OSVersion: TWindowsVersion;
123
124function InitializeSetup: Boolean;
125begin
126 GetWindowsVersionEx(OSVersion);
127 Result := True;
128end;
129
130procedure SetRunAsUserFlag(Path: String);
131var
132 Obj: IUnknown;
133 SL: IShellLinkW;
134 SDL: IShellLinkDataList;
135 PF: IPersistFile;
136 Flags: DWord;
137begin
138 Obj := CreateComObject(StringToGuid(CLSID_ShellLink));
139 SL := IShellLinkW(Obj);
140 PF := IPersistFile(Obj);
141 SDL := IShellLinkDataList(Obj);
142 Path := ExpandConstant(Path);
143 OleCheck(PF.Load(Path, 0));
144 OleCheck(SDL.GetFlags(Flags));
145 OleCheck(SDL.SetFlags(Flags or SLDF_RUNAS_USER));
146 OleCheck(PF.Save(Path, True));
147end;
148
149procedure CurStepChanged(CurStep: TSetupStep);
150var
151 Flags: DWord;
152begin
153 { Post-install actions on Windows Vista and higher:
154 o Modify Service-Mode start menu commands so they run as administrator.
155 o Set up the SoftwareSASGeneration system policy so as to allow services to simulate Ctrl+Alt+Del. }
156 if (CurStep = ssPostInstall) and (OSVersion.Major >= 6) then begin
157 SetRunAsUserFlag('{group}\VNC Server (Service-Mode)\Configure VNC Service.lnk');
158 SetRunAsUserFlag('{group}\VNC Server (Service-Mode)\Register VNC Service.lnk');
159 SetRunAsUserFlag('{group}\VNC Server (Service-Mode)\Unregister VNC Service.lnk');
160 SetRunAsUserFlag('{group}\VNC Server (Service-Mode)\Start VNC Service.lnk');
161 SetRunAsUserFlag('{group}\VNC Server (Service-Mode)\Stop VNC Service.lnk');
162 if not RegQueryDWordValue(
163 HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System',
164 'SoftwareSASGeneration', Flags
165 ) then Flags := 0;
166 RegWriteDWordValue(
167 HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System',
168 'SoftwareSASGeneration', Flags or 1
169 );
170 end;
171end;
172#endif