Registering programs in the exception of the firewall (WINDOWS7 and XP)

Source: Internet
Author: User

In the writing program, often encountered by the firewall interception situation, especially some network programs, whether external access or external connection, will be intercepted.

In most cases, Windows silently intercepts external internal connections, while internal access prompts the user for information.

Now we need to add our own program to the exception of the firewall, so that the program can communicate between normal.

The first method is to read and write the registry:

XP is the number of these key values (sometimes seemingly only use 2 keys on the line, but the situation is different, the most insurance way is that the 4 keys are written):

1. hkey_local_machine/system/currentcontrolset/services/sharedaccess/parameters/firewallpolicy/standardprofile/ Authorizedapplications/list 2. hkey_local_machine/system/controlset001/services/sharedaccess/parameters/firewallpolicy/standardprofile/ Authorizedapplications/list 3. 4. hkey_local_machine/system/currentcontrolset/services/sharedaccess/parameters/firewallpolicy/domainprofile/ Authorizedapplications/list 5. hkey_local_machine/system/controlset001/services/sharedaccess/parameters/firewallpolicy/domainprofile/ Authorizedapplications/list

And under the Window7 slightly different, is these several keys:

1. Hkey_local_machine/system/controlset001/services/sharedaccess/parameters/firewallpolicy/firewallrules 2. Hkey_local_machine/system/controlset001/services/sharedaccess/defaults/firewallpolicy/firewallrules 3. Hkey_local_machine/system/currentcontrolset/services/sharedaccess/defaults/firewallpolicy/firewallrules 4. Hkey_local_machine/system/currentcontrolset/services/sharedaccess/parameters/firewallpolicy/firewallrules

The second way is to use command operations, which are most insurable and highly adaptable:

Also under the command of XP:

1. netsh firewall add allowedprogram//Add exception

While this command is also available under WINDOW7, you may be prompted not to use this, so replace this with more insurance (because of the system UAC):

1. netsh advfirewall firewall

Options can be selected (XP and Win7 are the same, but with a slightly different usage):

1.? -Displays a list of commands. 2. Add-Adds a firewall configuration. 3. Delete-Deletes the firewall configuration. 4. Dump-Displays a configuration script. 5. Help-Displays a list of commands. 6. Reset-Resets the firewall configuration to the default value. 7. Set-Set firewall configuration. 8. Show-Display firewall configuration. 9. If you need more help on the command, type the command, 10. Back with?

Specific use can be typed directly in the command, will display help information, help with the sample program.

So you can use it again in your program:

"cmd.exe/s/C" netsh advfirewall firewall add rule name =/"mysql/" dir=in program =/"G://program files//mysql//mysql//b in//mysql.exe/"Security=authnoencap action=allow/" "//win7 add MySQL to firewall exception

In a script-enabled installer, you can also call directly, such as under WinXP, using NSIs to do the installation package:

Nsexec::exectolog ' netsh advfirewall firewall add rule name = "MySQL" dir=in program = "$PROGRAMFILES/mysql/mysql/bin/mysq L.exe "Action=allow '

can achieve the same effect.

For deletion and modification, you can view the Help for this command:

1. C:/Documents and Settings/administrator>netsh firewall Delete 2. The following instructions are valid: 3. The command in this context: 4. Delete Allowedprogram-Deletes the program configuration allowed by the firewall. 5. Delete portopening-Remove firewall port configuration. 6. C:/Documents and Settings/administrator>

Then use it according to the instructions and detailed examples.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.