|
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 |
|
5 ; The registration ID of the COM server which is used for choosing wether |
|
6 ; to launch the Win8 metro browser or desktop browser. |
|
7 !define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} |
|
8 ; |
|
9 ; Defines for adjust token privs and for enumerating keys |
|
10 !ifndef TOKEN_QUERY |
|
11 !define TOKEN_QUERY 0x0008 |
|
12 !endif |
|
13 !ifndef TOKEN_ADJUST_PRIVILEGES |
|
14 !define TOKEN_ADJUST_PRIVILEGES 0x0020 |
|
15 !endif |
|
16 !ifndef SE_RESTORE_NAME |
|
17 !define SE_RESTORE_NAME SeRestorePrivilege |
|
18 !endif |
|
19 !ifndef SE_PRIVILEGE_ENABLED |
|
20 !define SE_PRIVILEGE_ENABLED 0x00000002 |
|
21 !endif |
|
22 !ifndef HKEY_USERS |
|
23 !define HKEY_USERS 0x80000003 |
|
24 !endif |
|
25 |
|
26 ; Does metro registration for the command execute handler |
|
27 Function RegisterCEH |
|
28 !ifdef MOZ_METRO |
|
29 ${If} ${AtLeastWin8} |
|
30 ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
|
31 "FirefoxURL" \ |
|
32 "FirefoxHTML" |
|
33 ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
|
34 "$INSTDIR\CommandExecuteHandler.exe" \ |
|
35 $AppUserModelID \ |
|
36 "FirefoxURL" \ |
|
37 "FirefoxHTML" |
|
38 ${EndIf} |
|
39 !endif |
|
40 FunctionEnd |
|
41 |
|
42 ; If we're in Win8 make sure we have a start menu shortcut and that it has |
|
43 ; the correct AppuserModelID so that the Metro browser has a Metro tile. |
|
44 Function RegisterStartMenuTile |
|
45 !ifdef MOZ_METRO |
|
46 ${If} ${AtLeastWin8} |
|
47 CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
|
48 ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
49 ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
50 "$INSTDIR" |
|
51 ${If} "$AppUserModelID" != "" |
|
52 ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" |
|
53 ${EndIf} |
|
54 ${EndIf} |
|
55 ${EndIf} |
|
56 !endif |
|
57 FunctionEnd |
|
58 |
|
59 !macro PostUpdate |
|
60 |
|
61 ; PostUpdate is called from both session 0 and from the user session |
|
62 ; for service updates, make sure that we only register with the user session |
|
63 ; Otherwise ApplicationID::Set can fail intermittently with a file in use error. |
|
64 System::Call "kernel32::GetCurrentProcessId() i.r0" |
|
65 System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)" |
|
66 |
|
67 ; Determine if we're the protected UserChoice default or not. If so fix the |
|
68 ; start menu tile. In case there are 2 Firefox installations, we only do |
|
69 ; this if the application being updated is the default. |
|
70 ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId" |
|
71 ${If} $0 == "FirefoxURL" |
|
72 ${AndIf} $9 != 0 ; We're not running in session 0 |
|
73 ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "" |
|
74 ${GetPathFromString} "$0" $0 |
|
75 ${GetParent} "$0" $0 |
|
76 ${If} ${FileExists} "$0" |
|
77 ${GetLongPath} "$0" $0 |
|
78 ${EndIf} |
|
79 ${If} "$0" == "$INSTDIR" |
|
80 ; Win8 specific registration |
|
81 Call RegisterStartMenuTile |
|
82 ${EndIf} |
|
83 ${EndIf} |
|
84 |
|
85 ${CreateShortcutsLog} |
|
86 |
|
87 ; Remove registry entries for non-existent apps and for apps that point to our |
|
88 ; install location in the Software\Mozilla key and uninstall registry entries |
|
89 ; that point to our install location for both HKCU and HKLM. |
|
90 SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) |
|
91 ${RegCleanMain} "Software\Mozilla" |
|
92 ${RegCleanUninstall} |
|
93 ${UpdateProtocolHandlers} |
|
94 |
|
95 ; setup the application model id registration value |
|
96 ${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs" |
|
97 |
|
98 ; Win7 taskbar and start menu link maintenance |
|
99 Call FixShortcutAppModelIDs |
|
100 |
|
101 ClearErrors |
|
102 WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" |
|
103 ${If} ${Errors} |
|
104 StrCpy $TmpVal "HKCU" ; used primarily for logging |
|
105 ${Else} |
|
106 SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) |
|
107 DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" |
|
108 StrCpy $TmpVal "HKLM" ; used primarily for logging |
|
109 ${RegCleanMain} "Software\Mozilla" |
|
110 ${RegCleanUninstall} |
|
111 ${UpdateProtocolHandlers} |
|
112 ${FixShellIconHandler} "HKLM" |
|
113 ${SetAppLSPCategories} ${LSP_CATEGORIES} |
|
114 |
|
115 ; Win7 taskbar and start menu link maintenance |
|
116 Call FixShortcutAppModelIDs |
|
117 |
|
118 ; Only update the Clients\StartMenuInternet registry key values in HKLM if |
|
119 ; they don't exist or this installation is the same as the one set in those |
|
120 ; keys. |
|
121 ${StrFilter} "${FileMainEXE}" "+" "" "" $1 |
|
122 ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" |
|
123 ${GetPathFromString} "$0" $0 |
|
124 ${GetParent} "$0" $0 |
|
125 ${If} ${FileExists} "$0" |
|
126 ${GetLongPath} "$0" $0 |
|
127 ${EndIf} |
|
128 ${If} "$0" == "$INSTDIR" |
|
129 ${SetStartMenuInternet} "HKLM" |
|
130 ${EndIf} |
|
131 |
|
132 ; Only update the Clients\StartMenuInternet registry key values in HKCU if |
|
133 ; they don't exist or this installation is the same as the one set in those |
|
134 ; keys. This is only done in Windows 8 to avoid a UAC prompt. |
|
135 ${If} ${AtLeastWin8} |
|
136 ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" |
|
137 ${GetPathFromString} "$0" $0 |
|
138 ${GetParent} "$0" $0 |
|
139 ${If} ${FileExists} "$0" |
|
140 ${GetLongPath} "$0" $0 |
|
141 ${EndIf} |
|
142 ${If} "$0" == "$INSTDIR" |
|
143 ${SetStartMenuInternet} "HKCU" |
|
144 ${EndIf} |
|
145 ${EndIf} |
|
146 |
|
147 ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" |
|
148 ${If} "$0" != "${GREVersion}" |
|
149 WriteRegStr HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" "${GREVersion}" |
|
150 ${EndIf} |
|
151 ${EndIf} |
|
152 |
|
153 ; Migrate the application's Start Menu directory to a single shortcut in the |
|
154 ; root of the Start Menu Programs directory. |
|
155 ${MigrateStartMenuShortcut} |
|
156 |
|
157 ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details). |
|
158 ${MigrateTaskBarShortcut} |
|
159 |
|
160 ${RemoveDeprecatedKeys} |
|
161 |
|
162 ${SetAppKeys} |
|
163 ${FixClassKeys} |
|
164 ${SetUninstallKeys} |
|
165 |
|
166 ; Remove files that may be left behind by the application in the |
|
167 ; VirtualStore directory. |
|
168 ${CleanVirtualStore} |
|
169 |
|
170 ${RemoveDeprecatedFiles} |
|
171 |
|
172 ; Fix the distribution.ini file if applicable |
|
173 ${FixDistributionsINI} |
|
174 |
|
175 RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}" |
|
176 |
|
177 !ifdef MOZ_MAINTENANCE_SERVICE |
|
178 Call IsUserAdmin |
|
179 Pop $R0 |
|
180 ${If} $R0 == "true" |
|
181 ; Only proceed if we have HKLM write access |
|
182 ${AndIf} $TmpVal == "HKLM" |
|
183 ; On Windows 2000 we do not install the maintenance service. |
|
184 ${AndIf} ${AtLeastWinXP} |
|
185 ; Add the registry keys for allowed certificates. |
|
186 ${AddMaintCertKeys} |
|
187 |
|
188 ; We check to see if the maintenance service install was already attempted. |
|
189 ; Since the Maintenance service can be installed either x86 or x64, |
|
190 ; always use the 64-bit registry for checking if an attempt was made. |
|
191 ${If} ${RunningX64} |
|
192 SetRegView 64 |
|
193 ${EndIf} |
|
194 ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted" |
|
195 ClearErrors |
|
196 ${If} ${RunningX64} |
|
197 SetRegView lastused |
|
198 ${EndIf} |
|
199 |
|
200 ; If the maintenance service is already installed, do nothing. |
|
201 ; The maintenance service will launch: |
|
202 ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance |
|
203 ; service if necessary. If the update was done from updater.exe without |
|
204 ; the service (i.e. service is failing), updater.exe will do the update of |
|
205 ; the service. The reasons we do not do it here is because we don't want |
|
206 ; to have to prompt for limited user accounts when the service isn't used |
|
207 ; and we currently call the PostUpdate twice, once for the user and once |
|
208 ; for the SYSTEM account. Also, this would stop the maintenance service |
|
209 ; and we need a return result back to the service when run that way. |
|
210 ${If} $5 == "" |
|
211 ; An install of maintenance service was never attempted. |
|
212 ; We know we are an Admin and that we have write access into HKLM |
|
213 ; based on the above checks, so attempt to just run the EXE. |
|
214 ; In the worst case, in case there is some edge case with the |
|
215 ; IsAdmin check and the permissions check, the maintenance service |
|
216 ; will just fail to be attempted to be installed. |
|
217 nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\"" |
|
218 ${EndIf} |
|
219 ${EndIf} |
|
220 !endif |
|
221 |
|
222 ; Register the DEH |
|
223 !ifdef MOZ_METRO |
|
224 ${If} ${AtLeastWin8} |
|
225 ${AndIf} $9 != 0 ; We're not running in session 0 |
|
226 ; If RegisterCEH is called too close to changing the shortcut AppUserModelID |
|
227 ; and if the tile image is not already in cache. Then Windows won't refresh |
|
228 ; the tile image on the start screen. So wait before calling RegisterCEH. |
|
229 ; We only need to do this when the DEH doesn't already exist. |
|
230 ReadRegStr $0 HKCU "Software\Classes\FirefoxURL\shell\open\command" "DelegateExecute" |
|
231 ${If} $0 != ${DELEGATE_EXECUTE_HANDLER_ID} |
|
232 Sleep 3000 |
|
233 ${EndIf} |
|
234 Call RegisterCEH |
|
235 ${EndIf} |
|
236 !else |
|
237 ; The metro browser is not enabled by the mozconfig. |
|
238 ${If} ${AtLeastWin8} |
|
239 ${RemoveDEHRegistration} ${DELEGATE_EXECUTE_HANDLER_ID} \ |
|
240 $AppUserModelID \ |
|
241 "FirefoxURL" \ |
|
242 "FirefoxHTML" |
|
243 ${EndIf} |
|
244 !endif |
|
245 !macroend |
|
246 !define PostUpdate "!insertmacro PostUpdate" |
|
247 |
|
248 !macro SetAsDefaultAppGlobal |
|
249 ${RemoveDeprecatedKeys} ; Does not use SHCTX |
|
250 |
|
251 SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) |
|
252 ${SetHandlers} ; Uses SHCTX |
|
253 ${SetStartMenuInternet} "HKLM" |
|
254 ${FixShellIconHandler} "HKLM" |
|
255 ${ShowShortcuts} |
|
256 ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
|
257 WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9" |
|
258 !macroend |
|
259 !define SetAsDefaultAppGlobal "!insertmacro SetAsDefaultAppGlobal" |
|
260 |
|
261 ; Removes shortcuts for this installation. This should also remove the |
|
262 ; application from Open With for the file types the application handles |
|
263 ; (bug 370480). |
|
264 !macro HideShortcuts |
|
265 ${StrFilter} "${FileMainEXE}" "+" "" "" $0 |
|
266 StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" |
|
267 WriteRegDWORD HKLM "$R1" "IconsVisible" 0 |
|
268 ${If} ${AtLeastWin8} |
|
269 WriteRegDWORD HKCU "$R1" "IconsVisible" 0 |
|
270 ${EndIf} |
|
271 |
|
272 SetShellVarContext all ; Set $DESKTOP to All Users |
|
273 ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
274 SetShellVarContext current ; Set $DESKTOP to the current user's desktop |
|
275 ${EndUnless} |
|
276 |
|
277 ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
278 ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk" |
|
279 Pop $0 |
|
280 ${If} "$0" == "" |
|
281 ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk" |
|
282 Pop $0 |
|
283 ${GetLongPath} "$0" $0 |
|
284 ${If} "$0" == "$INSTDIR\${FileMainEXE}" |
|
285 Delete "$DESKTOP\${BrandFullName}.lnk" |
|
286 ${EndIf} |
|
287 ${EndIf} |
|
288 ${EndIf} |
|
289 |
|
290 SetShellVarContext all ; Set $SMPROGRAMS to All Users |
|
291 ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
292 SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start |
|
293 ; Menu Programs directory |
|
294 ${EndUnless} |
|
295 |
|
296 ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
297 ShellLink::GetShortCutArgs "$SMPROGRAMS\${BrandFullName}.lnk" |
|
298 Pop $0 |
|
299 ${If} "$0" == "" |
|
300 ShellLink::GetShortCutTarget "$SMPROGRAMS\${BrandFullName}.lnk" |
|
301 Pop $0 |
|
302 ${GetLongPath} "$0" $0 |
|
303 ${If} "$0" == "$INSTDIR\${FileMainEXE}" |
|
304 Delete "$SMPROGRAMS\${BrandFullName}.lnk" |
|
305 ${EndIf} |
|
306 ${EndIf} |
|
307 ${EndIf} |
|
308 |
|
309 ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
310 ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
311 Pop $0 |
|
312 ${If} "$0" == "" |
|
313 ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
314 Pop $0 |
|
315 ${GetLongPath} "$0" $0 |
|
316 ${If} "$0" == "$INSTDIR\${FileMainEXE}" |
|
317 Delete "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
318 ${EndIf} |
|
319 ${EndIf} |
|
320 ${EndIf} |
|
321 !macroend |
|
322 !define HideShortcuts "!insertmacro HideShortcuts" |
|
323 |
|
324 ; Adds shortcuts for this installation. This should also add the application |
|
325 ; to Open With for the file types the application handles (bug 370480). |
|
326 !macro ShowShortcuts |
|
327 ${StrFilter} "${FileMainEXE}" "+" "" "" $0 |
|
328 StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" |
|
329 WriteRegDWORD HKLM "$R1" "IconsVisible" 1 |
|
330 ${If} ${AtLeastWin8} |
|
331 WriteRegDWORD HKCU "$R1" "IconsVisible" 1 |
|
332 ${EndIf} |
|
333 |
|
334 SetShellVarContext all ; Set $DESKTOP to All Users |
|
335 ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
336 CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
|
337 ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
338 ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR" |
|
339 ${If} ${AtLeastWin7} |
|
340 ${AndIf} "$AppUserModelID" != "" |
|
341 ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" |
|
342 ${EndIf} |
|
343 ${Else} |
|
344 SetShellVarContext current ; Set $DESKTOP to the current user's desktop |
|
345 ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
346 CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
|
347 ${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" |
|
348 ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" \ |
|
349 "$INSTDIR" |
|
350 ${If} ${AtLeastWin7} |
|
351 ${AndIf} "$AppUserModelID" != "" |
|
352 ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" |
|
353 ${EndIf} |
|
354 ${EndIf} |
|
355 ${EndUnless} |
|
356 ${EndIf} |
|
357 ${EndUnless} |
|
358 |
|
359 SetShellVarContext all ; Set $SMPROGRAMS to All Users |
|
360 ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
361 CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
|
362 ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
363 ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
364 "$INSTDIR" |
|
365 ${If} ${AtLeastWin7} |
|
366 ${AndIf} "$AppUserModelID" != "" |
|
367 ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" |
|
368 ${EndIf} |
|
369 ${Else} |
|
370 SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start |
|
371 ; Menu Programs directory |
|
372 ${Unless} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
373 CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" |
|
374 ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
375 ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
376 "$INSTDIR" |
|
377 ${If} ${AtLeastWin7} |
|
378 ${AndIf} "$AppUserModelID" != "" |
|
379 ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" |
|
380 ${EndIf} |
|
381 ${EndIf} |
|
382 ${EndUnless} |
|
383 ${EndIf} |
|
384 ${EndUnless} |
|
385 |
|
386 ; Windows 7 doesn't use the QuickLaunch directory |
|
387 ${Unless} ${AtLeastWin7} |
|
388 ${AndUnless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
389 CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" \ |
|
390 "$INSTDIR\${FileMainEXE}" |
|
391 ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
392 ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" \ |
|
393 "$INSTDIR" |
|
394 ${EndIf} |
|
395 ${EndUnless} |
|
396 !macroend |
|
397 !define ShowShortcuts "!insertmacro ShowShortcuts" |
|
398 |
|
399 !macro AddAssociationIfNoneExist FILE_TYPE |
|
400 ClearErrors |
|
401 EnumRegKey $7 HKCR "${FILE_TYPE}" 0 |
|
402 ${If} ${Errors} |
|
403 WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML" |
|
404 ${EndIf} |
|
405 !macroend |
|
406 !define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist" |
|
407 |
|
408 ; Adds the protocol and file handler registry entries for making Firefox the |
|
409 ; default handler (uses SHCTX). |
|
410 !macro SetHandlers |
|
411 ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 |
|
412 |
|
413 StrCpy $0 "SOFTWARE\Classes" |
|
414 StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" |
|
415 |
|
416 ; Associate the file handlers with FirefoxHTML |
|
417 ReadRegStr $6 SHCTX "$0\.htm" "" |
|
418 ${If} "$6" != "FirefoxHTML" |
|
419 WriteRegStr SHCTX "$0\.htm" "" "FirefoxHTML" |
|
420 ${EndIf} |
|
421 |
|
422 ReadRegStr $6 SHCTX "$0\.html" "" |
|
423 ${If} "$6" != "FirefoxHTML" |
|
424 WriteRegStr SHCTX "$0\.html" "" "FirefoxHTML" |
|
425 ${EndIf} |
|
426 |
|
427 ReadRegStr $6 SHCTX "$0\.shtml" "" |
|
428 ${If} "$6" != "FirefoxHTML" |
|
429 WriteRegStr SHCTX "$0\.shtml" "" "FirefoxHTML" |
|
430 ${EndIf} |
|
431 |
|
432 ReadRegStr $6 SHCTX "$0\.xht" "" |
|
433 ${If} "$6" != "FirefoxHTML" |
|
434 WriteRegStr SHCTX "$0\.xht" "" "FirefoxHTML" |
|
435 ${EndIf} |
|
436 |
|
437 ReadRegStr $6 SHCTX "$0\.xhtml" "" |
|
438 ${If} "$6" != "FirefoxHTML" |
|
439 WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML" |
|
440 ${EndIf} |
|
441 |
|
442 ${AddAssociationIfNoneExist} ".pdf" |
|
443 ${AddAssociationIfNoneExist} ".oga" |
|
444 ${AddAssociationIfNoneExist} ".ogg" |
|
445 ${AddAssociationIfNoneExist} ".ogv" |
|
446 ${AddAssociationIfNoneExist} ".pdf" |
|
447 ${AddAssociationIfNoneExist} ".webm" |
|
448 |
|
449 ; An empty string is used for the 5th param because FirefoxHTML is not a |
|
450 ; protocol handler |
|
451 ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ |
|
452 "${AppRegName} HTML Document" "" |
|
453 |
|
454 ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ |
|
455 "true" |
|
456 Call RegisterCEH |
|
457 |
|
458 ; An empty string is used for the 4th & 5th params because the following |
|
459 ; protocol handlers already have a display name and the additional keys |
|
460 ; required for a protocol handler. |
|
461 ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" |
|
462 ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" |
|
463 ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" |
|
464 !macroend |
|
465 !define SetHandlers "!insertmacro SetHandlers" |
|
466 |
|
467 ; Adds the HKLM\Software\Clients\StartMenuInternet\FIREFOX.EXE registry |
|
468 ; entries (does not use SHCTX). |
|
469 ; |
|
470 ; The values for StartMenuInternet are only valid under HKLM and there can only |
|
471 ; be one installation registerred under StartMenuInternet per application since |
|
472 ; the key name is derived from the main application executable. |
|
473 ; http://support.microsoft.com/kb/297878 |
|
474 ; |
|
475 ; In Windows 8 this changes slightly, you can store StartMenuInternet entries in |
|
476 ; HKCU. The icon in start menu for StartMenuInternet is deprecated as of Win7, |
|
477 ; but the subkeys are what's important. Control panel default programs looks |
|
478 ; for them only in HKLM pre win8. |
|
479 ; |
|
480 ; Note: we might be able to get away with using the full path to the |
|
481 ; application executable for the key name in order to support multiple |
|
482 ; installations. |
|
483 !macro SetStartMenuInternet RegKey |
|
484 ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 |
|
485 ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 |
|
486 |
|
487 ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
|
488 |
|
489 StrCpy $0 "Software\Clients\StartMenuInternet\$R9" |
|
490 |
|
491 WriteRegStr ${RegKey} "$0" "" "${BrandFullName}" |
|
492 |
|
493 WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" |
|
494 |
|
495 ; The Reinstall Command is defined at |
|
496 ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp |
|
497 WriteRegStr ${RegKey} "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" |
|
498 WriteRegStr ${RegKey} "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" |
|
499 WriteRegStr ${RegKey} "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" |
|
500 |
|
501 ClearErrors |
|
502 ReadRegDWORD $1 ${RegKey} "$0\InstallInfo" "IconsVisible" |
|
503 ; If the IconsVisible name value pair doesn't exist add it otherwise the |
|
504 ; application won't be displayed in Set Program Access and Defaults. |
|
505 ${If} ${Errors} |
|
506 ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" |
|
507 WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1 |
|
508 ${Else} |
|
509 WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0 |
|
510 ${EndIf} |
|
511 ${EndIf} |
|
512 |
|
513 WriteRegStr ${RegKey} "$0\shell\open\command" "" "$\"$8$\"" |
|
514 |
|
515 WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" |
|
516 WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -preferences" |
|
517 |
|
518 WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" |
|
519 WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" |
|
520 |
|
521 ; Vista Capabilities registry keys |
|
522 WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" |
|
523 WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" |
|
524 WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}" |
|
525 |
|
526 WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML" |
|
527 WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML" |
|
528 WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML" |
|
529 WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML" |
|
530 WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML" |
|
531 |
|
532 WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9" |
|
533 |
|
534 WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL" |
|
535 WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL" |
|
536 WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL" |
|
537 |
|
538 ; Vista Registered Application |
|
539 WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities" |
|
540 !macroend |
|
541 !define SetStartMenuInternet "!insertmacro SetStartMenuInternet" |
|
542 |
|
543 ; The IconHandler reference for FirefoxHTML can end up in an inconsistent state |
|
544 ; due to changes not being detected by the IconHandler for side by side |
|
545 ; installs (see bug 268512). The symptoms can be either an incorrect icon or no |
|
546 ; icon being displayed for files associated with Firefox (does not use SHCTX). |
|
547 !macro FixShellIconHandler RegKey |
|
548 ClearErrors |
|
549 ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\ShellEx\IconHandler" "" |
|
550 ${Unless} ${Errors} |
|
551 ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" |
|
552 ${GetLongPath} "$INSTDIR\${FileMainEXE}" $2 |
|
553 ${If} "$1" != "$2,1" |
|
554 WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1" |
|
555 ${EndIf} |
|
556 ${EndUnless} |
|
557 !macroend |
|
558 !define FixShellIconHandler "!insertmacro FixShellIconHandler" |
|
559 |
|
560 ; Add Software\Mozilla\ registry entries (uses SHCTX). |
|
561 !macro SetAppKeys |
|
562 ; Check if this is an ESR release and if so add registry values so it is |
|
563 ; possible to determine that this is an ESR install (bug 726781). |
|
564 ClearErrors |
|
565 ${WordFind} "${UpdateChannel}" "esr" "E#" $3 |
|
566 ${If} ${Errors} |
|
567 StrCpy $3 "" |
|
568 ${Else} |
|
569 StrCpy $3 " ESR" |
|
570 ${EndIf} |
|
571 |
|
572 ${GetLongPath} "$INSTDIR" $8 |
|
573 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main" |
|
574 ${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0 |
|
575 ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 |
|
576 |
|
577 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Uninstall" |
|
578 ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 |
|
579 |
|
580 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})" |
|
581 ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 |
|
582 ${If} "$3" == "" |
|
583 DeleteRegValue SHCTX "$0" "ESR" |
|
584 ${Else} |
|
585 ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 |
|
586 ${EndIf} |
|
587 |
|
588 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\bin" |
|
589 ${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0 |
|
590 |
|
591 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\extensions" |
|
592 ${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0 |
|
593 ${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0 |
|
594 |
|
595 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3" |
|
596 ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0 |
|
597 ${If} "$3" == "" |
|
598 DeleteRegValue SHCTX "$0" "ESR" |
|
599 ${Else} |
|
600 ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0 |
|
601 ${EndIf} |
|
602 |
|
603 StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}$3" |
|
604 ${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0 |
|
605 ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0 |
|
606 !macroend |
|
607 !define SetAppKeys "!insertmacro SetAppKeys" |
|
608 |
|
609 ; Add uninstall registry entries. This macro tests for write access to determine |
|
610 ; if the uninstall keys should be added to HKLM or HKCU. |
|
611 !macro SetUninstallKeys |
|
612 ; Check if this is an ESR release and if so add registry values so it is |
|
613 ; possible to determine that this is an ESR install (bug 726781). |
|
614 ClearErrors |
|
615 ${WordFind} "${UpdateChannel}" "esr" "E#" $3 |
|
616 ${If} ${Errors} |
|
617 StrCpy $3 "" |
|
618 ${Else} |
|
619 StrCpy $3 " ESR" |
|
620 ${EndIf} |
|
621 |
|
622 StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" |
|
623 |
|
624 StrCpy $2 "" |
|
625 ClearErrors |
|
626 WriteRegStr HKLM "$0" "${BrandShortName}InstallerTest" "Write Test" |
|
627 ${If} ${Errors} |
|
628 ; If the uninstall keys already exist in HKLM don't create them in HKCU |
|
629 ClearErrors |
|
630 ReadRegStr $2 "HKLM" $0 "DisplayName" |
|
631 ${If} $2 == "" |
|
632 ; Otherwise we don't have any keys for this product in HKLM so proceeed |
|
633 ; to create them in HKCU. Better handling for this will be done in: |
|
634 ; Bug 711044 - Better handling for 2 uninstall icons |
|
635 StrCpy $1 "HKCU" |
|
636 SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) |
|
637 ${EndIf} |
|
638 ClearErrors |
|
639 ${Else} |
|
640 StrCpy $1 "HKLM" |
|
641 SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) |
|
642 DeleteRegValue HKLM "$0" "${BrandShortName}InstallerTest" |
|
643 ${EndIf} |
|
644 |
|
645 ${If} $2 == "" |
|
646 ${GetLongPath} "$INSTDIR" $8 |
|
647 |
|
648 ; Write the uninstall registry keys |
|
649 ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 |
|
650 ${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0 |
|
651 ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0 |
|
652 ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 |
|
653 ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 |
|
654 ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 |
|
655 ${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 |
|
656 ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 |
|
657 DeleteRegValue SHCTX "$0" "URLInfoAbout" |
|
658 ; Don't add URLUpdateInfo which is the release notes url except for the release |
|
659 ; and esr channels since nightly, aurora, and beta do not have release notes. |
|
660 ; Note: URLUpdateInfo is only defined in the official branding.nsi. |
|
661 !ifdef URLUpdateInfo |
|
662 !ifndef BETA_UPDATE_CHANNEL |
|
663 ${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0 |
|
664 !endif |
|
665 !endif |
|
666 ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0 |
|
667 ${WriteRegDWORD2} $1 "$0" "NoModify" 1 0 |
|
668 ${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0 |
|
669 |
|
670 ${GetSize} "$8" "/S=0K" $R2 $R3 $R4 |
|
671 ${WriteRegDWORD2} $1 "$0" "EstimatedSize" $R2 0 |
|
672 |
|
673 ${If} "$TmpVal" == "HKLM" |
|
674 SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) |
|
675 ${Else} |
|
676 SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) |
|
677 ${EndIf} |
|
678 ${EndIf} |
|
679 !macroend |
|
680 !define SetUninstallKeys "!insertmacro SetUninstallKeys" |
|
681 |
|
682 ; Due to a bug when associating some file handlers, only SHCTX was checked for |
|
683 ; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on |
|
684 ; whether the installer has write access to HKLM. The bug would happen when |
|
685 ; HCKU was checked and didn't exist since programs aren't required to set the |
|
686 ; HKCU Software\Classes keys when associating handlers. The fix uses the merged |
|
687 ; view in HKCR to check for existance of an existing association. This macro |
|
688 ; cleans affected installations by removing the HKLM and HKCU value if it is set |
|
689 ; to FirefoxHTML when there is a value for PersistentHandler or by removing the |
|
690 ; HKCU value when the HKLM value has a value other than an empty string. |
|
691 !macro FixBadFileAssociation FILE_TYPE |
|
692 ; Only delete the default value in case the key has values for OpenWithList, |
|
693 ; OpenWithProgids, PersistentHandler, etc. |
|
694 ReadRegStr $0 HKCU "Software\Classes\${FILE_TYPE}" "" |
|
695 ReadRegStr $1 HKLM "Software\Classes\${FILE_TYPE}" "" |
|
696 ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" "" |
|
697 ${If} "$2" != "" |
|
698 ; Since there is a persistent handler remove FirefoxHTML as the default |
|
699 ; value from both HKCU and HKLM if it set to FirefoxHTML. |
|
700 ${If} "$0" == "FirefoxHTML" |
|
701 DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" |
|
702 ${EndIf} |
|
703 ${If} "$1" == "FirefoxHTML" |
|
704 DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" "" |
|
705 ${EndIf} |
|
706 ${ElseIf} "$0" == "FirefoxHTML" |
|
707 ; Since KHCU is set to FirefoxHTML remove FirefoxHTML as the default value |
|
708 ; from HKCU if HKLM is set to a value other than an empty string. |
|
709 ${If} "$1" != "" |
|
710 DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" |
|
711 ${EndIf} |
|
712 ${EndIf} |
|
713 !macroend |
|
714 !define FixBadFileAssociation "!insertmacro FixBadFileAssociation" |
|
715 |
|
716 ; Add app specific handler registry entries under Software\Classes if they |
|
717 ; don't exist (does not use SHCTX). |
|
718 !macro FixClassKeys |
|
719 StrCpy $1 "SOFTWARE\Classes" |
|
720 |
|
721 ; File handler keys and name value pairs that may need to be created during |
|
722 ; install or upgrade. |
|
723 ReadRegStr $0 HKCR ".shtml" "Content Type" |
|
724 ${If} "$0" == "" |
|
725 StrCpy $0 "$1\.shtml" |
|
726 ${WriteRegStr2} $TmpVal "$1\.shtml" "" "shtmlfile" 0 |
|
727 ${WriteRegStr2} $TmpVal "$1\.shtml" "Content Type" "text/html" 0 |
|
728 ${WriteRegStr2} $TmpVal "$1\.shtml" "PerceivedType" "text" 0 |
|
729 ${EndIf} |
|
730 |
|
731 ReadRegStr $0 HKCR ".xht" "Content Type" |
|
732 ${If} "$0" == "" |
|
733 ${WriteRegStr2} $TmpVal "$1\.xht" "" "xhtfile" 0 |
|
734 ${WriteRegStr2} $TmpVal "$1\.xht" "Content Type" "application/xhtml+xml" 0 |
|
735 ${EndIf} |
|
736 |
|
737 ReadRegStr $0 HKCR ".xhtml" "Content Type" |
|
738 ${If} "$0" == "" |
|
739 ${WriteRegStr2} $TmpVal "$1\.xhtml" "" "xhtmlfile" 0 |
|
740 ${WriteRegStr2} $TmpVal "$1\.xhtml" "Content Type" "application/xhtml+xml" 0 |
|
741 ${EndIf} |
|
742 |
|
743 ; Remove possibly badly associated file types |
|
744 ${FixBadFileAssociation} ".pdf" |
|
745 ${FixBadFileAssociation} ".oga" |
|
746 ${FixBadFileAssociation} ".ogg" |
|
747 ${FixBadFileAssociation} ".ogv" |
|
748 ${FixBadFileAssociation} ".pdf" |
|
749 ${FixBadFileAssociation} ".webm" |
|
750 !macroend |
|
751 !define FixClassKeys "!insertmacro FixClassKeys" |
|
752 |
|
753 ; Updates protocol handlers if their registry open command value is for this |
|
754 ; install location (uses SHCTX). |
|
755 !macro UpdateProtocolHandlers |
|
756 ; Store the command to open the app with an url in a register for easy access. |
|
757 ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 |
|
758 StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" |
|
759 |
|
760 ; Only set the file and protocol handlers if the existing one under HKCR is |
|
761 ; for this install location. |
|
762 |
|
763 ${IsHandlerForInstallDir} "FirefoxHTML" $R9 |
|
764 ${If} "$R9" == "true" |
|
765 ; An empty string is used for the 5th param because FirefoxHTML is not a |
|
766 ; protocol handler. |
|
767 ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ |
|
768 "${AppRegName} HTML Document" "" |
|
769 ${EndIf} |
|
770 |
|
771 ${IsHandlerForInstallDir} "FirefoxURL" $R9 |
|
772 ${If} "$R9" == "true" |
|
773 ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" \ |
|
774 "${AppRegName} URL" "true" |
|
775 ${EndIf} |
|
776 |
|
777 ; An empty string is used for the 4th & 5th params because the following |
|
778 ; protocol handlers already have a display name and the additional keys |
|
779 ; required for a protocol handler. |
|
780 ${IsHandlerForInstallDir} "ftp" $R9 |
|
781 ${If} "$R9" == "true" |
|
782 ${AddDisabledDDEHandlerValues} "ftp" "$2" "$8,1" "" "" |
|
783 ${EndIf} |
|
784 |
|
785 ${IsHandlerForInstallDir} "http" $R9 |
|
786 ${If} "$R9" == "true" |
|
787 ${AddDisabledDDEHandlerValues} "http" "$2" "$8,1" "" "" |
|
788 ${EndIf} |
|
789 |
|
790 ${IsHandlerForInstallDir} "https" $R9 |
|
791 ${If} "$R9" == "true" |
|
792 ${AddDisabledDDEHandlerValues} "https" "$2" "$8,1" "" "" |
|
793 ${EndIf} |
|
794 !macroend |
|
795 !define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers" |
|
796 |
|
797 !ifdef MOZ_MAINTENANCE_SERVICE |
|
798 ; Adds maintenance service certificate keys for the install dir. |
|
799 ; For the cert to work, it must also be signed by a trusted cert for the user. |
|
800 !macro AddMaintCertKeys |
|
801 Push $R0 |
|
802 ; Allow main Mozilla cert information for updates |
|
803 ; This call will push the needed key on the stack |
|
804 ServicesHelper::PathToUniqueRegistryPath "$INSTDIR" |
|
805 Pop $R0 |
|
806 ${If} $R0 != "" |
|
807 ; More than one certificate can be specified in a different subfolder |
|
808 ; for example: $R0\1, but each individual binary can be signed |
|
809 ; with at most one certificate. A fallback certificate can only be used |
|
810 ; if the binary is replaced with a different certificate. |
|
811 ; We always use the 64bit registry for certs. |
|
812 ${If} ${RunningX64} |
|
813 SetRegView 64 |
|
814 ${EndIf} |
|
815 DeleteRegKey HKLM "$R0" |
|
816 WriteRegStr HKLM "$R0" "prefetchProcessName" "FIREFOX" |
|
817 WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}" |
|
818 WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}" |
|
819 ${If} ${RunningX64} |
|
820 SetRegView lastused |
|
821 ${EndIf} |
|
822 ClearErrors |
|
823 ${EndIf} |
|
824 ; Restore the previously used value back |
|
825 Pop $R0 |
|
826 !macroend |
|
827 !define AddMaintCertKeys "!insertmacro AddMaintCertKeys" |
|
828 !endif |
|
829 |
|
830 ; Removes various registry entries for reasons noted below (does not use SHCTX). |
|
831 !macro RemoveDeprecatedKeys |
|
832 StrCpy $0 "SOFTWARE\Classes" |
|
833 ; Remove support for launching gopher urls from the shell during install or |
|
834 ; update if the DefaultIcon is from firefox.exe. |
|
835 ${RegCleanAppHandler} "gopher" |
|
836 |
|
837 ; Remove support for launching chrome urls from the shell during install or |
|
838 ; update if the DefaultIcon is from firefox.exe (Bug 301073). |
|
839 ${RegCleanAppHandler} "chrome" |
|
840 |
|
841 ; Remove protocol handler registry keys added by the MS shim |
|
842 DeleteRegKey HKLM "Software\Classes\Firefox.URL" |
|
843 DeleteRegKey HKCU "Software\Classes\Firefox.URL" |
|
844 |
|
845 ; Delete gopher from Capabilities\URLAssociations if it is present. |
|
846 ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
|
847 StrCpy $0 "Software\Clients\StartMenuInternet\$R9" |
|
848 ClearErrors |
|
849 ReadRegStr $2 HKLM "$0\Capabilities\URLAssociations" "gopher" |
|
850 ${Unless} ${Errors} |
|
851 DeleteRegValue HKLM "$0\Capabilities\URLAssociations" "gopher" |
|
852 ${EndUnless} |
|
853 |
|
854 ; Delete gopher from the user's UrlAssociations if it points to FirefoxURL. |
|
855 StrCpy $0 "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\gopher" |
|
856 ReadRegStr $2 HKCU "$0\UserChoice" "Progid" |
|
857 ${If} "$2" == "FirefoxURL" |
|
858 DeleteRegKey HKCU "$0" |
|
859 ${EndIf} |
|
860 !macroend |
|
861 !define RemoveDeprecatedKeys "!insertmacro RemoveDeprecatedKeys" |
|
862 |
|
863 ; Resets Win8+ specific toast keys Windows sets. We call this on a |
|
864 ; fresh install and on uninstall. |
|
865 !macro ResetWin8PromptKeys KEY PREFIX |
|
866 ${If} ${AtLeastWin8} |
|
867 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.htm" |
|
868 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.html" |
|
869 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xht" |
|
870 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.xhtml" |
|
871 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxHTML_.shtml" |
|
872 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_ftp" |
|
873 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_http" |
|
874 DeleteRegValue ${KEY} "${PREFIX}Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts" "FirefoxURL_https" |
|
875 ${EndIf} |
|
876 !macroend |
|
877 !define ResetWin8PromptKeys "!insertmacro ResetWin8PromptKeys" |
|
878 |
|
879 !ifdef MOZ_METRO |
|
880 ; Resets Win8+ Metro specific splash screen info. Relies |
|
881 ; on AppUserModelID. |
|
882 !macro ResetWin8MetroSplash |
|
883 ${If} ${AtLeastWin8} |
|
884 ${AndIf} "$AppUserModelID" != "" |
|
885 DeleteRegKey HKCR "Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!$AppUserModelID" |
|
886 ${EndIf} |
|
887 !macroend |
|
888 !define ResetWin8MetroSplash "!insertmacro ResetWin8MetroSplash" |
|
889 !endif |
|
890 |
|
891 ; Adds SE_RESTORE_NAME privs |
|
892 !macro AcquireSERestoreName |
|
893 StrCpy $R1 0 |
|
894 |
|
895 System::Call "kernel32::GetCurrentProcess() i .R0" |
|
896 System::Call "advapi32::OpenProcessToken(i R0, i ${TOKEN_QUERY}|${TOKEN_ADJUST_PRIVILEGES}, \ |
|
897 *i R1R1) i .R0" |
|
898 ${If} $R0 != 0 |
|
899 System::Call "advapi32::LookupPrivilegeValue(t n, t '${SE_RESTORE_NAME}', *l .R2) i .R0" |
|
900 ${If} $R0 != 0 |
|
901 System::Call "*(i 1, l R2, i ${SE_PRIVILEGE_ENABLED}) i .R0" |
|
902 System::Call "advapi32::AdjustTokenPrivileges(i R1, i 0, i R0, i 0, i 0, i 0)" |
|
903 System::Free $R0 |
|
904 ${EndIf} |
|
905 System::Call "kernel32::CloseHandle(i R1)" |
|
906 ${EndIf} |
|
907 !macroend |
|
908 !define AcquireSERestoreName "!insertmacro AcquireSERestoreName" |
|
909 !define un.AcquireSERestoreName "!insertmacro AcquireSERestoreName" |
|
910 |
|
911 ; Mounts all user ntuser.dat files into the registry as a subkey of HKU |
|
912 !macro MountRegistryIntoHKU |
|
913 ; $0 is used as an index for HKEY_USERS enumeration |
|
914 StrCpy $0 0 |
|
915 ${Do} |
|
916 EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 |
|
917 ${If} $1 == "" |
|
918 ${Break} |
|
919 ${EndIf} |
|
920 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" |
|
921 System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0', t '$2\ntuser.dat')" |
|
922 System::Call "advapi32::RegLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes', t '$2\AppData\Local\Microsoft\Windows\UsrClass.dat')" |
|
923 IntOp $0 $0 + 1 |
|
924 ${Loop} |
|
925 !macroend |
|
926 !define MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" |
|
927 !define un.MountRegistryIntoHKU "!insertmacro MountRegistryIntoHKU" |
|
928 ; |
|
929 ; Unmounts all user ntuser.dat files into the registry as a subkey of HKU |
|
930 !macro UnmountRegistryIntoHKU |
|
931 ; $0 is used as an index for HKEY_USERS enumeration |
|
932 StrCpy $0 0 |
|
933 ${Do} |
|
934 EnumRegKey $1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" $0 |
|
935 ${If} $1 == "" |
|
936 ${Break} |
|
937 ${EndIf} |
|
938 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\$1" "ProfileImagePath" |
|
939 System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0')" |
|
940 System::Call "advapi32::RegUnLoadKey(i ${HKEY_USERS}, t 'User-$0_Classes')" |
|
941 IntOp $0 $0 + 1 |
|
942 ${Loop} |
|
943 !macroend |
|
944 !define UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" |
|
945 !define un.UnmountRegistryIntoHKU "!insertmacro UnmountRegistryIntoHKU" |
|
946 |
|
947 ; Unconditionally removes the delegate execute handler registration used to |
|
948 ; launch the metro browser and misc. metro related registry values. |
|
949 !macro RemoveDEHRegistration DELEGATE_EXECUTE_HANDLER_ID \ |
|
950 APP_USER_MODEL_ID \ |
|
951 PROTOCOL_ACTIVATION_ID \ |
|
952 FILE_ACTIVATION_ID |
|
953 ${AcquireSERestoreName} |
|
954 ${MountRegistryIntoHKU} |
|
955 |
|
956 ; $0 is used as an index for HKEY_USERS enumeration |
|
957 StrCpy $0 0 |
|
958 |
|
959 ${Do} |
|
960 EnumRegKey $1 HKU "" $0 |
|
961 ${If} $1 == "" |
|
962 ${Break} |
|
963 ${EndIf} |
|
964 |
|
965 ClearErrors |
|
966 ${WordFind} "$1" "_Classes" "E#" $3 |
|
967 ${Unless} ${Errors} |
|
968 ; remove the app user model id root registration. We don't need this |
|
969 ; here anymore, we just use it for tray registrationdown in widget, |
|
970 ; which we read out of the mozilla keys. |
|
971 ${If} "${APP_USER_MODEL_ID}" != "" |
|
972 ; The removal of this key intermittently fails, so do the best we can in cleanup |
|
973 DeleteRegValue HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" |
|
974 DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell\open" |
|
975 DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe\shell" |
|
976 DeleteRegKey HKU "$1\${APP_USER_MODEL_ID}\.exe" |
|
977 DeleteRegKey HKU "$1\\${APP_USER_MODEL_ID}" |
|
978 ${EndIf} |
|
979 ; |
|
980 ; Remove delegate execute handler clsid registration |
|
981 DeleteRegKey HKU "$1\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" |
|
982 |
|
983 ; Remove protocol and file delegate execute handler id assoc |
|
984 DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" |
|
985 DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}" "AppUserModelID" |
|
986 |
|
987 ; Remove delegate execute application registry keys |
|
988 DeleteRegKey HKU "$1\${PROTOCOL_ACTIVATION_ID}\Application" |
|
989 DeleteRegKey HKU "$1\${FILE_ACTIVATION_ID}\Application" |
|
990 |
|
991 ; Remove misc. shell open info |
|
992 DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" |
|
993 DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open" "CommandId" |
|
994 DeleteRegValue HKU "$1\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" |
|
995 DeleteRegValue HKU "$1\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" |
|
996 |
|
997 ; remove metro browser splash image data |
|
998 DeleteRegKey HKU "$1\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\SystemAppData\DefaultBrowser_NOPUBLISHERID\SplashScreen\DefaultBrowser_NOPUBLISHERID!${APP_USER_MODEL_ID}" |
|
999 ${Else} |
|
1000 ; misc. Metro keys |
|
1001 DeleteRegKey HKU "$1\Software\Mozilla\Firefox\Metro" |
|
1002 DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "CEHDump" |
|
1003 DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroD3DAvailable" |
|
1004 DeleteRegValue HKU "$1\Software\Mozilla\Firefox" "MetroLastAHE" |
|
1005 ${ResetWin8PromptKeys} "HKU" "$1\" |
|
1006 ${EndIf} |
|
1007 IntOp $0 $0 + 1 |
|
1008 ${Loop} |
|
1009 ${UnmountRegistryIntoHKU} |
|
1010 |
|
1011 ; The removal of this key intermittently fails, so do the best we can in cleanup |
|
1012 ${If} "${APP_USER_MODEL_ID}" != "" |
|
1013 DeleteRegValue HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" |
|
1014 DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" |
|
1015 DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" |
|
1016 DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}\.exe" |
|
1017 DeleteRegKey HKLM "Software\Classes\${APP_USER_MODEL_ID}" |
|
1018 ${EndIf} |
|
1019 |
|
1020 ; Remove HKLM entries |
|
1021 DeleteRegKey HKLM "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" |
|
1022 DeleteRegKey HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" |
|
1023 DeleteRegKey HKLM "Software\Classes\${FILE_ACTIVATION_ID}\Application" |
|
1024 DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" |
|
1025 DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" |
|
1026 DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" |
|
1027 DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" |
|
1028 DeleteRegValue HKLM "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" |
|
1029 DeleteRegValue HKLM "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" |
|
1030 |
|
1031 ClearErrors |
|
1032 !macroend |
|
1033 |
|
1034 !define RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" |
|
1035 !define un.RemoveDEHRegistration "!insertmacro RemoveDEHRegistration" |
|
1036 |
|
1037 ; Removes various directories and files for reasons noted below. |
|
1038 !macro RemoveDeprecatedFiles |
|
1039 ; Some users are ending up with unpacked chrome instead of omni.ja. This |
|
1040 ; causes Firefox to break badly after upgrading from Firefox 31, see bug |
|
1041 ; 1063052. Removing the chrome.manifest from the install directory causes |
|
1042 ; Firefox to use the updated omni.ja so it won't crash. |
|
1043 ${If} ${FileExists} "$INSTDIR\chrome.manifest" |
|
1044 Delete "$INSTDIR\chrome.manifest" |
|
1045 ${EndIf} |
|
1046 |
|
1047 ; Remove talkback if it is present (remove after bug 386760 is fixed) |
|
1048 ${If} ${FileExists} "$INSTDIR\extensions\talkback@mozilla.org" |
|
1049 RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org" |
|
1050 ${EndIf} |
|
1051 |
|
1052 ; Remove the Java Console extension (bug 597235) |
|
1053 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" |
|
1054 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}" |
|
1055 ${EndIf} |
|
1056 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" |
|
1057 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}" |
|
1058 ${EndIf} |
|
1059 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" |
|
1060 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}" |
|
1061 ${EndIf} |
|
1062 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" |
|
1063 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}" |
|
1064 ${EndIf} |
|
1065 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" |
|
1066 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}" |
|
1067 ${EndIf} |
|
1068 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" |
|
1069 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}" |
|
1070 ${EndIf} |
|
1071 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" |
|
1072 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}" |
|
1073 ${EndIf} |
|
1074 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" |
|
1075 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}" |
|
1076 ${EndIf} |
|
1077 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" |
|
1078 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}" |
|
1079 ${EndIf} |
|
1080 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" |
|
1081 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}" |
|
1082 ${EndIf} |
|
1083 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" |
|
1084 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}" |
|
1085 ${EndIf} |
|
1086 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" |
|
1087 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}" |
|
1088 ${EndIf} |
|
1089 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" |
|
1090 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}" |
|
1091 ${EndIf} |
|
1092 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" |
|
1093 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}" |
|
1094 ${EndIf} |
|
1095 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" |
|
1096 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}" |
|
1097 ${EndIf} |
|
1098 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" |
|
1099 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}" |
|
1100 ${EndIf} |
|
1101 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" |
|
1102 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}" |
|
1103 ${EndIf} |
|
1104 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" |
|
1105 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}" |
|
1106 ${EndIf} |
|
1107 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" |
|
1108 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}" |
|
1109 ${EndIf} |
|
1110 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" |
|
1111 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}" |
|
1112 ${EndIf} |
|
1113 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" |
|
1114 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}" |
|
1115 ${EndIf} |
|
1116 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" |
|
1117 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}" |
|
1118 ${EndIf} |
|
1119 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" |
|
1120 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}" |
|
1121 ${EndIf} |
|
1122 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" |
|
1123 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}" |
|
1124 ${EndIf} |
|
1125 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" |
|
1126 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}" |
|
1127 ${EndIf} |
|
1128 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" |
|
1129 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}" |
|
1130 ${EndIf} |
|
1131 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" |
|
1132 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}" |
|
1133 ${EndIf} |
|
1134 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" |
|
1135 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" |
|
1136 ${EndIf} |
|
1137 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" |
|
1138 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}" |
|
1139 ${EndIf} |
|
1140 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" |
|
1141 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}" |
|
1142 ${EndIf} |
|
1143 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" |
|
1144 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}" |
|
1145 ${EndIf} |
|
1146 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" |
|
1147 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}" |
|
1148 ${EndIf} |
|
1149 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" |
|
1150 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}" |
|
1151 ${EndIf} |
|
1152 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" |
|
1153 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}" |
|
1154 ${EndIf} |
|
1155 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" |
|
1156 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}" |
|
1157 ${EndIf} |
|
1158 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" |
|
1159 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}" |
|
1160 ${EndIf} |
|
1161 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" |
|
1162 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}" |
|
1163 ${EndIf} |
|
1164 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" |
|
1165 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}" |
|
1166 ${EndIf} |
|
1167 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" |
|
1168 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}" |
|
1169 ${EndIf} |
|
1170 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" |
|
1171 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}" |
|
1172 ${EndIf} |
|
1173 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" |
|
1174 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}" |
|
1175 ${EndIf} |
|
1176 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" |
|
1177 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}" |
|
1178 ${EndIf} |
|
1179 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" |
|
1180 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}" |
|
1181 ${EndIf} |
|
1182 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" |
|
1183 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}" |
|
1184 ${EndIf} |
|
1185 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" |
|
1186 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}" |
|
1187 ${EndIf} |
|
1188 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" |
|
1189 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}" |
|
1190 ${EndIf} |
|
1191 ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" |
|
1192 RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}" |
|
1193 ${EndIf} |
|
1194 !macroend |
|
1195 !define RemoveDeprecatedFiles "!insertmacro RemoveDeprecatedFiles" |
|
1196 |
|
1197 ; Converts specific partner distribution.ini from ansi to utf-8 (bug 882989) |
|
1198 !macro FixDistributionsINI |
|
1199 StrCpy $1 "$INSTDIR\distribution\distribution.ini" |
|
1200 StrCpy $2 "$INSTDIR\distribution\utf8fix" |
|
1201 StrCpy $0 "0" ; Default to not attempting to fix |
|
1202 |
|
1203 ; Check if the distribution.ini settings are for a partner build that needs |
|
1204 ; to have its distribution.ini converted from ansi to utf-8. |
|
1205 ${If} ${FileExists} "$1" |
|
1206 ${Unless} ${FileExists} "$2" |
|
1207 ReadINIStr $3 "$1" "Preferences" "app.distributor" |
|
1208 ${If} "$3" == "yahoo" |
|
1209 ReadINIStr $3 "$1" "Preferences" "app.distributor.channel" |
|
1210 ${If} "$3" == "de" |
|
1211 ${OrIf} "$3" == "es" |
|
1212 ${OrIf} "$3" == "e1" |
|
1213 ${OrIf} "$3" == "mx" |
|
1214 StrCpy $0 "1" |
|
1215 ${EndIf} |
|
1216 ${EndIf} |
|
1217 ; Create the utf8fix so this only runs once |
|
1218 FileOpen $3 "$2" w |
|
1219 FileClose $3 |
|
1220 ${EndUnless} |
|
1221 ${EndIf} |
|
1222 |
|
1223 ${If} "$0" == "1" |
|
1224 StrCpy $0 "0" |
|
1225 ClearErrors |
|
1226 ReadINIStr $3 "$1" "Global" "version" |
|
1227 ${Unless} ${Errors} |
|
1228 StrCpy $4 "$3" 2 |
|
1229 ${If} "$4" == "1." |
|
1230 StrCpy $4 "$3" "" 2 ; Everything after "1." |
|
1231 ${If} $4 < 23 |
|
1232 StrCpy $0 "1" |
|
1233 ${EndIf} |
|
1234 ${EndIf} |
|
1235 ${EndUnless} |
|
1236 ${EndIf} |
|
1237 |
|
1238 ${If} "$0" == "1" |
|
1239 ClearErrors |
|
1240 FileOpen $3 "$1" r |
|
1241 ${If} ${Errors} |
|
1242 FileClose $3 |
|
1243 ${Else} |
|
1244 StrCpy $2 "$INSTDIR\distribution\distribution.new" |
|
1245 ClearErrors |
|
1246 FileOpen $4 "$2" w |
|
1247 ${If} ${Errors} |
|
1248 FileClose $3 |
|
1249 FileClose $4 |
|
1250 ${Else} |
|
1251 StrCpy $0 "0" ; Default to not replacing the original distribution.ini |
|
1252 ${Do} |
|
1253 FileReadByte $3 $5 |
|
1254 ${If} $5 == "" |
|
1255 ${Break} |
|
1256 ${EndIf} |
|
1257 ${If} $5 == 233 ; ansi é |
|
1258 StrCpy $0 "1" |
|
1259 FileWriteByte $4 195 |
|
1260 FileWriteByte $4 169 |
|
1261 ${ElseIf} $5 == 241 ; ansi ñ |
|
1262 StrCpy $0 "1" |
|
1263 FileWriteByte $4 195 |
|
1264 FileWriteByte $4 177 |
|
1265 ${ElseIf} $5 == 252 ; ansi ü |
|
1266 StrCpy $0 "1" |
|
1267 FileWriteByte $4 195 |
|
1268 FileWriteByte $4 188 |
|
1269 ${ElseIf} $5 < 128 |
|
1270 FileWriteByte $4 $5 |
|
1271 ${EndIf} |
|
1272 ${Loop} |
|
1273 FileClose $3 |
|
1274 FileClose $4 |
|
1275 ${If} "$0" == "1" |
|
1276 ClearErrors |
|
1277 Rename "$1" "$1.bak" |
|
1278 ${Unless} ${Errors} |
|
1279 Rename "$2" "$1" |
|
1280 Delete "$1.bak" |
|
1281 ${EndUnless} |
|
1282 ${Else} |
|
1283 Delete "$2" |
|
1284 ${EndIf} |
|
1285 ${EndIf} |
|
1286 ${EndIf} |
|
1287 ${EndIf} |
|
1288 !macroend |
|
1289 !define FixDistributionsINI "!insertmacro FixDistributionsINI" |
|
1290 |
|
1291 ; Adds a pinned shortcut to Task Bar on update for Windows 7 and above if this |
|
1292 ; macro has never been called before and the application is default (see |
|
1293 ; PinToTaskBar for more details). |
|
1294 ; Since defaults handling is handled by Windows in Win8 and later, we always |
|
1295 ; attempt to pin a taskbar on that OS. If Windows sets the defaults at |
|
1296 ; installation time, then we don't get the opportunity to run this code at |
|
1297 ; that time. |
|
1298 !macro MigrateTaskBarShortcut |
|
1299 ${GetShortcutsLogPath} $0 |
|
1300 ${If} ${FileExists} "$0" |
|
1301 ClearErrors |
|
1302 ReadINIStr $1 "$0" "TASKBAR" "Migrated" |
|
1303 ${If} ${Errors} |
|
1304 ClearErrors |
|
1305 WriteIniStr "$0" "TASKBAR" "Migrated" "true" |
|
1306 ${If} ${AtLeastWin7} |
|
1307 ; No need to check the default on Win8 and later |
|
1308 ${If} ${AtMostWin2008R2} |
|
1309 ; Check if the Firefox is the http handler for this user |
|
1310 SetShellVarContext current ; Set SHCTX to the current user |
|
1311 ${IsHandlerForInstallDir} "http" $R9 |
|
1312 ${If} $TmpVal == "HKLM" |
|
1313 SetShellVarContext all ; Set SHCTX to all users |
|
1314 ${EndIf} |
|
1315 ${EndIf} |
|
1316 ${If} "$R9" == "true" |
|
1317 ${OrIf} ${AtLeastWin8} |
|
1318 ${PinToTaskBar} |
|
1319 ${EndIf} |
|
1320 ${EndIf} |
|
1321 ${EndIf} |
|
1322 ${EndIf} |
|
1323 !macroend |
|
1324 !define MigrateTaskBarShortcut "!insertmacro MigrateTaskBarShortcut" |
|
1325 |
|
1326 ; Adds a pinned Task Bar shortcut on Windows 7 if there isn't one for the main |
|
1327 ; application executable already. Existing pinned shortcuts for the same |
|
1328 ; application model ID must be removed first to prevent breaking the pinned |
|
1329 ; item's lists but multiple installations with the same application model ID is |
|
1330 ; an edgecase. If removing existing pinned shortcuts with the same application |
|
1331 ; model ID removes a pinned pinned Start Menu shortcut this will also add a |
|
1332 ; pinned Start Menu shortcut. |
|
1333 !macro PinToTaskBar |
|
1334 ${If} ${AtLeastWin7} |
|
1335 StrCpy $8 "false" ; Whether a shortcut had to be created |
|
1336 ${IsPinnedToTaskBar} "$INSTDIR\${FileMainEXE}" $R9 |
|
1337 ${If} "$R9" == "false" |
|
1338 ; Find an existing Start Menu shortcut or create one to use for pinning |
|
1339 ${GetShortcutsLogPath} $0 |
|
1340 ${If} ${FileExists} "$0" |
|
1341 ClearErrors |
|
1342 ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" |
|
1343 ${Unless} ${Errors} |
|
1344 SetShellVarContext all ; Set SHCTX to all users |
|
1345 ${Unless} ${FileExists} "$SMPROGRAMS\$1" |
|
1346 SetShellVarContext current ; Set SHCTX to the current user |
|
1347 ${Unless} ${FileExists} "$SMPROGRAMS\$1" |
|
1348 StrCpy $8 "true" |
|
1349 CreateShortCut "$SMPROGRAMS\$1" "$INSTDIR\${FileMainEXE}" |
|
1350 ${If} ${FileExists} "$SMPROGRAMS\$1" |
|
1351 ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \ |
|
1352 "$INSTDIR" |
|
1353 ${If} "$AppUserModelID" != "" |
|
1354 ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" "true" |
|
1355 ${EndIf} |
|
1356 ${EndIf} |
|
1357 ${EndUnless} |
|
1358 ${EndUnless} |
|
1359 |
|
1360 ${If} ${FileExists} "$SMPROGRAMS\$1" |
|
1361 ; Count of Start Menu pinned shortcuts before unpinning. |
|
1362 ${PinnedToStartMenuLnkCount} $R9 |
|
1363 |
|
1364 ; Having multiple shortcuts pointing to different installations with |
|
1365 ; the same AppUserModelID (e.g. side by side installations of the |
|
1366 ; same version) will make the TaskBar shortcut's lists into an bad |
|
1367 ; state where the lists are not shown. To prevent this first |
|
1368 ; uninstall the pinned item. |
|
1369 ApplicationID::UninstallPinnedItem "$SMPROGRAMS\$1" |
|
1370 |
|
1371 ; Count of Start Menu pinned shortcuts after unpinning. |
|
1372 ${PinnedToStartMenuLnkCount} $R8 |
|
1373 |
|
1374 ; If there is a change in the number of Start Menu pinned shortcuts |
|
1375 ; assume that unpinning unpinned a side by side installation from |
|
1376 ; the Start Menu and pin this installation to the Start Menu. |
|
1377 ${Unless} $R8 == $R9 |
|
1378 ; Pin the shortcut to the Start Menu. 5381 is the shell32.dll |
|
1379 ; resource id for the "Pin to Start Menu" string. |
|
1380 InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5381" |
|
1381 ${EndUnless} |
|
1382 |
|
1383 ; Pin the shortcut to the TaskBar. 5386 is the shell32.dll resource |
|
1384 ; id for the "Pin to Taskbar" string. |
|
1385 InvokeShellVerb::DoIt "$SMPROGRAMS" "$1" "5386" |
|
1386 |
|
1387 ; Delete the shortcut if it was created |
|
1388 ${If} "$8" == "true" |
|
1389 Delete "$SMPROGRAMS\$1" |
|
1390 ${EndIf} |
|
1391 ${EndIf} |
|
1392 |
|
1393 ${If} $TmpVal == "HKCU" |
|
1394 SetShellVarContext current ; Set SHCTX to the current user |
|
1395 ${Else} |
|
1396 SetShellVarContext all ; Set SHCTX to all users |
|
1397 ${EndIf} |
|
1398 ${EndUnless} |
|
1399 ${EndIf} |
|
1400 ${EndIf} |
|
1401 ${EndIf} |
|
1402 !macroend |
|
1403 !define PinToTaskBar "!insertmacro PinToTaskBar" |
|
1404 |
|
1405 ; Adds a shortcut to the root of the Start Menu Programs directory if the |
|
1406 ; application's Start Menu Programs directory exists with a shortcut pointing to |
|
1407 ; this installation directory. This will also remove the old shortcuts and the |
|
1408 ; application's Start Menu Programs directory by calling the RemoveStartMenuDir |
|
1409 ; macro. |
|
1410 !macro MigrateStartMenuShortcut |
|
1411 ${GetShortcutsLogPath} $0 |
|
1412 ${If} ${FileExists} "$0" |
|
1413 ClearErrors |
|
1414 ReadINIStr $5 "$0" "SMPROGRAMS" "RelativePathToDir" |
|
1415 ${Unless} ${Errors} |
|
1416 ClearErrors |
|
1417 ReadINIStr $1 "$0" "STARTMENU" "Shortcut0" |
|
1418 ${If} ${Errors} |
|
1419 ; The STARTMENU ini section doesn't exist. |
|
1420 ${LogStartMenuShortcut} "${BrandFullName}.lnk" |
|
1421 ${GetLongPath} "$SMPROGRAMS" $2 |
|
1422 ${GetLongPath} "$2\$5" $1 |
|
1423 ${If} "$1" != "" |
|
1424 ClearErrors |
|
1425 ReadINIStr $3 "$0" "SMPROGRAMS" "Shortcut0" |
|
1426 ${Unless} ${Errors} |
|
1427 ${If} ${FileExists} "$1\$3" |
|
1428 ShellLink::GetShortCutTarget "$1\$3" |
|
1429 Pop $4 |
|
1430 ${If} "$INSTDIR\${FileMainEXE}" == "$4" |
|
1431 CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
1432 "$INSTDIR\${FileMainEXE}" |
|
1433 ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" |
|
1434 ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
1435 "$INSTDIR" |
|
1436 ${If} ${AtLeastWin7} |
|
1437 ${AndIf} "$AppUserModelID" != "" |
|
1438 ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" \ |
|
1439 "$AppUserModelID" "true" |
|
1440 ${EndIf} |
|
1441 ${EndIf} |
|
1442 ${EndIf} |
|
1443 ${EndIf} |
|
1444 ${EndUnless} |
|
1445 ${EndIf} |
|
1446 ${EndIf} |
|
1447 ; Remove the application's Start Menu Programs directory, shortcuts, and |
|
1448 ; ini section. |
|
1449 ${RemoveStartMenuDir} |
|
1450 ${EndUnless} |
|
1451 ${EndIf} |
|
1452 !macroend |
|
1453 !define MigrateStartMenuShortcut "!insertmacro MigrateStartMenuShortcut" |
|
1454 |
|
1455 ; Removes the application's start menu directory along with its shortcuts if |
|
1456 ; they exist and if they exist creates a start menu shortcut in the root of the |
|
1457 ; start menu directory (bug 598779). If the application's start menu directory |
|
1458 ; is not empty after removing the shortucts the directory will not be removed |
|
1459 ; since these additional items were not created by the installer (uses SHCTX). |
|
1460 !macro RemoveStartMenuDir |
|
1461 ${GetShortcutsLogPath} $0 |
|
1462 ${If} ${FileExists} "$0" |
|
1463 ; Delete Start Menu Programs shortcuts, directory if it is empty, and |
|
1464 ; parent directories if they are empty up to but not including the start |
|
1465 ; menu directory. |
|
1466 ${GetLongPath} "$SMPROGRAMS" $1 |
|
1467 ClearErrors |
|
1468 ReadINIStr $2 "$0" "SMPROGRAMS" "RelativePathToDir" |
|
1469 ${Unless} ${Errors} |
|
1470 ${GetLongPath} "$1\$2" $2 |
|
1471 ${If} "$2" != "" |
|
1472 ; Delete shortucts in the Start Menu Programs directory. |
|
1473 StrCpy $3 0 |
|
1474 ${Do} |
|
1475 ClearErrors |
|
1476 ReadINIStr $4 "$0" "SMPROGRAMS" "Shortcut$3" |
|
1477 ; Stop if there are no more entries |
|
1478 ${If} ${Errors} |
|
1479 ${ExitDo} |
|
1480 ${EndIf} |
|
1481 ${If} ${FileExists} "$2\$4" |
|
1482 ShellLink::GetShortCutTarget "$2\$4" |
|
1483 Pop $5 |
|
1484 ${If} "$INSTDIR\${FileMainEXE}" == "$5" |
|
1485 Delete "$2\$4" |
|
1486 ${EndIf} |
|
1487 ${EndIf} |
|
1488 IntOp $3 $3 + 1 ; Increment the counter |
|
1489 ${Loop} |
|
1490 ; Delete Start Menu Programs directory and parent directories |
|
1491 ${Do} |
|
1492 ; Stop if the current directory is the start menu directory |
|
1493 ${If} "$1" == "$2" |
|
1494 ${ExitDo} |
|
1495 ${EndIf} |
|
1496 ClearErrors |
|
1497 RmDir "$2" |
|
1498 ; Stop if removing the directory failed |
|
1499 ${If} ${Errors} |
|
1500 ${ExitDo} |
|
1501 ${EndIf} |
|
1502 ${GetParent} "$2" $2 |
|
1503 ${Loop} |
|
1504 ${EndIf} |
|
1505 DeleteINISec "$0" "SMPROGRAMS" |
|
1506 ${EndUnless} |
|
1507 ${EndIf} |
|
1508 !macroend |
|
1509 !define RemoveStartMenuDir "!insertmacro RemoveStartMenuDir" |
|
1510 |
|
1511 ; Creates the shortcuts log ini file with the appropriate entries if it doesn't |
|
1512 ; already exist. |
|
1513 !macro CreateShortcutsLog |
|
1514 ${GetShortcutsLogPath} $0 |
|
1515 ${Unless} ${FileExists} "$0" |
|
1516 ${LogStartMenuShortcut} "${BrandFullName}.lnk" |
|
1517 ${LogQuickLaunchShortcut} "${BrandFullName}.lnk" |
|
1518 ${LogDesktopShortcut} "${BrandFullName}.lnk" |
|
1519 ${EndUnless} |
|
1520 !macroend |
|
1521 !define CreateShortcutsLog "!insertmacro CreateShortcutsLog" |
|
1522 |
|
1523 ; The files to check if they are in use during (un)install so the restart is |
|
1524 ; required message is displayed. All files must be located in the $INSTDIR |
|
1525 ; directory. |
|
1526 !macro PushFilesToCheck |
|
1527 ; The first string to be pushed onto the stack MUST be "end" to indicate |
|
1528 ; that there are no more files to check in $INSTDIR and the last string |
|
1529 ; should be ${FileMainEXE} so if it is in use the CheckForFilesInUse macro |
|
1530 ; returns after the first check. |
|
1531 Push "end" |
|
1532 Push "AccessibleMarshal.dll" |
|
1533 Push "freebl3.dll" |
|
1534 Push "nssckbi.dll" |
|
1535 Push "nspr4.dll" |
|
1536 Push "nssdbm3.dll" |
|
1537 Push "mozsqlite3.dll" |
|
1538 !ifdef MOZ_CONTENT_SANDBOX |
|
1539 Push "sandboxbroker.dll" |
|
1540 !endif |
|
1541 Push "xpcom.dll" |
|
1542 Push "crashreporter.exe" |
|
1543 Push "updater.exe" |
|
1544 Push "${FileMainEXE}" |
|
1545 !macroend |
|
1546 !define PushFilesToCheck "!insertmacro PushFilesToCheck" |
|
1547 |
|
1548 ; Sets this installation as the default browser by setting the registry keys |
|
1549 ; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS |
|
1550 ; plugin for Vista and above. This is a function instead of a macro so it is |
|
1551 ; easily called from an elevated instance of the binary. Since this can be |
|
1552 ; called by an elevated instance logging is not performed in this function. |
|
1553 Function SetAsDefaultAppUserHKCU |
|
1554 ; Only set as the user's StartMenuInternet browser if the StartMenuInternet |
|
1555 ; registry keys are for this install. |
|
1556 ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
|
1557 ClearErrors |
|
1558 ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" |
|
1559 ${If} ${Errors} |
|
1560 ${OrIf} ${AtMostWin2008R2} |
|
1561 ClearErrors |
|
1562 ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" |
|
1563 ${EndIf} |
|
1564 ${Unless} ${Errors} |
|
1565 ${GetPathFromString} "$0" $0 |
|
1566 ${GetParent} "$0" $0 |
|
1567 ${If} ${FileExists} "$0" |
|
1568 ${GetLongPath} "$0" $0 |
|
1569 ${If} "$0" == "$INSTDIR" |
|
1570 WriteRegStr HKCU "Software\Clients\StartMenuInternet" "" "$R9" |
|
1571 ${EndIf} |
|
1572 ${EndIf} |
|
1573 ${EndUnless} |
|
1574 |
|
1575 SetShellVarContext current ; Set SHCTX to the current user (e.g. HKCU) |
|
1576 |
|
1577 ${If} ${AtLeastWin8} |
|
1578 ${SetStartMenuInternet} "HKCU" |
|
1579 ${FixShellIconHandler} "HKCU" |
|
1580 ${FixClassKeys} ; Does not use SHCTX |
|
1581 Call RegisterStartMenuTile |
|
1582 ${EndIf} |
|
1583 |
|
1584 ${SetHandlers} |
|
1585 |
|
1586 ${If} ${AtLeastWinVista} |
|
1587 ; Only register as the handler on Vista and above if the app registry name |
|
1588 ; exists under the RegisteredApplications registry key. The protocol and |
|
1589 ; file handlers set previously at the user level will associate this install |
|
1590 ; as the default browser. |
|
1591 ClearErrors |
|
1592 ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}" |
|
1593 ${Unless} ${Errors} |
|
1594 ; This is all protected by a user choice hash in Windows 8 so it won't |
|
1595 ; help, but it also won't hurt. |
|
1596 AppAssocReg::SetAppAsDefaultAll "${AppRegName}" |
|
1597 ${EndUnless} |
|
1598 ${EndIf} |
|
1599 ${RemoveDeprecatedKeys} |
|
1600 ${PinToTaskBar} |
|
1601 FunctionEnd |
|
1602 |
|
1603 ; Helper for updating the shortcut application model IDs. |
|
1604 Function FixShortcutAppModelIDs |
|
1605 ${If} ${AtLeastWin7} |
|
1606 ${AndIf} "$AppUserModelID" != "" |
|
1607 ${UpdateShortcutAppModelIDs} "$INSTDIR\${FileMainEXE}" "$AppUserModelID" $0 |
|
1608 ${EndIf} |
|
1609 FunctionEnd |
|
1610 |
|
1611 ; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to |
|
1612 ; this function only being used by the uninstaller.nsi. |
|
1613 !ifdef NO_LOG |
|
1614 |
|
1615 Function SetAsDefaultAppUser |
|
1616 ; On Win8, we want to avoid having a UAC prompt since we'll already have |
|
1617 ; another action for control panel default browser selection popping up |
|
1618 ; to the user. Win8 is the first OS where the start menu keys can be |
|
1619 ; added into HKCU. The call to SetAsDefaultAppUserHKCU will have already |
|
1620 ; set the HKCU keys for SetStartMenuInternet. |
|
1621 ${If} ${AtLeastWin8} |
|
1622 ; Check if this is running in an elevated process |
|
1623 ClearErrors |
|
1624 ${GetParameters} $0 |
|
1625 ${GetOptions} "$0" "/UAC:" $0 |
|
1626 ${If} ${Errors} ; Not elevated |
|
1627 Call SetAsDefaultAppUserHKCU |
|
1628 ${Else} ; Elevated - execute the function in the unelevated process |
|
1629 GetFunctionAddress $0 SetAsDefaultAppUserHKCU |
|
1630 UAC::ExecCodeSegment $0 |
|
1631 ${EndIf} |
|
1632 Return ; Nothing more needs to be done |
|
1633 ${EndIf} |
|
1634 |
|
1635 ; Before Win8, it is only possible to set this installation of the application |
|
1636 ; as the StartMenuInternet handler if it was added to the HKLM |
|
1637 ; StartMenuInternet registry keys. |
|
1638 ; http://support.microsoft.com/kb/297878 |
|
1639 |
|
1640 ; Check if this install location registered as the StartMenuInternet client |
|
1641 ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 |
|
1642 ClearErrors |
|
1643 ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" |
|
1644 ${If} ${Errors} |
|
1645 ${OrIf} ${AtMostWin2008R2} |
|
1646 ClearErrors |
|
1647 ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" |
|
1648 ${EndIf} |
|
1649 |
|
1650 ${Unless} ${Errors} |
|
1651 ${GetPathFromString} "$0" $0 |
|
1652 ${GetParent} "$0" $0 |
|
1653 ${If} ${FileExists} "$0" |
|
1654 ${GetLongPath} "$0" $0 |
|
1655 ${If} "$0" == "$INSTDIR" |
|
1656 ; Check if this is running in an elevated process |
|
1657 ClearErrors |
|
1658 ${GetParameters} $0 |
|
1659 ${GetOptions} "$0" "/UAC:" $0 |
|
1660 ${If} ${Errors} ; Not elevated |
|
1661 Call SetAsDefaultAppUserHKCU |
|
1662 ${Else} ; Elevated - execute the function in the unelevated process |
|
1663 GetFunctionAddress $0 SetAsDefaultAppUserHKCU |
|
1664 UAC::ExecCodeSegment $0 |
|
1665 ${EndIf} |
|
1666 Return ; Nothing more needs to be done |
|
1667 ${EndIf} |
|
1668 ${EndIf} |
|
1669 ${EndUnless} |
|
1670 |
|
1671 ; The code after ElevateUAC won't be executed on Vista and above when the |
|
1672 ; user: |
|
1673 ; a) is a member of the administrators group (e.g. elevation is required) |
|
1674 ; b) is not a member of the administrators group and chooses to elevate |
|
1675 ${ElevateUAC} |
|
1676 |
|
1677 ${SetStartMenuInternet} "HKLM" |
|
1678 |
|
1679 SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) |
|
1680 |
|
1681 ${FixClassKeys} ; Does not use SHCTX |
|
1682 ${FixShellIconHandler} "HKLM" |
|
1683 ${RemoveDeprecatedKeys} ; Does not use SHCTX |
|
1684 |
|
1685 ClearErrors |
|
1686 ${GetParameters} $0 |
|
1687 ${GetOptions} "$0" "/UAC:" $0 |
|
1688 ${If} ${Errors} |
|
1689 Call SetAsDefaultAppUserHKCU |
|
1690 ${Else} |
|
1691 GetFunctionAddress $0 SetAsDefaultAppUserHKCU |
|
1692 UAC::ExecCodeSegment $0 |
|
1693 ${EndIf} |
|
1694 FunctionEnd |
|
1695 !define SetAsDefaultAppUser "Call SetAsDefaultAppUser" |
|
1696 |
|
1697 !endif ; NO_LOG |