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.
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
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.
Any more nuggets of wisdom?
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
Thank you so much for solving this for me :)