简体   繁体   English

对于Windows XP OS,使用Win32 API进行防火墙启动/停止

[英]Firewall start/stop using win32 api for windows XP os

I am trying to start and stop the firewall in Windows XP using the win32 api for changing settings in the registry, ie HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile . 我正在尝试使用Win32 API在Windows XP中启动和停止防火墙,以更改注册表中的设置,即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? 那么可以告诉我其他方法如何停止Windows XP中的防火墙吗?

Why are you stopping the firewall? 为什么要停止防火墙? Did you check this article from codeproject which uses another method? 您是否从使用其他方法的codeproject中检查了这篇文章?

Edit: Got this from here . 编辑:从这里得到

There are several solutions available to disable the firewall programmatically without extracting the SP2 EXE file. 有几种解决方案可通过编程方式禁用防火墙,而无需提取SP2 EXE文件。

Here are two ways: 有两种方法:

1) Adding the registry values mentioned, this can be done either before or after SP2 is installed 1)添加提到的注册表值,可以在安装SP2之前或之后完成

The registry key path has changed since I posted that post (it is now WindowsFirewall instead of FirewallPolicy): 自从我发布该帖子以来,注册表项路径已更改(现在是WindowsFirewall而不是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 sc.exe配置SharedAccess开始=禁用

2)The following command line will disable SP2's firewall (must be run after SP2 is installed and at least one reboot is done): 2)以下命令行将禁用SP2的防火墙(必须在安装SP2并完成至少一次重新引导后运行):

netsh.exe firewall set opmode mode=disable profile=all

What service pack are you running? 您正在运行什么Service Pack? Microsoft likes to relocate these keys ... ;-) Microsoft喜欢重新定位这些键... ;-)

Check 校验

HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\DomainProfile\\EnableFirewall=0 (DWORD data type) HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\DomainProfile\\EnableFirewall=0 (DWORD数据类型)

and

HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\StandardProfile\\EnableFirewall=0 (DWORD data type) HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\WindowsFirewall\\StandardProfile\\EnableFirewall=0 (DWORD数据类型)

Stopping the service would be best though ;-) 最好停止服务;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Process.Start 在 Windows XP 机器上抛出 Win32 异常访问被拒绝 - Process.Start throws Win32 Exception Access is Denied on Windows XP Machines Windows XP Win32 API是否可以检测音频设备的添加/删除? - Windows XP Win32 API to detect add/removal of audio devices? 使用Win32 API阻止Windows桌面上的所有URL - Block all urls on windows desktop using win32 API 如何使用Win32 API创建多个窗口 - How to make multiple windows using Win32 API 为XP和Vista / Windows 7创建Win32应用程序 - Creating a Win32 application for both XP and Vista/Windows 7 Win32代码在Windows XP / 7中获取EDID - Win32 code to get EDID in Windows XP/7 与Windows XP / win32串行通信的基本示例 - Basic example of serial communication with Windows XP/win32 如何在 PowerShell 环境中使用 Win32 API FindWindow() 在 Windows 8.1 Update 2 OS 中查找桌面窗口(按窗口名称)? - How to find a desktop window (by window name) in Windows 8.1 Update 2 OS, using the Win32 API FindWindow() in PowerShell environment? Windows使用Win32 API进入待机或休眠状态之前接收事件 - Receive event before Windows enters standby or hibernate using Win32 API 使用win32 API函数启用/禁用任务管理器,而不是使用Windows注册表 - Enable/disable task manager using win32 API function, not by windows registry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM