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?
views:
341answers:
2What 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 ;-)
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