Thursday, July 8, 2010

Prevent Access To USB Pen Drive – working and construction

This program actually consist of two parts. i.e
1) Visual Basic Part
2) and a batch file

Visual Basic Part:

Create form as show in the figure.
CODE:
Private Sub Command1_Click()
If Option1.Value = True Then
Shell (“c:\man.bat 4″)
ElseIf Option2.Value = True Then

Shell (“c:\man.bat 3″)
End If
End Sub

Batch Program:

Create a text file and rename to man.bat and place it in C drive
the file will contain the following code:

@echo off
echo Windows Registry Editor Version 5.00 >> c:\man.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor] >> c:\man.reg
echo “start”=dword:00000%1 >>c:\man.reg
regedit.exe /s c:\man.reg
exit

WORKING:

when the user select option1(enable) and clicks the command 1 button the batch file will executed with %1 as 4(the batch file replace %1 with “4″) and then change the value of start in “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor” to “4”
the same when we select disable option.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Disclaimer

All the postings of mine in this whole BLOG is not my own collection. All are downloaded from internet posted by some one else. I am just saving some time of our blog users to avoid searching everywhere. Am not violating any copy rights law or not any illegal action am not supposed to do.If anything is against law please notify so that they can be removed