root / tmp / org.txm.setups / nsis / Include / WinVer.nsh @ 3136
Historique | Voir | Annoter | Télécharger (18,09 ko)
1 |
; --------------------- |
---|---|
2 |
; WinVer.nsh |
3 |
; --------------------- |
4 |
; |
5 |
; LogicLib extensions for handling Windows versions and service packs. |
6 |
; |
7 |
; IsNT checks if the installer is running on Windows NT family (NT4, 2000, XP, etc.) |
8 |
; |
9 |
; ${If} ${IsNT} |
10 |
; DetailPrint "Running on NT. Installing Unicode enabled application." |
11 |
; ${Else} |
12 |
; DetailPrint "Not running on NT. Installing ANSI application." |
13 |
; ${EndIf} |
14 |
; |
15 |
; IsServerOS checks if the installer is running on a server version of Windows (2000, 2003, 2008, etc.) |
16 |
; IsDomainController checks if the server is a domain controller |
17 |
; |
18 |
; AtLeastWin<version> checks if the installer is running on Windows version at least as specified. |
19 |
; IsWin<version> checks if the installer is running on Windows version exactly as specified. |
20 |
; AtMostWin<version> checks if the installer is running on Windows version at most as specified. |
21 |
; AtLeastBuild <number> checks if the installer is running on a Windows version with a minimum build number. |
22 |
; AtMostBuild <number> checks if the installer is running on a Windows version with a maximum build number. |
23 |
; AtLeastWaaS <name> and AtMostWaaS <name> checks Windows 10 "friendly names" against the build number. |
24 |
; |
25 |
; <version> can be replaced with the following values: |
26 |
; |
27 |
; 95 |
28 |
; 98 |
29 |
; ME |
30 |
; |
31 |
; NT4 |
32 |
; 2000 |
33 |
; XP |
34 |
; 2003 |
35 |
; Vista |
36 |
; 2008 |
37 |
; 7 |
38 |
; 2008R2 |
39 |
; 8 |
40 |
; 2012 |
41 |
; 8.1 |
42 |
; 2012R2 |
43 |
; 10 |
44 |
; |
45 |
; Note: Windows 8.1 and later will be detected as Windows 8 unless ManifestSupportedOS is set correctly! |
46 |
; |
47 |
; AtLeastServicePack checks if the installer is running on Windows service pack version at least as specified. |
48 |
; IsServicePack checks if the installer is running on Windows service pack version exactly as specified. |
49 |
; AtMostServicePack checks if the installer is running on Windows service version pack at most as specified. |
50 |
; |
51 |
; Usage examples: |
52 |
; |
53 |
; ${If} ${IsNT} |
54 |
; DetailPrint "Running on NT family." |
55 |
; DetailPrint "Surely not running on 95, 98 or ME." |
56 |
; ${AndIf} ${AtLeastWinNT4} |
57 |
; DetailPrint "Running on NT4 or better. Could even be 2003." |
58 |
; ${EndIf} |
59 |
; |
60 |
; ${If} ${AtLeastWinXP} |
61 |
; DetailPrint "Running on XP or better." |
62 |
; ${EndIf} |
63 |
; |
64 |
; ${If} ${IsWin2000} |
65 |
; DetailPrint "Running on 2000." |
66 |
; ${EndIf} |
67 |
; |
68 |
; ${If} ${IsWin2000} |
69 |
; ${AndIf} ${AtLeastServicePack} 3 |
70 |
; ${OrIf} ${AtLeastWinXP} |
71 |
; DetailPrint "Running Win2000 SP3 or above" |
72 |
; ${EndIf} |
73 |
; |
74 |
; ${If} ${AtMostWinXP} |
75 |
; DetailPrint "Running on XP or older. Surely not running on Vista. Maybe 98, or even 95." |
76 |
; ${EndIf} |
77 |
; |
78 |
; Warning: |
79 |
; |
80 |
; Windows 95 and NT both use the same version number. To avoid getting NT4 misidentified |
81 |
; as Windows 95 and vice-versa or 98 as a version higher than NT4, always use IsNT to |
82 |
; check if running on the NT family. |
83 |
; |
84 |
; ${If} ${AtLeastWin95} |
85 |
; ${AndIf} ${AtMostWinME} |
86 |
; DetailPrint "Running 95, 98 or ME." |
87 |
; DetailPrint "Actually, maybe it's NT4?" |
88 |
; ${If} ${IsNT} |
89 |
; DetailPrint "Yes, it's NT4! oops..." |
90 |
; ${Else} |
91 |
; DetailPrint "Nope, not NT4. phew..." |
92 |
; ${EndIf} |
93 |
; ${EndIf} |
94 |
; |
95 |
; |
96 |
; Other useful extensions are: |
97 |
; |
98 |
; * IsWin2003R2 |
99 |
; * IsStarterEdition |
100 |
; * OSHasMediaCenter |
101 |
; * OSHasTabletSupport |
102 |
; |
103 |
|
104 |
!verbose push |
105 |
!verbose 3 |
106 |
|
107 |
!ifndef ___WINVER__NSH___ |
108 |
!define ___WINVER__NSH___ |
109 |
|
110 |
!include LogicLib.nsh |
111 |
!include Util.nsh |
112 |
|
113 |
# masks for our variables |
114 |
|
115 |
!define _WINVER_VERXBIT 0x00000001 ; Used to boost $__WINVERV |
116 |
!define _WINVER_MASKVMAJ 0x7F000000 ; $__WINVERV mask |
117 |
!define _WINVER_MASKVMIN 0x00FF0000 ; $__WINVERV mask |
118 |
!define _WINVER_NTMASK 0x7FFFFFFF ; $__WINVERV mask used by AtMost/AtLeast |
119 |
!define _WINVER_NTBIT 0x80000000 ; $__WINVERV bit used by Is and $__WINVERSP bit used by IsNT |
120 |
!define _WINVER_NTSRVBIT 0x40000000 ; $__WINVERSP bit for !VER_NT_WORKSTATION |
121 |
!define _WINVER_NTDCBIT 0x20000000 ; $__WINVERSP bit for VER_NT_DOMAIN_CONTROLLER |
122 |
!define _WINVER_MASKVBLD 0x0000FFFF ; $__WINVERSP mask for OS build number |
123 |
!define _WINVER_MASKSP 0x000F0000 ; $__WINVERSP mask for OS service pack |
124 |
|
125 |
# possible variable values for different versions |
126 |
|
127 |
!define WINVER_95_NT 0x04000000 ;4.00.0950 |
128 |
!define WINVER_95 0x04000000 ;4.00.0950 |
129 |
!define WINVER_98_NT 0x040a0000 ;4.10.1998 |
130 |
!define WINVER_98 0x040a0000 ;4.10.1998 |
131 |
;define WINVER_98SE 0x040a0000 ;4.10.2222 |
132 |
!define WINVER_ME_NT 0x045a0000 ;4.90.3000 |
133 |
!define WINVER_ME 0x045a0000 ;4.90.3000 |
134 |
;define WINVER_NT3.51 ;3.51.1057 |
135 |
!define WINVER_NT4_NT 0x84000000 ;4.00.1381 |
136 |
!define WINVER_NT4 0x04000000 ;4.00.1381 |
137 |
!define WINVER_2000_NT 0x85000000 ;5.00.2195 |
138 |
!define WINVER_2000 0x05000000 ;5.00.2195 |
139 |
!define WINVER_XP_NT 0x85010000 ;5.01.2600 |
140 |
!define WINVER_XP 0x05010000 ;5.01.2600 |
141 |
;define WINVER_XP64 ;5.02.3790 |
142 |
!define WINVER_2003_NT 0x85020000 ;5.02.3790 |
143 |
!define WINVER_2003 0x05020000 ;5.02.3790 |
144 |
!define WINVER_VISTA_NT 0x86000000 ;6.00.6000 |
145 |
!define WINVER_VISTA 0x06000000 ;6.00.6000 |
146 |
!define WINVER_2008_NT 0x86000001 ;6.00.6001 |
147 |
!define WINVER_2008 0x06000001 ;6.00.6001 |
148 |
!define WINVER_7_NT 0x86010000 ;6.01.7600 |
149 |
!define WINVER_7 0x06010000 ;6.01.7600 |
150 |
!define WINVER_2008R2_NT 0x86010001 ;6.01.7600 |
151 |
!define WINVER_2008R2 0x06010001 ;6.01.7600 |
152 |
!define WINVER_8_NT 0x86020000 ;6.02.9200 |
153 |
!define WINVER_8 0x06020000 ;6.02.9200 |
154 |
!define WINVER_2012_NT 0x86020001 ;6.02.9200 |
155 |
!define WINVER_2012 0x06020001 ;6.02.9200 |
156 |
!define WINVER_8.1_NT 0x86030000 ;6.03.9600 |
157 |
!define WINVER_8.1 0x06030000 ;6.03.9600 |
158 |
!define WINVER_2012R2_NT 0x86030001 ;6.03.9600 |
159 |
!define WINVER_2012R2 0x06030001 ;6.03.9600 |
160 |
!define WINVER_10_NT 0x8A000000 ;10.0.10240 |
161 |
!define WINVER_10 0x0A000000 ;10.0.10240 |
162 |
!define WINVER_2016_NT 0x8A000001 ;10.0.14393 |
163 |
!define WINVER_2016 0x0A000001 ;10.0.14393 |
164 |
|
165 |
|
166 |
# use this to make all nt > 9x |
167 |
|
168 |
!ifdef WINVER_NT4_OVER_W95 |
169 |
!define /redef /math WINVER_NT4 ${WINVER_NT4} | ${_WINVER_VERXBIT} |
170 |
!endif |
171 |
|
172 |
# some definitions from header files |
173 |
|
174 |
!define OSVERSIONINFOW_SIZE 276 |
175 |
!define OSVERSIONINFOEXW_SIZE 284 |
176 |
!define OSVERSIONINFOA_SIZE 148 |
177 |
!define OSVERSIONINFOEXA_SIZE 156 |
178 |
!define /ifndef VER_PLATFORM_WIN32_NT 2 |
179 |
!define /ifndef VER_NT_WORKSTATION 1 |
180 |
!define /ifndef VER_NT_DOMAIN_CONTROLLER 2 |
181 |
!define /ifndef VER_NT_SERVER 3 |
182 |
|
183 |
!define SM_TABLETPC 86 |
184 |
!define SM_MEDIACENTER 87 |
185 |
!define SM_STARTER 88 |
186 |
!define SM_SERVERR2 89 |
187 |
|
188 |
# variable declaration |
189 |
|
190 |
!macro __WinVer_DeclareVars |
191 |
|
192 |
!ifndef __WINVER_VARS_DECLARED |
193 |
|
194 |
!define __WINVER_VARS_DECLARED |
195 |
|
196 |
Var /GLOBAL __WINVERV |
197 |
Var /GLOBAL __WINVERSP |
198 |
|
199 |
!endif |
200 |
|
201 |
!macroend |
202 |
|
203 |
# lazy initialization macro |
204 |
|
205 |
!ifmacrondef __WinVer_Call_GetVersionEx |
206 |
|
207 |
!macro __WinVer_Call_GetVersionEx STRUCT_SIZE |
208 |
|
209 |
System::Call '*$0(i ${STRUCT_SIZE})' |
210 |
System::Call kernel32::GetVersionEx(pr0)i.r3 |
211 |
|
212 |
!macroend |
213 |
|
214 |
!endif |
215 |
|
216 |
!macro __WinVer_InitVars |
217 |
# variables |
218 |
!insertmacro __WinVer_DeclareVars |
219 |
|
220 |
# only calculate version once |
221 |
StrCmp $__WINVERV "" _winver_noveryet |
222 |
Return |
223 |
_winver_noveryet: |
224 |
|
225 |
# push used registers on the stack |
226 |
Push $0 |
227 |
Push $1 ;maj |
228 |
Push $2 ;min |
229 |
Push $3 ;bld |
230 |
Push $R0 ;temp |
231 |
|
232 |
# a plugin call will lock the Unicode mode, it is now safe to set the struct size |
233 |
!ifdef NSIS_UNICODE |
234 |
!define /redef OSVERSIONINFO_SIZE ${OSVERSIONINFOW_SIZE} |
235 |
!define /redef OSVERSIONINFOEX_SIZE ${OSVERSIONINFOEXW_SIZE} |
236 |
!else |
237 |
!define /redef OSVERSIONINFO_SIZE ${OSVERSIONINFOA_SIZE} |
238 |
!define /redef OSVERSIONINFOEX_SIZE ${OSVERSIONINFOEXA_SIZE} |
239 |
!endif |
240 |
|
241 |
# allocate memory |
242 |
System::Call '*(&i${OSVERSIONINFOEX_SIZE})p.r0' |
243 |
|
244 |
# use OSVERSIONINFOEX |
245 |
!insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOEX_SIZE} |
246 |
|
247 |
IntCmp $3 0 "" _winver_ex _winver_ex |
248 |
# OSVERSIONINFOEX not allowed (Win9x or NT4 w/SP < 6), use OSVERSIONINFO |
249 |
!insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFO_SIZE} |
250 |
_winver_ex: |
251 |
|
252 |
# get results from struct |
253 |
System::Call '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)' |
254 |
|
255 |
# free struct |
256 |
System::Free $0 |
257 |
|
258 |
# win9x has major and minor info in high word of dwBuildNumber - remove it |
259 |
IntOp $3 $3 & 0xFFFF |
260 |
|
261 |
# get dwOSVersionInfoSize |
262 |
Pop $R0 |
263 |
|
264 |
# get dwPlatformId |
265 |
Pop $0 |
266 |
|
267 |
# NT? |
268 |
IntCmp $0 ${VER_PLATFORM_WIN32_NT} "" _winver_notnt _winver_notnt |
269 |
IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTBIT} |
270 |
IntOp $__WINVERV $__WINVERV | ${_WINVER_NTBIT} |
271 |
_winver_notnt: |
272 |
!ifndef NSIS_UNICODE |
273 |
!if "${NSIS_PTR_SIZE}" <= 4 |
274 |
# get service pack information |
275 |
IntCmp $0 ${VER_PLATFORM_WIN32_NT} _winver_nt "" _winver_nt # win9x |
276 |
|
277 |
# get szCSDVersion |
278 |
Pop $0 |
279 |
|
280 |
# copy second char |
281 |
StrCpy $0 $0 1 1 |
282 |
|
283 |
# discard invalid wServicePackMajor and wProductType |
284 |
Pop $R0 |
285 |
Pop $R0 |
286 |
|
287 |
# switch |
288 |
StrCmp $0 'A' "" +3 |
289 |
StrCpy $0 1 |
290 |
Goto _winver_sp_done |
291 |
StrCmp $0 'B' "" +3 |
292 |
StrCpy $0 2 |
293 |
Goto _winver_sp_done |
294 |
StrCmp $0 'C' "" +3 |
295 |
StrCpy $0 3 |
296 |
Goto _winver_sp_done |
297 |
StrCpy $0 0 |
298 |
Goto _winver_sp_done |
299 |
|
300 |
_winver_nt: # nt |
301 |
!endif #~ 32-bit |
302 |
!endif #~ ANSI |
303 |
IntCmp $R0 ${OSVERSIONINFOEX_SIZE} "" _winver_sp_noex _winver_sp_noex |
304 |
|
305 |
# discard szCSDVersion |
306 |
Pop $0 |
307 |
|
308 |
# get wProductType |
309 |
Exch |
310 |
Pop $0 |
311 |
|
312 |
# is server? |
313 |
IntCmp $0 ${VER_NT_WORKSTATION} _winver_nt_notsrv |
314 |
IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTSRVBIT} |
315 |
IntCmp $0 ${VER_NT_DOMAIN_CONTROLLER} "" _winver_nt_notdc _winver_nt_notdc |
316 |
IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTDCBIT} |
317 |
_winver_nt_notdc: |
318 |
_winver_nt_notsrv: |
319 |
|
320 |
# get wServicePackMajor |
321 |
Pop $0 |
322 |
|
323 |
# done with sp |
324 |
Goto _winver_sp_done |
325 |
|
326 |
_winver_sp_noex: # OSVERSIONINFO, not OSVERSIONINFOEX |
327 |
|
328 |
#### TODO |
329 |
## For IsServerOS to support < NT4SP6, we need to check the registry |
330 |
## here to see if we are a server and/or DC |
331 |
|
332 |
# get szCSDVersion |
333 |
Pop $0 |
334 |
|
335 |
# discard invalid wServicePackMajor and wProductType |
336 |
Pop $R0 |
337 |
Pop $R0 |
338 |
|
339 |
# get service pack number from text |
340 |
StrCpy $R0 $0 13 |
341 |
StrCmp $R0 "Service Pack " "" +3 |
342 |
StrCpy $0 $0 "" 13 # cut "Service Pack " |
343 |
Goto +2 |
344 |
StrCpy $0 0 # no service pack |
345 |
|
346 |
!ifdef WINVER_NT4_OVER_W95 |
347 |
IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} ; change NT 4.0.reserved.0 to 4.0.reserved.1 |
348 |
!endif |
349 |
|
350 |
_winver_sp_done: |
351 |
|
352 |
# store service pack |
353 |
IntOp $0 $0 << 16 |
354 |
IntOp $__WINVERSP $__WINVERSP | $0 |
355 |
|
356 |
### now for the version |
357 |
|
358 |
# is server? |
359 |
IntOp $0 $__WINVERSP & ${_WINVER_NTSRVBIT} |
360 |
|
361 |
# windows xp x64? |
362 |
IntCmp $0 0 "" _winver_not_xp_x64 _winver_not_xp_x64 # not server |
363 |
IntCmp $1 5 "" _winver_not_xp_x64 _winver_not_xp_x64 # maj 5 |
364 |
IntCmp $2 2 "" _winver_not_xp_x64 _winver_not_xp_x64 # min 2 |
365 |
# change XP x64 from 5.2 to 5.1 so it's still XP |
366 |
StrCpy $2 1 |
367 |
_winver_not_xp_x64: |
368 |
|
369 |
# server 2008? |
370 |
IntCmp $0 0 _winver_not_ntserver # server |
371 |
IntCmp 6 $1 "" "" _winver_not_ntserver # maj 6 |
372 |
# extra bit so Server 2008 comes after Vista SP1 that has the same minor version, same for Win7 vs 2008R2 |
373 |
IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} |
374 |
_winver_not_ntserver: |
375 |
|
376 |
# pack version |
377 |
IntOp $1 $1 << 24 # VerMajor |
378 |
IntOp $__WINVERV $__WINVERV | $1 |
379 |
IntOp $0 $2 << 16 |
380 |
IntOp $__WINVERV $__WINVERV | $0 # VerMinor |
381 |
IntOp $__WINVERSP $__WINVERSP | $3 # VerBuild |
382 |
|
383 |
# restore registers |
384 |
Pop $R0 |
385 |
Pop $3 |
386 |
Pop $2 |
387 |
Pop $1 |
388 |
Pop $0 |
389 |
|
390 |
!macroend |
391 |
|
392 |
# version comparison LogicLib macros |
393 |
|
394 |
!macro _WinVerAtLeast _a _b _t _f |
395 |
!insertmacro _LOGICLIB_TEMP |
396 |
${CallArtificialFunction} __WinVer_InitVars |
397 |
IntOp $_LOGICLIB_TEMP $__WINVERV & ${_WINVER_NTMASK} |
398 |
!insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` |
399 |
!macroend |
400 |
!macro _WinVerIs _a _b _t _f |
401 |
${CallArtificialFunction} __WinVer_InitVars |
402 |
!insertmacro _= $__WINVERV `${_b}` `${_t}` `${_f}` |
403 |
!macroend |
404 |
!macro _WinVerAtMost _a _b _t _f |
405 |
!insertmacro _LOGICLIB_TEMP |
406 |
${CallArtificialFunction} __WinVer_InitVars |
407 |
IntOp $_LOGICLIB_TEMP $__WINVERV & ${_WINVER_NTMASK} |
408 |
!insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` |
409 |
!macroend |
410 |
|
411 |
!macro __WinVer_DefineOSTest Test OS Suffix |
412 |
!define ${Test}Win${OS} `"" WinVer${Test} ${WINVER_${OS}${Suffix}}` |
413 |
!macroend |
414 |
|
415 |
!macro __WinVer_DefineOSTests Test Suffix |
416 |
!insertmacro __WinVer_DefineOSTest ${Test} 95 '${Suffix}' |
417 |
!insertmacro __WinVer_DefineOSTest ${Test} 98 '${Suffix}' |
418 |
!insertmacro __WinVer_DefineOSTest ${Test} ME '${Suffix}' |
419 |
!insertmacro __WinVer_DefineOSTest ${Test} NT4 '${Suffix}' |
420 |
!insertmacro __WinVer_DefineOSTest ${Test} 2000 '${Suffix}' |
421 |
!insertmacro __WinVer_DefineOSTest ${Test} XP '${Suffix}' |
422 |
!insertmacro __WinVer_DefineOSTest ${Test} 2003 '${Suffix}' |
423 |
!insertmacro __WinVer_DefineOSTest ${Test} VISTA '${Suffix}' |
424 |
!insertmacro __WinVer_DefineOSTest ${Test} 2008 '${Suffix}' |
425 |
!insertmacro __WinVer_DefineOSTest ${Test} 7 '${Suffix}' |
426 |
!insertmacro __WinVer_DefineOSTest ${Test} 2008R2 '${Suffix}' |
427 |
!insertmacro __WinVer_DefineOSTest ${Test} 8 '${Suffix}' |
428 |
!insertmacro __WinVer_DefineOSTest ${Test} 2012 '${Suffix}' |
429 |
!insertmacro __WinVer_DefineOSTest ${Test} 8.1 '${Suffix}' |
430 |
!insertmacro __WinVer_DefineOSTest ${Test} 2012R2 '${Suffix}' |
431 |
!insertmacro __WinVer_DefineOSTest ${Test} 10 '${Suffix}' |
432 |
!insertmacro __WinVer_DefineOSTest ${Test} 2016 '${Suffix}' |
433 |
!macroend |
434 |
|
435 |
!insertmacro __WinVer_DefineOSTests AtLeast "" |
436 |
!insertmacro __WinVer_DefineOSTests Is _NT |
437 |
!insertmacro __WinVer_DefineOSTests AtMost "" |
438 |
|
439 |
# version feature LogicLib macros |
440 |
|
441 |
!macro __WinVer_LL_IsBitSet _v _b _t _f |
442 |
!insertmacro _LOGICLIB_TEMP |
443 |
${CallArtificialFunction} __WinVer_InitVars |
444 |
IntOp $_LOGICLIB_TEMP ${_v} & ${_b} |
445 |
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` |
446 |
!macroend |
447 |
|
448 |
!define IsNT `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTBIT}` |
449 |
!define IsServerOS `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTSRVBIT}` |
450 |
!define IsDomainController `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTDCBIT}` |
451 |
|
452 |
# service pack macros |
453 |
|
454 |
!macro _WinVer_GetServicePackLevel OUTVAR |
455 |
${CallArtificialFunction} __WinVer_InitVars |
456 |
IntOp ${OUTVAR} $__WINVERSP & ${_WINVER_MASKSP} |
457 |
IntOp ${OUTVAR} ${OUTVAR} >> 16 |
458 |
!macroend |
459 |
!define WinVerGetServicePackLevel '!insertmacro _WinVer_GetServicePackLevel ' |
460 |
|
461 |
!macro _AtLeastServicePack _a _b _t _f |
462 |
!insertmacro _LOGICLIB_TEMP |
463 |
${WinVerGetServicePackLevel} $_LOGICLIB_TEMP |
464 |
!insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` |
465 |
!macroend |
466 |
!define AtLeastServicePack `"" AtLeastServicePack` |
467 |
|
468 |
!macro _AtMostServicePack _a _b _t _f |
469 |
!insertmacro _LOGICLIB_TEMP |
470 |
${WinVerGetServicePackLevel} $_LOGICLIB_TEMP |
471 |
!insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` |
472 |
!macroend |
473 |
!define AtMostServicePack `"" AtMostServicePack` |
474 |
|
475 |
!macro _IsServicePack _a _b _t _f |
476 |
!insertmacro _LOGICLIB_TEMP |
477 |
${WinVerGetServicePackLevel} $_LOGICLIB_TEMP |
478 |
!insertmacro _= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` |
479 |
!macroend |
480 |
!define IsServicePack `"" IsServicePack` |
481 |
|
482 |
# special feature LogicLib macros |
483 |
|
484 |
!macro _WinVer_SysMetricCheck m _b _t _f |
485 |
!insertmacro _LOGICLIB_TEMP |
486 |
System::Call user32::GetSystemMetrics(i${m})i.s |
487 |
pop $_LOGICLIB_TEMP |
488 |
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` |
489 |
!macroend |
490 |
|
491 |
!define IsWin2003R2 `${SM_SERVERR2} WinVer_SysMetricCheck ""` |
492 |
!define IsStarterEdition `${SM_STARTER} WinVer_SysMetricCheck ""` |
493 |
!define OSHasMediaCenter `${SM_MEDIACENTER} WinVer_SysMetricCheck ""` |
494 |
!define OSHasTabletSupport `${SM_TABLETPC} WinVer_SysMetricCheck ""` |
495 |
|
496 |
# version retrieval macros |
497 |
|
498 |
!macro __WinVer_GetVer var rshift mask outvar |
499 |
${CallArtificialFunction} __WinVer_InitVars |
500 |
!if "${mask}" != "" |
501 |
IntOp ${outvar} ${var} & ${mask} |
502 |
!if "${rshift}" != "" |
503 |
IntOp ${outvar} ${outvar} >> ${rshift} |
504 |
!endif |
505 |
!else |
506 |
IntOp ${outvar} ${var} >> ${rshift} |
507 |
!endif |
508 |
!macroend |
509 |
|
510 |
!define WinVerGetMajor '!insertmacro __WinVer_GetVer $__WINVERV 24 ${_WINVER_MASKVMAJ}' |
511 |
!define WinVerGetMinor '!insertmacro __WinVer_GetVer $__WINVERV 16 ${_WINVER_MASKVMIN}' |
512 |
!define WinVerGetBuild '!insertmacro __WinVer_GetVer $__WINVERSP "" ${_WINVER_MASKVBLD}' |
513 |
|
514 |
!macro _WinVer_BuildNumCheck op num _t _f |
515 |
!insertmacro _LOGICLIB_TEMP |
516 |
${WinVerGetBuild} $_LOGICLIB_TEMP |
517 |
!insertmacro _${op} $_LOGICLIB_TEMP ${num} `${_t}` `${_f}` |
518 |
!macroend |
519 |
!define AtLeastBuild `U>= WinVer_BuildNumCheck ` |
520 |
!define AtMostBuild `U<= WinVer_BuildNumCheck ` |
521 |
|
522 |
# Windows as a Service macros |
523 |
|
524 |
!macro WinVer_WaaS id build fu codename marketingname |
525 |
!if "${id}" == ${fu} |
526 |
!define WinVer_WaaS_Build ${build} |
527 |
!else if "${id}" == "${codename}" |
528 |
!define WinVer_WaaS_Build ${build} |
529 |
!else if "${id}" == "${marketingname}" |
530 |
!define WinVer_WaaS_Build ${build} |
531 |
!endif |
532 |
!macroend |
533 |
|
534 |
!macro _WinVer_WaaS op id _t _f |
535 |
!insertmacro WinVer_WaaS "${id}" 10240 1507 "Threshold" "RTM" ; 10240.16384 |
536 |
!insertmacro WinVer_WaaS "${id}" 10586 1511 "Threshold 2" "November Update" ; 10586.0? |
537 |
!insertmacro WinVer_WaaS "${id}" 14393 1607 "Redstone" "Anniversary Update" ; 14393.10 |
538 |
!insertmacro WinVer_WaaS "${id}" 15063 1703 "Redstone 2" "Creators Update" ; 15063.13 |
539 |
!insertmacro WinVer_WaaS "${id}" 16299 1709 "Redstone 3" "Fall Creators Update" ; 16299.19 |
540 |
!insertmacro WinVer_WaaS "${id}" 17134 1803 "Redstone 4" "April 2018 Update" ; 17134.1 |
541 |
!insertmacro WinVer_WaaS "${id}" 17763 1809 "Redstone 5" "October 2018 Update" ; 17763.1 |
542 |
!insertmacro WinVer_WaaS "${id}" 18362 1903 "19H1" "May 2019 Update" ; 18362.116 |
543 |
!insertmacro WinVer_WaaS "${id}" 18363 1909 "19H2" "November 2019 Update" ; 18363.418 |
544 |
!insertmacro WinVer_WaaS "${id}" 19041 2004 "20H1" "May 2020 Update" ; 19041.264? |
545 |
!ifmacrodef WinVerExternal_WaaS_MapToBuild |
546 |
!insertmacro WinVerExternal_WaaS_MapToBuild ${op} "${id}" WinVer_WaaS_Build |
547 |
!endif |
548 |
!define /IfNDef WinVer_WaaS_Build 0 |
549 |
!if "${WinVer_WaaS_Build}" <= 9600 |
550 |
!error 'WinVer: Unknown WaaS name: ${id}' |
551 |
!endif |
552 |
!insertmacro _WinVer_BuildNumCheck ${op} ${WinVer_WaaS_Build} `${_t}` `${_f}` |
553 |
!undef WinVer_WaaS_Build |
554 |
!macroend |
555 |
|
556 |
!define AtLeastWaaS `U>= WinVer_WaaS ` |
557 |
!define AtMostWaaS `U<= WinVer_WaaS ` |
558 |
|
559 |
!endif # !___WINVER__NSH___ |
560 |
|
561 |
!verbose pop |