USB WriteProtect

USBDLM

 

USB Write Protect


 

Windows since XP with SP2 can activate a write protection for USB drives. Unfortunately this is a global setting and not device specific.

 

Since V4.6.9.2 USBDLM can make this registry entry on arrival of a USB device.

 

Background information: When a USB drive is attached then the Windows plug'n play installs first the USB device, then it's disk device and finally the storage volume. Even the USB WriteProtect affects the volume only USBDLM sets the registry value already on arrival of the USB device to ensure that is ready when the volume is mounted. Therefore the only usable criteria is the device ID of the USB device.

 

The reg setting is the DWORD value "WriteProtect" under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.

1 activates the write protection for new USB volumes, 0 deactivates it.

 

USBDLM can set a 1 or a 0 for specific devices. USBDLM needs a default value to set for devices which no special setting is made for.

 

Sample:

 

; default: set a 0 for all devices which are not found

; in sections [UsbWriteProtect] and [UsbNoWriteProtect]

[Settings]

UsbWriteProtect=0

 

; set a 1 for these devices

[UsbWriteProtect]

DeviceId1=USB\VID_13FE&PID_1F00

 

; set a 0 for these devices

[UsbNoWriteProtect]

DeviceId1=USB\VID_0951&PID_1624

 

 

You can also use an external text file with the IDs as shows for the DeviceID criteria.

 

 

The typical setting is to have UsbWriteProtect=1 and a section [UsbNoWriteProtect] with a list of drives which shall have no write protection.

The opposite way is UsbWriteProtect=0 and a section [UsbWriteProtect] with a list of drives which shall have a write protection.

 

The default value is also set when the USBDLM service is stopped.

 

 

The whole mechanism is not 100 percent reliable since it depends on the timing of the arrival event. If two USB drives with different WriteProtect settings are attached at the same time then the result is unpredictable. But usually it works fine.