Bug 523410 - Disable LSPs in WinSock that don't have categories for Firefox on Windows Vista and above. r=khuey, a=blocking2.0-beta4

This commit is contained in:
Robert Strong 2010-08-12 21:09:06 -07:00
Родитель 80918e85ab
Коммит 78b9cbb35c
5 изменённых файлов: 159 добавлений и 14 удалений

Просмотреть файл

@ -22,6 +22,14 @@
!define PreReleaseSuffix "@PRE_RELEASE_SUFFIX@"
!define BrandFullName "${BrandFullNameInternal}${PreReleaseSuffix}"
# LSP_CATEGORIES is the permitted LSP categories for the application. Each LSP
# category value is ANDed together to set multiple permitted categories.
# See http://msdn.microsoft.com/en-us/library/ms742253%28VS.85%29.aspx
# The value below permits the LSP_INSPECTOR, LSP_REDIRECTOR, LSP_PROXY,
# LSP_FIREWALL, LSP_INBOUND_MODIFY, LSP_OUTBOUND_MODIFY, LSP_CRYPTO_COMPRESS,
# and LSP_LOCAL_CACHE LSP categories.
!define LSP_CATEGORIES "0x000000ff"
# NO_INSTDIR_FROM_REG is defined for pre-releases which have a PreReleaseSuffix
# (e.g. Alpha X, Beta X, etc.) to prevent finding a non-default installation
# directory in the registry and using that as the default. This prevents

Просмотреть файл

@ -113,6 +113,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
!insertmacro RegCleanAppHandler
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
!insertmacro SetAppLSPCategories
!insertmacro SetBrandNameVars
!insertmacro UpdateShortcutAppModelIDs
!insertmacro UnloadUAC
@ -374,7 +375,6 @@ Section "-Application" APP_IDX
${If} $TmpVal == "HKLM"
; Set the Start Menu Internet and Vista Registered App HKLM registry keys.
${SetStartMenuInternet}
${FixShellIconHandler}
; If we are writing to HKLM and create the quick launch and the desktop
@ -398,6 +398,11 @@ Section "-Application" APP_IDX
StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9"
${CreateRegKey} "$TmpVal" "$0" 0
${If} $TmpVal == "HKLM"
; Set the permitted LSP Categories for WinVista and above
${SetAppLSPCategories} ${LSP_CATEGORIES}
${EndIf}
; Create shortcuts
${LogHeader} "Adding Shortcuts"

Просмотреть файл

@ -57,6 +57,7 @@
${RegCleanUninstall}
${UpdateProtocolHandlers}
${FixShellIconHandler}
${SetAppLSPCategories} ${LSP_CATEGORIES}
; Only update the Clients\StartMenuInternet registry key values if they
; don't exist or this installation is the same as the one set in those keys.

Просмотреть файл

@ -100,6 +100,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro RegCleanAppHandler
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
!insertmacro SetAppLSPCategories
!insertmacro SetBrandNameVars
!insertmacro UpdateShortcutAppModelIDs
!insertmacro UnloadUAC
@ -122,6 +123,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro un.RegCleanUninstall
!insertmacro un.RegCleanProtocolHandler
!insertmacro un.RemoveQuotesFromPath
!insertmacro un.SetAppLSPCategories
!insertmacro un.SetBrandNameVars
!include shared.nsh
@ -240,6 +242,7 @@ Section "Uninstall"
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
${un.DeleteShortcuts}
${un.SetAppLSPCategories}
${EndIf}
${un.RegCleanAppHandler} "FirefoxURL"

Просмотреть файл

@ -782,11 +782,11 @@
!ifndef NO_LOG
IfErrors 0 +3
FileWriteUTF16LE $fhInstallLog " ** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **$\r$\n"
${LogMsg} "** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **"
GoTo +4
StrCmp "$R9" "1" +1 +2
FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
FileWriteUTF16LE $fhInstallLog " Added Registry String: $R5 | $R6 | $R7 | $R8$\r$\n"
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
${LogMsg} "Added Registry String: $R5 | $R6 | $R7 | $R8"
!endif
Exch $R5
@ -890,11 +890,11 @@
!ifndef NO_LOG
IfErrors 0 +3
FileWriteUTF16LE $fhInstallLog " ** ERROR Adding Registry DWord: $R5 | $R6 | $R7 | $R8 **$\r$\n"
${LogMsg} "** ERROR Adding Registry DWord: $R5 | $R6 | $R7 | $R8 **"
GoTo +4
StrCmp "$R9" "1" +1 +2
FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
FileWriteUTF16LE $fhInstallLog " Added Registry DWord: $R5 | $R6 | $R7 | $R8$\r$\n"
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
${LogMsg} "Added Registry DWord: $R5 | $R6 | $R7 | $R8"
!endif
Exch $R5
@ -998,11 +998,11 @@
!ifndef NO_LOG
IfErrors 0 +3
FileWriteUTF16LE $fhInstallLog " ** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **$\r$\n"
${LogMsg} "** ERROR Adding Registry String: $R5 | $R6 | $R7 | $R8 **"
GoTo +4
StrCmp "$R9" "1" +1 +2
FileWrite $fhUninstallLog "RegVal: $R5 | $R6 | $R7$\r$\n"
FileWriteUTF16LE $fhInstallLog " Added Registry String: $R5 | $R6 | $R7 | $R8$\r$\n"
${LogUninstall} "RegVal: $R5 | $R6 | $R7"
${LogMsg} "Added Registry String: $R5 | $R6 | $R7 | $R8"
!endif
Exch $R5
@ -1124,11 +1124,11 @@
!ifndef NO_LOG
; if $R5 is not 0 then there was an error creating the registry key.
IntCmp $R5 0 +3 +3
FileWriteUTF16LE $fhInstallLog " ** ERROR Adding Registry Key: $R7 | $R8 **$\r$\n"
${LogMsg} "** ERROR Adding Registry Key: $R7 | $R8 **"
GoTo +4
StrCmp "$R9" "1" +1 +2
FileWrite $fhUninstallLog "RegKey: $R7 | $R8$\r$\n"
FileWriteUTF16LE $fhInstallLog " Added Registry Key: $R7 | $R8$\r$\n"
${LogUninstall} "RegKey: $R7 | $R8"
${LogMsg} "Added Registry Key: $R7 | $R8"
!endif
Pop $R4
@ -5317,6 +5317,20 @@
${LogMsg} "App Version: $R8"
${LogMsg} "GRE Version: $R9"
${If} ${IsWin2000}
${LogMsg} "OS Name : Windows 2000"
${ElseIf} ${IsWinXP}
${LogMsg} "OS Name : Windows XP"
${ElseIf} ${IsWin2003}
${LogMsg} "OS Name : Windows 2003"
${ElseIf} ${IsWinVista}
${LogMsg} "OS Name : Windows Vista"
${ElseIf} ${AtLeastWinVista} ; Workaround for NSIS 2.33 WinVer.nsh not knowing Win7
${LogMsg} "OS Name : Windows 7 or above"
${Else}
${LogMsg} "OS Name : Unable to detect"
${EndIf}
Pop $9
Pop $R0
Pop $R1
@ -5774,7 +5788,121 @@
!define DeleteShortcutsLogFile "!insertmacro DeleteShortcutsLogFile"
################################################################################
# Macros for managing Win7 install features
# Macros for managing specific Windows version features
/**
* Sets the permitted layered service provider (LSP) categories on Windows
* Vista and above for the application. Consumers should call this after an
* installation log section has completed since this macro will log the results
* to the installation log along with a header.
*
* !IMPORTANT - When calling this macro from an uninstaller do not specify a
* parameter. The paramter is hardcoded with 0x00000000 to remove
* the LSP category for the application when performing an
* uninstall.
*
* @param _LSP_CATEGORIES
* The permitted LSP categories for the application. When called by an
* uninstaller this will always be 0x00000000.
*
* $R5 = error code popped from the stack for the WSCSetApplicationCategory call
* $R6 = return value from the WSCSetApplicationCategory call
* $R7 = string length for the long path to the main application executable
* $R8 = long path to the main application executable
* $R9 = _LSP_CATEGORIES
*/
!macro SetAppLSPCategories
!ifndef ${_MOZFUNC_UN}SetAppLSPCategories
!define _MOZFUNC_UN_TMP ${_MOZFUNC_UN}
!insertmacro ${_MOZFUNC_UN_TMP}GetLongPath
!undef _MOZFUNC_UN
!define _MOZFUNC_UN ${_MOZFUNC_UN_TMP}
!undef _MOZFUNC_UN_TMP
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!define ${_MOZFUNC_UN}SetAppLSPCategories "!insertmacro ${_MOZFUNC_UN}SetAppLSPCategoriesCall"
Function ${_MOZFUNC_UN}SetAppLSPCategories
${Unless} ${AtLeastWinVista}
Return
${EndUnless}
Exch $R9
Push $R8
Push $R7
Push $R6
Push $R5
${${_MOZFUNC_UN}GetLongPath} "$INSTDIR\${FileMainEXE}" $R8
StrLen $R7 "$R8"
; Remove existing categories by setting the permitted categories to
; 0x00000000 since new categories are ANDed with existing categories. If
; the param value stored in $R9 is 0x00000000 then skip the removal since
; the categories will be removed by the second call to
; WSCSetApplicationCategory.
StrCmp "$R9" "0x00000000" +2 +1
System::Call "Ws2_32::WSCSetApplicationCategory(w r18, i r17, w n, i 0,\
i 0x00000000, i n, *i) i"
; Set the permitted LSP categories
System::Call "Ws2_32::WSCSetApplicationCategory(w r18, i r17, w n, i 0,\
i r19, i n, *i .s) i.r16"
Pop $R5
!ifndef NO_LOG
${LogHeader} "Setting Permitted LSP Categories"
StrCmp "$R6" 0 +3 +1
${LogMsg} "** ERROR Setting LSP Categories: $R5 **"
GoTo +2
${LogMsg} "Permitted LSP Categories: $R9"
!endif
ClearErrors
Pop $R5
Pop $R6
Pop $R7
Pop $R8
Exch $R9
FunctionEnd
!verbose pop
!endif
!macroend
!macro SetAppLSPCategoriesCall _LSP_CATEGORIES
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "${_LSP_CATEGORIES}"
Call SetAppLSPCategories
!verbose pop
!macroend
!macro un.SetAppLSPCategoriesCall
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
Push "0x00000000"
Call un.SetAppLSPCategories
!verbose pop
!macroend
!macro un.SetAppLSPCategories
!ifndef un.SetAppLSPCategories
!verbose push
!verbose ${_MOZFUNC_VERBOSE}
!undef _MOZFUNC_UN
!define _MOZFUNC_UN "un."
!insertmacro SetAppLSPCategories
!undef _MOZFUNC_UN
!define _MOZFUNC_UN
!verbose pop
!endif
!macroend
/**
* Update Start Menu and Taskbar lnk files that point to the current install