Esempio n. 1
0
        public static char[] GetCDDriveLetters()
        {
            string res = "";

            for (char c = 'C'; c <= 'Z'; c++)
            {
                if (Win32Functions.GetDriveType(c + ":") == Win32Functions.DriveTypes.DRIVE_CDROM)
                {
                    res += c;
                }
            }
            return(res.ToCharArray());
        }
Esempio n. 2
0
 public bool Open(char Drive)
 {
     Close();
     if (Win32Functions.GetDriveType(Drive + ":\\") == Win32Functions.DriveTypes.DRIVE_CDROM)
     {
         cdHandle = Win32Functions.CreateFile("\\\\.\\" + Drive + ':', Win32Functions.GENERIC_READ, Win32Functions.FILE_SHARE_READ, IntPtr.Zero, Win32Functions.OPEN_EXISTING, 0, IntPtr.Zero);
         if (((int)cdHandle != -1) && ((int)cdHandle != 0))
         {
             m_Drive              = Drive;
             NotWnd               = new DeviceChangeNotificationWindow();
             NotWnd.DeviceChange += new DeviceChangeEventHandler(NotWnd_DeviceChange);
             return(true);
         }
         else
         {
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }