P2P transmission of products has always been a tangle of problems, and sometimes there is a situation in the LAN that cannot be directly connected, to go through forwarding. During the test, it was found that the reason was Windows Firewall, And the P2P firewall cannot be directly connected.
My own system is win7. When the software runs for the first time, the system will prompt whether to add the program to the firewall exception program. I accidentally closed the window and caused the problem.
I found some information on the Internet. I wanted to write the Registry when I started the software. I wrote the corresponding registry under win7, but the Windows Firewall exception program list never showed the corresponding items, it is quite tangled (people who know it may have trouble to tell). Considering that the registry write in the program will be intercepted by 360, we decided to implement this function in the packaging and installation script.
NSIs script execution statement
Section ${If} ${AtLeastWinVista} nsExec::ExecToLog 'cmd.exe /c "netsh advfirewall firewall delete rule name =\"xxxxxx\" program=\"$INSTDIR\xxx.exe\""'nsExec::ExecToLog 'cmd.exe /c "netsh advfirewall firewall add rule name =\"xxxxxx\" dir=in program=\"$INSTDIR\xxx.exe\" action=allow Protocol=udp Profile=Public"'nsExec::ExecToLog 'cmd.exe /c "netsh advfirewall firewall add rule name =\"xxxxxx\" dir=in program=\"$INSTDIR\xxx.exe\" action=allow Protocol=tcp Profile=Public"' ${Else}nsExec::ExecToLog 'cmd.exe /c "netsh firewall delete allowedprogram program = \"$INSTDIR\xxx.exe\""'nsExec::ExecToLog 'cmd.exe /c "netsh firewall add allowedprogram program = \"$INSTDIR\xxx.exe\" name=\"xxxxxx\" ENABLE"'${EndIf} SectionEnd
Register a program in the firewall exceptions
Http://blog.csdn.net/blpluto/article/details/5979684
Netsh advfirewall firewall commands
Windows 7 http://technet.microsoft.com/zh-cn/library/dd734783 (V = ws.10)
XP
Http://technet.microsoft.com/zh-cn/library/cc771046 (V = ws.10). aspx
NSIs basic syntax
Http://www.cppblog.com/Mumoo/archive/2012/05/11/174542.aspx
Macro file of the logical statement :! Include logiclib. nsh
If statement:
$ {If} $0 = 'some value'
MessageBox mb_ OK '$0 is some value'
$ {Elseif} $0 = 'some other value'
MessageBox mb_ OK '$0 is some other value'
$ {Else}
MessageBox mb_ OK '$0 is "$0 "'
$ {Endif}
While loop:
Strcpy $ R1 0 ---------- the string value is an integer.
$ {While} $ R1 <5
Intop $ R1 $ R1 + 1
Detailprint $ R1 ---------- print string
$ {Endwhile}
NSIs obtains the current system version
Http://www.flighty.cn/html/bushu/20110322_114.html