C programming language is very powerful , It also has abilities to play with Registry and so in this post I will show how you can disable and enable the USB port. By blocking the USB port can be controlled if the user to access the machine or not.

This is a very small and easy to code, once the block usb program run, the computer does not recognize any USB drive is inserted, but we can reverse the release of the USB port.
This program tested on XP, but not sure about Vista and Windows 7. You can try this program on your own computer, as I have the unlock code also.
Logic of the program
The logic of the program is simple. The 'C' source file 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 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
[sourcecode language=C]
#include
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 4 \/f");
}
[/sourcecode]
CODE To enable usb port
[sourcecode language=C]
#include
void main()
{
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR \/v Start \/t REG_DWORD \/d 3 \/f");
}
[/sourcecode]



0 comments:
Post a Comment