Drives in "Safely Remove Hardware"

USBDLM

 

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:

 

[HideFromSafelyRemoveHardware]

DeviceID1=USB\VID_058F&PID_6369

 

 

Or by its "Friendly Name":

 

[HideFromSafelyRemoveHardware]

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:

 

[AddToSafelyRemoveHardware]

DeviceID1=IDE\DISKFUJITSU_MHV2040BH*00000025

 

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:

 

[HideFromSafelyRemoveHardware]

CompleteDeviceID=USB\VID_1758&PID_2004\050712014270000083

CompleteDeviceID=PCI\VEN_1011&DEV_0009&SUBSYS_21140A00&REV_20\3&267A616A&0&50

 

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:

 

[Settings]

SetDeviceDesc=1

 

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:

 

[Settings]

SetDeviceDesc=2

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.