How to disable USB port using c program?

Today i am going to show you how to disable your system/laptop USB port by executing a simple c program.This is a quite simple program to disable the USB port and make it again accessible by executing another program.You can also manually do this by registry hack.

USB-block

Follow the following steps:

1. Copy the following code and paste it in notepad.Save the file with ‘.c’ extention for eg: blockusb.c or any other name.

#include<stdio.h>
   void main()
{//code to block usb port:gotechpedia.blogspot.com
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");
//code to block usb port:gotechpedia.blogspot.com
}

2. Again copy the following code and paste it in notepad.Save the file with ‘.c’ extention for eg: unblockusb.c or any other name.

#include<stdio.h>
void main()
{//code to block usb port:gotechpedia.blogspot.com 
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");
//code to block usb port:gotechpedia.blogspot.com 
}

3.Now compile and run both of the code.After compiling you will get two executable files blockusb.exe and unblockusb.exe in your TC directory.

4.Now if you double click on the blockusb.exe it will block all the usb port of your pc.If you want to enable it double click on unblock.exe.

5.That’s it.If you have any queries comment here and don’t forget to subscribe.

Share on Google Plus

About a

    Blogger Comment
    Facebook Comment

0 comments: