Wednesday 20 August 2014

Filled Under: ,

C Program to Block Windows Firewall

Share

Here are something that need to be taken care of System command is not recommended to be used and you dear TC++ cannot execute SYSTEM command; We have not seen it working till now in TC++. Better use Codeblock IDE. If you Windows 7 user, the program requires elevated privileges to temper with registry, so you have two Windows maintains a central database called Windows Registry to store all kind of settings in the form of keys, values. If you know the correct keys, you can temper with the registry manually or you can automate this system. C language provides us a command System that can be used to execute Command Prompts’ commands like dir, md, attrib. In command prompt, we got a command called reg that can be used to create/view/change the registry settings. So, if we can execute this reg command through SYSTEM function with correct credential, we can block Windows Firewall. We created this program which can block your Windows Firewall.

choices, either run your CodeBlocks as Administrator or compile the program, execute the program (it won’t work this time), go to the location of the created executable file and run it as the administrator. First option is better. We will go with that.
3) If you are windows XP user, firewall will be blocked as soon as you run this program, but in case of Windows 7, you need to restart your computer one time to see the changes.
Here is the program.

C Program to Block Windows firewall

/* This program is to Stop the WIndows Firewall from functioning Properly. */
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
int main()
{
 system("reg add HKLM\system\currentcontrolset\Services\SharedAccess\parameters\firewallpolicy\standardprofile /v EnableFirewall /t reg_dword /d 0 /f");
 system("reg add HKLM\system\currentcontrolset\Services\SharedAccess\parameters\firewallpolicy\publicprofile /v EnableFirewall /t reg_dword /d 0 /f");
 return 0;
}
Output : If the above program execute properly then it will give following