January 22, 2012

C program to Block Windows Firewall

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 thorugh SYSTEM function with correct credential, we can block Windows Firewall. We created this program which can block your Windows Firewall.

choices, either run your CodeBlock 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.

/* 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;

If you did everything as told, your output window will be like.

Hope you like the post, comment bellow for Query and Feedback :)

Related Posts :

Categories: ,


Thanks for kind suggestion. I am also using sky's all new windows firewall software for complete protection.

Nice! You can also try C code champ for several C programs, codes and tutorials. C codechamp contains a great list of C programs and tutorials.

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Related Posts with Thumbnails