Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Remove item from Safely Remove Hardware using registry?

182 views
Skip to first unread message

Rawling

unread,
Jan 18, 2007, 8:38:01 AM1/18/07
to
Hi,
I have a USB CF card reader plugged into my PC, and it has added itself to
the list of items that appear on the Safely Remove Hardware menu. Well,
actually it's the only such item, and I want to remove it.
I don't want to just hide the icon in my Notification Area, or remove the
icon, I want to remove this piece of hardware from the list.

The tree for the reader is
USB Mass Storage Device
->OEI-USB CompactFlash USB Device
--->Generic volume - (F:)

This shows up regardless of whether there is a card in the reader. It makes
no sense for the reader itself to be Safely Removed - if I want to take the
card out I can right-click on the card in My Computer and go Eject; if I want
to actually remove the reader, well, I can just unplug it. It's just an inert
piece of hardware. It's not going to lose anything.

Now, the reason I'm so worked up about this is that I know there's a way to
remove this in the registry. At some point in the install Windows, or the
supplied driver, decided that this hardware is removable or somesuch. This is
shown by a registry key located somewhere in
HKLM\SYSTEM\CurrentControlSet\Enum\...

The item "Generic Volume F" is then located at
...\STORAGE\RemovableMedia\{...code from the dirver panel}

The item "OEI-USB CompactFlash USB Device" is instead located at
...\USBSTOR\{...other code corresponding}\{...more code}

Both of these Keys contain a Value (REG_DWORD) named Capabilities.

I think that this value is a series of binary flags that denote different
capabilities of the item; I also think that one or more of these flags are
what tells Windows that the item is Removeable and as such should show up in
the Safely Remove list.

However, I am unsure on a number of points, even if I'm right so far:

- How is this value constructed? What binary digit corresponds to what
capability?
- Which particular item should I be editing? The reader or the "volume"?

The reason I am sure I'm along the right lines is, admittedly, one forum post:

http://www.neowin.net/forum/index.php?showtopic=427449&st=30&p=587275443&entry587275443

I am just surprised that this isn't documented anywhere, that no-one has
advertised this as a method for the (common) probelm of "I want to get rid of
this Safely Remove icon, it's stupid that Windows is letting me eject my
primary hard drive" etc.

I hope someone understands all of this; I don't really myself.

Uwe Sieber

unread,
Jan 18, 2007, 12:45:24 PM1/18/07
to

Devices are shown there if they are marked as removable and
if they do no have the 'surprise removal ok' flag. These are
bit coded flags:

From cfgmgr32.h:
#define CM_DEVCAP_REMOVABLE (0x00000004)
#define CM_DEVCAP_SURPRISEREMOVALOK (0x00000080)

The device capabilities are found in the registry in a value
named 'Capabilities' under (sample for one of my USB flash
drives):
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\Vid_058f&Pid_6331\058F091111B

If you take away 4 from the value or add 80h and then
refresh the save removal dialog by toggeling the checkbox,
then the drive is gone.
But the value is reset when you attach the drive for the
next time. I think this is hard coded into the driver.

Uwe

Rawling

unread,
Jan 18, 2007, 1:37:01 PM1/18/07
to
Thank you so much, this worked perfectly :-)

I was a bit worried because neither of the keys I listed had 4 in that
value, but I found the corresponding key under the \USB\ folder and it had a
4 to subtract.

Thank you again.

Rawling

unread,
Jan 18, 2007, 1:45:01 PM1/18/07
to
Sorry, I spoke too soon. Altering that value and then refreshing the SRH list
does indeed remove the entry. However, the SRH icon still does not go away -
even though there is nothing left to Stop - and on reboot the registry value
has gone back to what it was originally, and the icon is back complete with
entry for the reader.

Any more nuggets of wisdom?

Uwe Sieber

unread,
Jan 20, 2007, 6:22:15 AM1/20/07
to

The decision to show or not to show this icon is probably
made only when a device is attached or removed. So, the
icon might disappear after an USB device has been attached
and then removed.

It should be possible to save the modified value into a
REG file and load it on startup like this:
regedit /s xxxx.reg

Uwe

Rawling

unread,
Jan 20, 2007, 7:20:00 AM1/20/07
to
Thank you' this has not only kept the registry value constant after reboot,
but has stopped the SRH icon showing up even though the list is empty.

Thank you so much for solving this for me :)

0 new messages