I want to make an usb disk write protected, I have found doing this as a solution:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]
"WriteProtect"=dword:00000001
But this has 2 drawbacks for me:
It doesn't work on a already mounted usb disk, if the mounting is prior to modifying the registry, it works though if I remove and add the disk or any other disk again.
This works for all usb ports.
So, what I what is to:
Make the usb disk write protected based on the serial number(which I get in a windows service) immediately after I get the device_arrival event in my windows service. I don't want to have to reinsert the usb stick for it to work.
And could it be possible to restrict this behaviour for specific usb disks? I mean, If I have usb disk nr1 which I want to be write protected, and usb disk nr2 which I don't want to be write protected, could I mount them bothm on my pc at the same time with the desired write/read premssions?
By the way, I want to do this in C#, and I'm working on Windows 7.