In this post I’m going to show you how we can Disable and Enable USB Port. By blocking the usb port we can control whether user to access the machine or not.
Many schools and colleges have no pen drive rule, for that they are blocking the usb port. This trick will help us to open the blocked usb port.
Many schools and colleges have no pen drive rule, for that they are blocking the usb port. This trick will help us to open the blocked usb port.
This is very small and easy code, once the block usb program executed the computer will not recognize any inserted usb drive, but we can reverse it by unblocking the usb port.
This program tested on XP but not sure about vista & windows 7. You can try this program on your own computer, as I have given the unblock code also
Logic of the program
The logic of the program is simple. The 'C' source file block_usb.c writes the DWORD value of 4 (100 in binary) in the registry settings at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start" to 'lock' the USB ports.
Similarly, in the inverse process, the 'C' source file Unblock_usb.c writes the DWORD value of 3 (011 in binary) in the registry settings at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start" to 'unlock' the USB ports.
CODE
To disable usb port
This program tested on XP but not sure about vista & windows 7. You can try this program on your own computer, as I have given the unblock code also
Logic of the program
The logic of the program is simple. The 'C' source file block_usb.c writes the DWORD value of 4 (100 in binary) in the registry settings at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start" to 'lock' the USB ports.
Similarly, in the inverse process, the 'C' source file Unblock_usb.c writes the DWORD value of 3 (011 in binary) in the registry settings at "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start" to 'unlock' the USB ports.
CODE
To disable usb port
#include<stdio.h>
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f");
}
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f");
}
Save this code as block_usb.c and open it with turbo c compiler, after compilation it will create a block_usb.exe which is a simple program that will disable (block) all the USB ports of the computer.
After execution of block_usb.exe insert your pen drive, computer will not detect it. Now here’s the unblock code
To enable usb port
#include<stdio.h>
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");
}
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");
}
Save this code as unblock_usb.c and compile it with turbo c to get the unblock_usb.exe
Execute the unblock_usb.exe and now the computer detecting your pen drive.
I have also created rar file containing c source code of block and unblock usb and the executable files. Download from here