source: branches/4.5.1/tools/installer/nsis/includes/system.nsh

Last change on this file was 2, checked in by Dmitry A. Kuminov, 17 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 6.3 KB
Line 
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2;;
3;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4;; Contact: Qt Software Information (qt-info@nokia.com)
5;;
6;; This file is part of the tools applications of the Qt Toolkit.
7;;
8;; $QT_BEGIN_LICENSE:LGPL$
9;; Commercial Usage
10;; Licensees holding valid Qt Commercial licenses may use this file in
11;; accordance with the Qt Commercial License Agreement provided with the
12;; Software or, alternatively, in accordance with the terms contained in
13;; a written agreement between you and Nokia.
14;;
15;; GNU Lesser General Public License Usage
16;; Alternatively, this file may be used under the terms of the GNU Lesser
17;; General Public License version 2.1 as published by the Free Software
18;; Foundation and appearing in the file LICENSE.LGPL included in the
19;; packaging of this file. Please review the following information to
20;; ensure the GNU Lesser General Public License version 2.1 requirements
21;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22;;
23;; In addition, as a special exception, Nokia gives you certain
24;; additional rights. These rights are described in the Nokia Qt LGPL
25;; Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26;; package.
27;;
28;; GNU General Public License Usage
29;; Alternatively, this file may be used under the terms of the GNU
30;; General Public License version 3.0 as published by the Free Software
31;; Foundation and appearing in the file LICENSE.GPL included in the
32;; packaging of this file. Please review the following information to
33;; ensure the GNU General Public License version 3.0 requirements will be
34;; met: http://www.gnu.org/copyleft/gpl.html.
35;;
36;; If you are unsure which license is appropriate for your use, please
37;; contact the sales department at qt-sales@nokia.com.
38;; $QT_END_LICENSE$
39;;
40;; This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
41;; WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
42;;
43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
44!ifndef SYSTEM_INCLUDE
45!define SYSTEM_INCLUDE
46
47!define QTVSIP2003_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD68}"
48!define QTVSIP2005_GUID "{789202F4-94F5-4f0a-AA00-73295FEBFD69}"
49
50!define QMSNET2002_GUID "{C174ACCD-D856-4B60-9887-0FF9E841E0EC}"
51!define QMSNET2003_GUID "{C174ACCE-D857-4B61-9888-0FF9E841E0ED}"
52!define QMSNET2005_GUID "{14E98DB4-A232-49a4-8EC1-8CE4F6985C73}"
53
54!macro GetVSInstallationDir UN
55; Usage:
56;
57; push "7.0"
58; call GetVSInstallationDir
59; pop $0
60;
61; If the requested VS version can be found, its
62; installation directory is returned.
63Function ${UN}GetVSInstallationDir
64 Exch $0
65 Push $1
66 ReadRegStr $1 HKLM "Software\Microsoft\VisualStudio\$0" "InstallDir"
67 StrCpy $0 $1
68 StrCmp $0 "" 0 +2
69 SetErrors
70 Pop $1
71 Exch $0
72FunctionEnd
73!macroend
74
75!insertmacro GetVSInstallationDir ""
76!insertmacro GetVSInstallationDir "un."
77
78
79!macro IsDotNETInstalled UN
80; Usage:
81;
82; push "8.0"
83; call IsDotNETInstalled
84; pop $0
85;
86; $0 contains the path where the .NET framework is installed.
87; If not installation can be found $0 is empty.
88Function ${UN}IsDotNETInstalled
89 Exch $0
90 Push $1
91 Push $2
92 Push $3
93 Push $4
94 Push $5
95
96 StrCpy $5 $0
97
98 ReadRegStr $4 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework" "InstallRoot"
99 Push $4
100 Exch $EXEDIR
101 Exch $EXEDIR
102 Pop $4
103
104 IfFileExists $4 0 noDotNET
105 StrCpy $0 0
106
107 EnumStart:
108 EnumRegKey $2 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy" $0
109 IntOp $0 $0 + 1
110 StrCmp $2 "" noDotNET
111 StrCpy $1 0
112
113 EnumPolicy:
114 EnumRegValue $3 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework\Policy\$2" $1
115 IntOp $1 $1 + 1
116 StrCmp $3 "" EnumStart
117
118 StrCmp $5 "8.0" 0 +2
119 StrCmp $2 "v2.0" 0 EnumPolicy
120
121 IfFileExists "$4\$2.$3" foundDotNET EnumPolicy
122
123 noDotNET:
124 StrCpy $0 0
125 Goto done
126
127 foundDotNET:
128 StrCpy $0 "$4\$2.$3"
129
130 done:
131 Pop $5
132 Pop $4
133 Pop $3
134 Pop $2
135 Pop $1
136 Exch $0
137FunctionEnd
138!macroend
139
140!insertmacro IsDotNETInstalled ""
141!insertmacro IsDotNETInstalled "un."
142
143!macro IsQMsNetInstalled UN
144; Usage:
145;
146; push "8.0"
147; call IsQMsNetInstalled
148; pop $0
149Function ${UN}IsQMsNetInstalled
150 Exch $0
151 Push $1
152 Push $2
153 Push $3
154
155 StrCmp $0 "7.0" 0 +2
156 StrCpy $2 "${QMSNET2002_GUID}"
157 StrCmp $0 "7.1" 0 +2
158 StrCpy $2 "${QMSNET2003_GUID}"
159 StrCmp $0 "8.0" 0 +2
160 StrCpy $2 "${QMSNET2005_GUID}"
161
162 StrCpy $3 0
163
164 ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir"
165 StrCmp $1 "" +3
166 StrCpy $3 1
167 goto done
168
169 ReadRegStr $1 HKCU "SOFTWARE\Microsoft\VisualStudio\$0\NewProjectTemplates\TemplateDirs\$2\/2" "TemplatesDir"
170 StrCmp $1 "" +2
171 StrCpy $3 1
172
173done:
174 StrCpy $0 $3
175
176 Pop $3
177 Pop $2
178 Pop $1
179 Exch $0
180FunctionEnd
181!macroend
182
183!insertmacro IsQMsNetInstalled ""
184!insertmacro IsQMsNetInstalled "un."
185
186!macro IsQMsDevInstalled UN
187; Usage:
188;
189; call IsQMsDevInstalled
190; pop $0
191Function ${UN}IsQMsDevInstalled
192 Push $0
193 Push $1
194 Push $2
195
196 StrCpy $0 0
197
198 ReadRegStr $1 HKLM "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename"
199 StrCmp $1 "" +3
200 StrCpy $0 1
201 goto done
202
203 ReadRegStr $1 HKCU "SOFTWARE\Microsoft\DevStudio\6.0\AddIns\q4msdev.Q4MsDev.1" "Filename"
204 StrCmp $1 "" +2
205 StrCpy $0 1
206
207done:
208 Pop $2
209 Pop $1
210 Exch $0
211FunctionEnd
212!macroend
213
214!insertmacro IsQMsDevInstalled ""
215!insertmacro IsQMsDevInstalled "un."
216
217!macro IsIntegrationInstalled UN
218; Usage:
219;
220; push "8.0"
221; call IsIntegrationInstalled
222; pop $0
223Function ${UN}IsIntegrationInstalled
224 Exch $0
225 Push $1
226 Push $2
227
228 StrCmp $0 "7.1" 0 +2
229 StrCpy $2 "${QTVSIP2003_GUID}"
230 StrCmp $0 "8.0" 0 +2
231 StrCpy $2 "${QTVSIP2005_GUID}"
232
233 ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\$0\Packages\$2" "ProductName"
234
235 StrCpy $0 0
236 StrCmp $1 "" done
237 StrCpy $0 1
238
239done:
240 Pop $2
241 Pop $1
242 Exch $0
243FunctionEnd
244!macroend
245
246!insertmacro IsIntegrationInstalled ""
247!insertmacro IsIntegrationInstalled "un."
248
249!macro AdministratorRights UN
250Function ${UN}HasAdminRights
251 push $0
252 ClearErrors
253 UserInfo::GetAccountType
254 IfErrors Yes ;It's probably Win95
255 pop $0
256 StrCmp $0 "Admin" Yes
257 StrCmp $0 "Power" Yes
258
259 StrCpy $0 "false"
260 goto Done
261
262 Yes:
263 StrCpy $0 "true"
264
265 Done:
266 exch $0
267FunctionEnd
268!macroend
269!insertmacro AdministratorRights ""
270!insertmacro AdministratorRights "un."
271
272!endif ;SYSTEM_INCLUDE
Note: See TracBrowser for help on using the repository browser.