Drives in "Safely Remove Hardware"



Drives in "Safely Remove Hardware"


Most internal Cardreaders are USB devices and as such they are listed in the "Safely Remove Hardware" facility. USB devices have no chance to say "I'm an internal device and not removable", so Windows cannot distinguish between internal and external USB devices.


USBDLM can remove this removable flag from the registry. This hides a drive from the list.


Since Windows 7 the Safely Remove Hardware facility can do both, the "classic" safe removal of the whole device and the ejection of a media. Therefore it will show here "Removable" drives even USBDLM made the registry changes. But at least the function to safely remove the whole device is deactivated, only the real media ejection stays available.



Whenever the driver of the device starts up the value is written again. Therefore the modification must be done again and again...



The right drives are configured by means of their device ID, see Letters by Device ID how to get it.


Sample for a USB drive:






Or by its "Friendly Name":



DeviceID1=Kingston Flash Reader



DeviceID and DeviceID1 to DeviceID9 can be configured.



You can also force a drive being shown under "Safely Remove Hardware" - USBDLM then set the removable flag in the registry:





But even you can get drives listed there, the safe removal facility usually fails to remove IDE drives, while my command-line tool RemoveDrive works.



Devices which are not related to drives can be handled too. But because USBDLM stores no data about other devices than drives, the complete device instance ID must be configured like so:






You find the device instance ID in the Windows Device Manager. Right-click the device -> Properties. Select the "Details" tab. Here the "Device Instance ID" is already selected under XP. Since Vista it is called "Device Instance Path" and must be selected from the properties list first. Then click on the ID and press "Ctrl+C" to copy the ID into the Windows Clipboard.



Device Description


In the Safe Removal Menu of XP and Vista USB drives are always called like "USB Mass Storage Device" (depending on the Windows language). USB drives are distinguished by their drive letter only. But drives mounted into NTFS folders or without a mountpoint have no further information, they are all called "USB Mass Storage Device" only.


But the name "USB Mass Storage Device" is read from the Registry value "DeviceDesc" which exists for each device. USBDLM can change this value:





Possible values:

SetDeviceDesc=0   -> no change

SetDeviceDesc=1   -> set for USB drives mounted to NTFS folders or unmounted

SetDeviceDesc=2   -> set for all USB drives


By default USBDLM writes the device's "FriendlyName" to the DeviceDesc value, something like "Corsair Flash Voyager". You can configure this using USBDLM variables{linkID=}.


Sample for FriendlyName and BusType for all USB drives:




DeviceDesc=%FriendlyName% USB Device


The result would be something like "Corsair Flash Voyager USB Device"


The value DeviceDesc is changed for the USB device. Since a USB device can have multiple volumes (either multislot cardreaders or multiple partitions) using volume specific variables makes no sense here, the last volume would "win".

The value DeviceDesc is also used by the Windows Device Manager!


Since Vista the DeviceDesc values have a new default content. For a USB drive it is

@usbstor.inf,%genericbulkonly.devicedesc%;USB Mass Storage Device

All tries to replace certain parts only failed, only a full replacement succeed. I don't know which side effect are caused by changing the value.


For other BusTypes than USB the name in the menu is not read from the DeviceDesc value. Probably here is no way to change the name.



Windows 7 shows the device name anyway and changing the DeviceDesc value has no effect on the display in the "Safely remove hardware" facility.