~ubuntu-branches/ubuntu/precise/enigmail/precise-security

« back to all changes in this revision

Viewing changes to toolkit/mozapps/installer/windows/nsis/overrides.nsh

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-11-12 16:36:01 UTC
  • mfrom: (0.12.15)
  • Revision ID: package-import@ubuntu.com-20121112163601-t8e8skdfi3ni9iqp
Tags: 2:1.4.6-0ubuntu0.12.04.1
* New upstream release v1.4.6
  - see LP: #1080212 for USN information
* Drop unneeded patches
  - remove debian/patches/correct-version-number.diff
  - remove debian/patches/dont_register_cids_multiple_times.diff
  - update debian/patches/series
* Support building in an objdir
  - update debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This Source Code Form is subject to the terms of the Mozilla Public
 
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
 
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
4
 
1
5
################################################################################
2
6
# Modified versions of macros provided by NSIS
3
7
 
14
18
!include FileFunc.nsh
15
19
!endif
16
20
 
17
 
!ifndef CallArtificialFunction
18
 
; The CallArtificialFunction and CallArtificialFunction2 macros are from
19
 
; Util.nsh in NSIS v2.46-Unicode and have not been modified. They are needed
20
 
; by TextCompareNoDetail when compiling an installer / uninstaller with NSIS
21
 
; v2.33-Unicode.
22
 
; See <NSIS v2.46-Unicode App Dir >/include/Util.nsh for more information.
23
 
 
24
 
# see WinVer.nsh and *Func.nsh for usage examples
25
 
!macro CallArtificialFunction NAME
26
 
  !ifndef __UNINSTALL__
27
 
    !define CallArtificialFunction_TYPE inst
28
 
  !else
29
 
    !define CallArtificialFunction_TYPE uninst
30
 
  !endif
31
 
  Call :.${NAME}${CallArtificialFunction_TYPE}
32
 
  !ifndef ${NAME}${CallArtificialFunction_TYPE}_DEFINED
33
 
    Goto ${NAME}${CallArtificialFunction_TYPE}_DONE
34
 
    !define ${NAME}${CallArtificialFunction_TYPE}_DEFINED
35
 
    .${NAME}${CallArtificialFunction_TYPE}:
36
 
      !insertmacro ${NAME}
37
 
    Return
38
 
    ${NAME}${CallArtificialFunction_TYPE}_DONE:
39
 
  !endif
40
 
  !undef CallArtificialFunction_TYPE
41
 
!macroend
42
 
!define CallArtificialFunction `!insertmacro CallArtificialFunction`
43
 
 
44
 
# for usage of artificial functions inside artificial functions
45
 
# macro recursion is prohibited
46
 
!macro CallArtificialFunction2 NAME
47
 
  !ifndef __UNINSTALL__
48
 
    !define CallArtificialFunction2_TYPE inst
49
 
  !else
50
 
    !define CallArtificialFunction2_TYPE uninst
51
 
  !endif
52
 
  Call :.${NAME}${CallArtificialFunction2_TYPE}
53
 
  !ifndef ${NAME}${CallArtificialFunction2_TYPE}_DEFINED
54
 
    Goto ${NAME}${CallArtificialFunction2_TYPE}_DONE
55
 
    !define ${NAME}${CallArtificialFunction2_TYPE}_DEFINED
56
 
    .${NAME}${CallArtificialFunction2_TYPE}:
57
 
      !insertmacro ${NAME}
58
 
    Return
59
 
    ${NAME}${CallArtificialFunction2_TYPE}_DONE:
60
 
  !endif
61
 
  !undef CallArtificialFunction2_TYPE
62
 
!macroend
63
 
!define CallArtificialFunction2 `!insertmacro CallArtificialFunction2`
64
 
 
65
 
!endif
66
 
 
67
 
!ifndef _WINVER_VERXBIT
68
 
; The following defines and macros are for service pack detection support and
69
 
; are from WinVer.nsh in NSIS 2.46. They can be removed after building with
70
 
; NSIS 2.33 is deprecated.
71
 
 
72
 
!define _WINVER_VERXBIT  0x00000001
73
 
 
74
 
!define _WINVER_NTBIT    0x80000000
75
 
!define _WINVER_NTSRVBIT 0x40000000
76
 
!define _WINVER_MASKSP   0x000F0000
77
 
 
78
 
!define OSVERSIONINFOW_SIZE   276
79
 
!define OSVERSIONINFOEXW_SIZE 284
80
 
!define VER_PLATFORM_WIN32_NT 2
81
 
!define VER_NT_WORKSTATION    1
82
 
 
83
 
!macro __WinVer_DeclareVars
84
 
 
85
 
  !ifndef __WINVER_VARS_DECLARED
86
 
 
87
 
    !define __WINVER_VARS_DECLARED
88
 
 
89
 
    Var /GLOBAL __WINVERV
90
 
    Var /GLOBAL __WINVERSP
91
 
 
92
 
  !endif
93
 
 
94
 
!macroend
95
 
 
96
 
# lazy initialization macro
97
 
 
98
 
!ifmacrondef __WinVer_Call_GetVersionEx
99
 
 
100
 
  !macro __WinVer_Call_GetVersionEx STRUCT_SIZE
101
 
 
102
 
    System::Call '*$0(i ${STRUCT_SIZE})'
103
 
    System::Call kernel32::GetVersionEx(ir0)i.r3
104
 
 
105
 
  !macroend
106
 
 
107
 
!endif
108
 
 
109
 
!macro __WinVer_InitVars
110
 
  # variables
111
 
  !insertmacro __WinVer_DeclareVars
112
 
 
113
 
  # only calculate version once
114
 
  StrCmp $__WINVERV "" _winver_noveryet
115
 
    Return
116
 
  _winver_noveryet:
117
 
 
118
 
  # push used registers on the stack
119
 
  Push $0
120
 
  Push $1 ;maj
121
 
  Push $2 ;min
122
 
  Push $3 ;bld
123
 
  Push $R0 ;temp
124
 
 
125
 
  # allocate memory
126
 
  System::Alloc ${OSVERSIONINFOEXW_SIZE}
127
 
  Pop $0
128
 
 
129
 
  # use OSVERSIONINFOEX
130
 
  !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOEXW_SIZE}
131
 
 
132
 
  IntCmp $3 0 "" _winver_ex _winver_ex
133
 
    # OSVERSIONINFOEX not allowed (Win9x or NT4 w/SP < 6), use OSVERSIONINFO
134
 
    !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOW_SIZE}
135
 
  _winver_ex:
136
 
 
137
 
  # The original struct formatting string here was:
138
 
  # '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)'
139
 
  # but in NSIS v2.33u strings take the size in bytes instead of size in chars
140
 
  # so the 128 char '&t128.s' is changed here to '&t256.s'. 
141
 
  System::Call '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t256.s,&i2.s,&i2,&i2,&i1.s,&i1)'
142
 
 
143
 
  # free struct
144
 
  System::Free $0
145
 
 
146
 
  # win9x has major and minor info in high word of dwBuildNumber - remove it
147
 
  IntOp $3 $3 & 0xFFFF
148
 
 
149
 
  # get dwOSVersionInfoSize
150
 
  Pop $R0
151
 
 
152
 
  # get dwPlatformId
153
 
  Pop $0
154
 
 
155
 
  # NT?
156
 
  IntCmp $0 ${VER_PLATFORM_WIN32_NT} "" _winver_notnt _winver_notnt
157
 
    IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTBIT}
158
 
    IntOp $__WINVERV  $__WINVERV  | ${_WINVER_NTBIT}
159
 
  _winver_notnt:
160
 
 
161
 
  # get service pack information
162
 
  IntCmp $0 ${VER_PLATFORM_WIN32_NT} _winver_nt "" _winver_nt  # win9x
163
 
 
164
 
    # get szCSDVersion
165
 
    Pop $0
166
 
 
167
 
    # copy second char
168
 
    StrCpy $0 $0 1 1
169
 
 
170
 
    # discard invalid wServicePackMajor and wProductType
171
 
    Pop $R0
172
 
    Pop $R0
173
 
 
174
 
    # switch
175
 
    StrCmp $0 'A' "" +3
176
 
      StrCpy $0 1
177
 
      Goto _winver_sp_done
178
 
    StrCmp $0 'B' "" +3
179
 
      StrCpy $0 2
180
 
      Goto _winver_sp_done
181
 
    StrCmp $0 'C' "" +3
182
 
      StrCpy $0 3
183
 
      Goto _winver_sp_done
184
 
    StrCpy $0 0
185
 
    Goto _winver_sp_done
186
 
 
187
 
  _winver_nt: # nt
188
 
 
189
 
    IntCmp $R0 ${OSVERSIONINFOEXW_SIZE} "" _winver_sp_noex _winver_sp_noex
190
 
 
191
 
      # discard szCSDVersion
192
 
      Pop $0
193
 
 
194
 
      # get wProductType
195
 
      Exch
196
 
      Pop $0
197
 
 
198
 
      # is server?
199
 
      IntCmp $0 ${VER_NT_WORKSTATION} _winver_noserver _winver_noserver ""
200
 
        IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTSRVBIT}
201
 
      _winver_noserver:
202
 
 
203
 
      # get wServicePackMajor
204
 
      Pop $0
205
 
 
206
 
      # done with sp
207
 
      Goto _winver_sp_done
208
 
 
209
 
    _winver_sp_noex: # OSVERSIONINFO, not OSVERSIONINFOEX
210
 
 
211
 
      ####  TODO
212
 
      ## For IsServer to support < NT4SP6, we need to check the registry
213
 
      ## here to see if we are a server and/or DC
214
 
 
215
 
      # get szCSDVersion
216
 
      Pop $0
217
 
 
218
 
      # discard invalid wServicePackMajor and wProductType
219
 
      Pop $R0
220
 
      Pop $R0
221
 
 
222
 
      # get service pack number from text
223
 
      StrCpy $R0 $0 13
224
 
      StrCmp $R0 "Service Pack " "" +3
225
 
        StrCpy $0 $0 "" 13 # cut "Service Pack "
226
 
        Goto +2
227
 
        StrCpy $0 0 # no service pack
228
 
 
229
 
!ifdef WINVER_NT4_OVER_W95
230
 
      IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT}
231
 
!endif
232
 
 
233
 
  _winver_sp_done:
234
 
 
235
 
  # store service pack
236
 
  IntOp $0 $0 << 16
237
 
  IntOp $__WINVERSP $__WINVERSP | $0
238
 
 
239
 
  ### now for the version
240
 
 
241
 
  # is server?
242
 
  IntOp $0 $__WINVERSP & ${_WINVER_NTSRVBIT}
243
 
 
244
 
  # windows xp x64?
245
 
  IntCmp $0 0 "" _winver_not_xp_x64 _winver_not_xp_x64 # not server
246
 
  IntCmp $1 5 "" _winver_not_xp_x64 _winver_not_xp_x64 # maj 5
247
 
  IntCmp $2 2 "" _winver_not_xp_x64 _winver_not_xp_x64 # min 2
248
 
    # change XP x64 from 5.2 to 5.1 so it's still XP
249
 
    StrCpy $2 1
250
 
  _winver_not_xp_x64:
251
 
 
252
 
  # server 2008?
253
 
  IntCmp $0 0 _winver_not_ntserver # server
254
 
  IntCmp 6 $1 "" "" _winver_not_ntserver # maj 6
255
 
    # extra bit so Server 2008 comes after Vista SP1 that has the same minor version, same for Win7 vs 2008R2
256
 
    IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT}
257
 
  _winver_not_ntserver:
258
 
 
259
 
  # pack version
260
 
  IntOp $1 $1 << 24 # VerMajor
261
 
  IntOp $__WINVERV $__WINVERV | $1
262
 
  IntOp $0 $2 << 16
263
 
  IntOp $__WINVERV $__WINVERV | $0 # VerMinor
264
 
  IntOp $__WINVERSP $__WINVERSP | $3 # VerBuild
265
 
 
266
 
  # restore registers
267
 
  Pop $R0
268
 
  Pop $3
269
 
  Pop $2
270
 
  Pop $1
271
 
  Pop $0
272
 
 
273
 
!macroend
274
 
 
275
 
!macro _WinVer_GetServicePackLevel OUTVAR
276
 
  ${CallArtificialFunction} __WinVer_InitVars
277
 
  IntOp ${OUTVAR} $__WINVERSP & ${_WINVER_MASKSP}
278
 
  IntOp ${OUTVAR} ${OUTVAR} >> 16
279
 
!macroend
280
 
!define WinVerGetServicePackLevel '!insertmacro _WinVer_GetServicePackLevel '
281
 
 
282
 
!macro _AtLeastServicePack _a _b _t _f
283
 
  !insertmacro _LOGICLIB_TEMP
284
 
  ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP
285
 
  !insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}`
286
 
!macroend
287
 
!define AtLeastServicePack `"" AtLeastServicePack`
288
 
 
289
 
!macro _AtMostServicePack _a _b _t _f
290
 
  !insertmacro _LOGICLIB_TEMP
291
 
  ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP
292
 
  !insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}`
293
 
!macroend
294
 
!define AtMostServicePack `"" AtMostServicePack`
295
 
 
296
 
!macro _IsServicePack _a _b _t _f
297
 
  !insertmacro _LOGICLIB_TEMP
298
 
  ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP
299
 
  !insertmacro _= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}`
300
 
!macroend
301
 
!define IsServicePack `"" IsServicePack`
302
 
 
303
 
!endif # _WINVER_VERXBIT
 
21
!macro __MOZ__WinVer_DefineOSTests WinVer
 
22
  !insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} ""
 
23
  !insertmacro __WinVer_DefineOSTest AtMost ${WinVer} ""
 
24
  !insertmacro __WinVer_DefineOSTest Is ${WinVer} ""
 
25
!macroend
 
26
 
 
27
!ifndef WINVER_7
 
28
  !define WINVER_7    0x06010000 ;6.01.????
 
29
  !insertmacro __MOZ__WinVer_DefineOSTests 7
 
30
!endif
 
31
 
 
32
!ifndef WINVER_2008R2
 
33
  !define WINVER_2008R2    0x06010001 ;6.01.????
 
34
  !insertmacro __MOZ__WinVer_DefineOSTests 2008R2
 
35
!endif
 
36
 
 
37
!ifndef WINVER_8
 
38
  !define WINVER_8    0x06020000 ;6.02.????
 
39
  !insertmacro __MOZ__WinVer_DefineOSTests 8
 
40
!endif
304
41
 
305
42
!verbose push
306
43
!verbose 3