revert 7710,

configure java in firewall for full access. this is the usual config if the user manually accepts java for the firewall.
otherwise if a port is specified, windows will not ask on any port change. this would break yacy and other java applications if they run not on the specified port. this would not be an expected behaviour for the user.

firewall config may fail for win64 systems (system32 is specified in path)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7711 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 14 years ago
parent 440e3ba887
commit 8b63d7637d

@ -41,11 +41,13 @@ InstallDirRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy"
;recommend free space in GB for YaCy ;recommend free space in GB for YaCy
!define RecommendSpace "30" !define RecommendSpace "30"
; some string for Firewall ; commands for firewall config, see http://support.microsoft.com/kb/947709/en-us
!define WinAddYaCyPort 'netsh advfirewall firewall add rule name="YaCy" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow protocol=tcp localport=8090' !define WinXPAddFwRulePort 'netsh firewall add allowedprogram name="YaCy" program="%SystemRoot%\System32\javaw.exe"'
!define WinDelYaCyPort 'netsh advfirewall firewall del rule name="YaCy"' !define WinXPDelFwRulePort 'netsh firewall del allowedprogram program="%SystemRoot%\System32\javaw.exe"'
!define WinAdduPnpPort 'netsh advfirewall firewall add rule name="YaCy uPnp" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow protocol=udp remoteip=defaultgateway remoteport=1900' !define WinVistaAddFwRulePort 'netsh advfirewall firewall add rule name="YaCy" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow'
!define WinDeluPnpPort 'netsh advfirewall firewall del rule name="YaCy uPnp"' !define WinVistaDelFwRulePort 'netsh advfirewall firewall del rule name="YaCy"'
var WinAddFwRulePort
var WinDelFwRulePort
;requested execution level on Vista / 7 ;requested execution level on Vista / 7
RequestExecutionLevel admin RequestExecutionLevel admin
@ -183,7 +185,7 @@ Section "Desktop Icon"
CreateShortCut "$DESKTOP\YaCy.lnk" "$INSTDIR\startYACY.bat" "" "$INSTDIR\addon\YaCy.ico" "" SW_SHOWMINIMIZED CreateShortCut "$DESKTOP\YaCy.lnk" "$INSTDIR\startYACY.bat" "" "$INSTDIR\addon\YaCy.ico" "" SW_SHOWMINIMIZED
SectionEnd SectionEnd
Section "Open Firewall (Port 8090 for YaCy and 1900 for uPnP)" Sec_Firewall_id Section "Configure Firewall" Sec_Firewall_id
SectionIn 1 SectionIn 1
SetShellVarContext current SetShellVarContext current
call OpenFirewall call OpenFirewall
@ -265,7 +267,16 @@ Function .onInit
${If} ${IsWinVista} ${If} ${IsWinVista}
${OrIf} ${IsWin7} ${OrIf} ${IsWin7}
ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\MpsSvc" "Start" StrCpy $WinAddFwRulePort '${WinVistaAddFwRulePort}'
StrCpy $WinDelFwRulePort '${WinVistaDelFwRulePort}'
ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\MpsSvc" "Start"
${EndIf}
${If} ${IsWinXP}
${AndIf} ${AtLeastServicePack} 2
StrCpy $WinAddFwRulePort '${WinXPAddFwRulePort}'
StrCpy $WinDelFwRulePort '${WinXPDelFwRulePort}'
ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\SharedAccess" "Start"
${EndIf} ${EndIf}
;need Admin for firewall-config ;need Admin for firewall-config
@ -374,22 +385,12 @@ FunctionEnd
Function OpenFirewall Function OpenFirewall
var /global ExecErrorCode var /global ExecErrorCode
; run netsh for Port 8090 ; run netsh
nsExec::ExecToStack '${WinAddYaCyPort}' nsExec::ExecToStack '$WinAddFwRulePort'
pop $ExecErrorCode
; if run without error register for uninstall and clear finish page
${If} $ExecErrorCode = "0"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwYaCyPort" '${WinDelYaCyPort}'
IntOp $FirewallServiceStart 0 + 0
${Else}
IntOp $FirewallServiceStart 3 + 0
${EndIf}
; run netsh for Port 1900 - uPnP
nsExec::ExecToStack '${WinAdduPnpPort}'
pop $ExecErrorCode pop $ExecErrorCode
; if run without error register for uninstall and clear finish page ; if run without error register for uninstall and clear finish page
${If} $ExecErrorCode = "0" ${If} $ExecErrorCode = "0"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwuPnpPort" '${WinDeluPnpPort}' WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRulePort" '$WinDelFwRulePort'
IntOp $FirewallServiceStart 0 + 0 IntOp $FirewallServiceStart 0 + 0
${Else} ${Else}
IntOp $FirewallServiceStart 3 + 0 IntOp $FirewallServiceStart 3 + 0
@ -400,22 +401,15 @@ Function SHOW_PageFinish_custom
; hide and disable firewall info from wiki if firewall is open ; hide and disable firewall info from wiki if firewall is open
${If} $FirewallServiceStart = 0 ${If} $FirewallServiceStart = 0
SendMessage $mui.FinishPage.ShowReadme ${BM_SETCHECK} 0 0 SendMessage $mui.FinishPage.ShowReadme ${BM_SETCHECK} 0 0
ShowWindow $mui.FinishPage.ShowReadme ${SW_HIDE} ShowWindow $mui.FinishPage.ShowReadme ${SW_HIDE}
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
Function un.CloseFirewall Function un.CloseFirewall
; get string for closing port from registy ; get string for closing port from registy
var /global UninstallCmd ReadRegStr '$WinDelFwRulePort' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRulePort"
; close YaCy-Port 8090
ReadRegStr '$UninstallCmd' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwYaCyPort"
; if found > run netsh to close port ; if found > run netsh to close port
${IfNot} '$UninstallCmd' == '' ${IfNot} '$WinDelFwRulePort' == ''
nsExec::ExecToStack '$UninstallCmd' nsExec::ExecToStack '$WinDelFwRulePort'
${EndIf}
; close uPnp-Port 1900
ReadRegStr '$UninstallCmd' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwuPnPPort"
${IfNot} '$UninstallCmd' == ''
nsExec::ExecToStack '$UninstallCmd'
${EndIf} ${EndIf}
FunctionEnd FunctionEnd

Loading…
Cancel
Save