views:

341

answers:

2

I am trying to start and stop the firewall in Windows XP using the win32 api for changing settings in the registry, i.e HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile. I am trying to change a data value but it's not changing. So can tell me any other way how I can stop the firewall in windows XP?

A: 

What service pack are you running? Microsoft likes to relocate these keys ... ;-)

Check

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile\EnableFirewall=0 (DWORD data type)

and

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile\EnableFirewall=0 (DWORD data type)

Stopping the service would be best though ;-)

Robert French
+1  A: 

Why are you stopping the firewall? Did you check this article from codeproject which uses another method?

Edit: Got this from here.

There are several solutions available to disable the firewall programmatically without extracting the SP2 EXE file.

Here are two ways:

1) Adding the registry values mentioned, this can be done either before or after SP2 is installed

The registry key path has changed since I posted that post (it is now WindowsFirewall instead of FirewallPolicy):

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile
          \EnableFirewall=0 (DWORD data type)

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsFirewall\StandardProfile
          \EnableFirewall=0 (DWORD data type)

If you want to disable the service as well:

sc.exe config SharedAccess start= disabled

2)The following command line will disable SP2's firewall (must be run after SP2 is installed and at least one reboot is done):

netsh.exe firewall set opmode mode=disable profile=all
Shoban
Thanks for replying .But i tried to change the Data value for StandardProfile\EnableFirewall , there showing that (invalid DWORD value) , so how can i change
Thanks for the pointer to netsh.exe, it looks very helpful for working with the firewall.
Charlie