Exemple #1
0
        //-------------- Rotinas

        public DVDRomReader(Char drive)
        {
            context = IOManager.CreateIOContext("DVD-ROM " + drive, @"\\.\" + drive + ':', FileAccess.Read, FileShare.Read, 0,
                                                FileMode.Open, EFileAttributes.NoBuffering);

            context.Lock();

            DISK_GEOMETRY dg = context.GetDiskGeometry();

            sectorSize = (int)dg.BytesPerSector;

            PARTITION_INFORMATION pi = context.GetPartitionInformation();

            size = pi.PartitionLength;

            context.Unlock();
        }
Exemple #2
0
        //--------------- Lê as informações da partição
        public PARTITION_INFORMATION GetPartitionInformation()
        {
            PARTITION_INFORMATION pi = new PARTITION_INFORMATION();
            int bytes = 0;

            if (!lockedByMe)
            {
                result = (int)IORet.RET_IO_UNLOCKED;
                Log.SendMessage(name, (int)IORet.RET_IO_UNLOCKED, null, LogMessageType.Error);
                return(pi);
            }

            //--------- Determina as informações da partição
            if (DeviceIoControl(handle.handle, IOManager.IOCTL_DISK_GET_PARTITION_INFO, IntPtr.Zero, 0, ref pi,
                                Marshal.SizeOf(pi), ref bytes, 0) == 0)
            {
                //Loga erro
                result = Marshal.GetLastWin32Error();
                Log.SendMessage(name, (int)IORet.RET_IO_NATIVEERROR, result, LogMessageType.Error);
            }

            return(pi);
        }
Exemple #3
0
 private static extern int DeviceIoControl(int hDevice, uint dwIoControlCode, IntPtr InBuffer, int nInBufferSize,
                                           ref PARTITION_INFORMATION OutBuffer, int nOutBufferSize, ref int pBytesReturned, int lpOverlapped);