views:

837

answers:

2

How do I Flip the Removable Bit of my USB Pen Drive or HDD in C# like this Tool does?

Thanks in advance!

+1  A: 

This is not easily done.

The "removable bit" is in the firmware of the controller on the device, not on the filesystem, and it is not accessible by anything but a custom tool for that device.

And since each chip manufacturer has different ways to access the firmware, and the firmware itself can be at different addresses, it is very unlikely that a universal tool can be made.

Your only option would be to sniff USB packets sent by the original utility, decode them and write a new tool which replicates the behavior.

The link you provide will not work on all USB devices, but works on many.

Mikael Svenson
If the Code would work for many USB devices like the tool does that would be fine for me...
MemphiZ
But it's still hard to figure out how to actually write the code without reverse engineering the existing tool.
Mikael Svenson
A: 

You could search the registry etc and use c# registry commands to 'flip' bits etc. But there is no garantee that the underlying drivers will support the configuration. If you require this functionality than buy a drive that supports it.

This answer probably belongs on Super User: The least fuss way to use a USB drive appear as part of a Hard Drive, is set NTFS symbolic link. Which will make your usb drive appear as a directory. You wont be able to partition it like a hard drive though, but you will be able to index it etc - i have several non hard drive devices configured as symbolic links and the music contained on them appears in media player and windows libraries, all searchable and removeable.

  • Create a directory on your hard drive to be the Mount point
  • Right Click my computer
  • Manage
  • From storage, go to disk management
  • right click your device
  • Choose Add Drive letter or Path
  • Add a path to the directory.

or use the mklink command

Adrian