Instructables
Picture of USB Lock
I had the need to have a switch to turn read only mode for all my USB sticks (sadly only a old 128Mb one had a hardware switch). The use of SD and microSD cards with a adaptor (they both have a switch) is a option but only if your PC has a card reader. After some research i came up with a plan. And after some testing, and codeing i have made this litlle aplication that fit my needs.

UPDATED 17.09.2013

!!! I MESSED THE WINDOWS 7 COMPATIBILITY, SORRY FOLKS PLEASE USE A VERSION BEFORE 1.5.0.0 FOR VISTA+ SO !!!

Rewriten in Visual C++ 2008

Version: 1.5.0.0
Download: https://docs.google.com/file/d/0ByKfzUUEN5s-ZmRnZ19Gbk1vYXc/edit?usp=sharing
[File is in a 7zip archive www.7-zip.org]

Version 1.5.1.0
Download: https://docs.google.com/file/d/0ByKfzUUEN5s-Z2M4SndNNjFqN28/edit?usp=sharing
[File is in a 7zip archive www.7-zip.org]

Version 1.5.1.5
Download: https://docs.google.com/file/d/0ByKfzUUEN5s-anhaNEMzQ0hwXzQ/edit?usp=sharing
[File is in a 7zip archive www.7-zip.org]
 
Remove these adsRemove these ads by Signing Up

Step 1: How it does what it does ?

It sets in the registry a dword value to 1 for "Read-Only Mode" and 0 for "Read-Write Mode".

Path:
HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Control -> StorageDevicePolicies

Key
WriteProtect=1 or 0

I have added 2 registry files that enable or disable that, for learnig purpose.
ac1D2 years ago
Nice idea!
Here a little improvement that MAY work.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor
Set this value to 4 to desactivate usb drive, then to 3 to activate again.

So, you could modify your app to:
Read only mode:
1) set to read-only
2) desactivate usb device (act like unplug)
3) activate usb device (act like re-plugging)
4) profit!

Normal mode:
1) set to normal mode (read/write)
2) desactivate usb device (act like unplug)
3) activate usb device (act like re-plugging)
4) profit!
neumanngregor (author)  ac1D2 years ago
Nice ideea, but registry editing on that key works only after restart, to simulate a unplug and a re-plug the only way i kow it can work it is with devcon.exe (Windows WAIK). This action has some steps :

1. Get the device ID for all usb sticks pluged (automaticaly)
2. after registry write, disale, wait 1-2 seconds and enable all usb sticks pluged
3. I gonna work on this 2 get it working :D
neumanngregor (author)  neumanngregor2 years ago
Added all features you sugested. :)
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!