Example #1
0
 /// <summary>
 /// Unlock CD drive
 /// </summary>
 /// <returns>True on success</returns>
 public bool UnLockCD()
 {
     if (((int)cdHandle != -1) && ((int)cdHandle != 0))
     {
         uint Dummy = 0;
         Win32Functions.PREVENT_MEDIA_REMOVAL pmr = new Win32Functions.PREVENT_MEDIA_REMOVAL();
         pmr.PreventMediaRemoval = 0;
         return
             (Win32Functions.DeviceIoControl(cdHandle, Win32Functions.IOCTL_STORAGE_MEDIA_REMOVAL, pmr,
                                             (uint)Marshal.SizeOf(pmr), IntPtr.Zero, 0, ref Dummy, IntPtr.Zero) != 0);
     }
     else
     {
         return(false);
     }
 }
Example #2
0
 /// <summary>
 /// Unlock CD drive
 /// </summary>
 /// <returns>True on success</returns>
 public bool UnLockCD()
 {
   if (((int)cdHandle != -1) && ((int)cdHandle != 0))
   {
     uint Dummy = 0;
     Win32Functions.PREVENT_MEDIA_REMOVAL pmr = new Win32Functions.PREVENT_MEDIA_REMOVAL();
     pmr.PreventMediaRemoval = 0;
     return
       Win32Functions.DeviceIoControl(cdHandle, Win32Functions.IOCTL_STORAGE_MEDIA_REMOVAL, pmr,
                                      (uint)Marshal.SizeOf(pmr), IntPtr.Zero, 0, ref Dummy, IntPtr.Zero) != 0;
   }
   else
   {
     return false;
   }
 }