title: Ejecting a USB Drive
body: <p>I am following the <a href="http://www.codeproject.com/Articles/375916/How-to-Prepare-a-USB-Drive-for-Safe-Removal" rel="nofollow">CodeProject Tutorial</a> to remove a USB drive in C#. the issue I am facing is the USB Pen Drive eject successfully but doesn't works on a portable hard drive. code is given below</p>
  
  <pre><code>int r = CM_Request_Device_Eject_NoUi(DevInstParent, IntPtr.Zero, null, 0, 0);
  LogFile.Err("Eject Return value - " + r);
  </code></pre>
  
  <p>When a USB pen drive is forced to eject the integer r returns 0 and eject command is successful, but when a portable drive is forced to eject, it returns 23.</p>