Ignore:
Timestamp:
6/18/2010 11:33:59 AM (2 years ago)
Author:
lowjoel
Message:

Allow us to query the size of non-ready partitions and disks (for more informative UIs)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Util/NativeMethods/Kernel.cs

    r2179 r2187  
    675675        } 
    676676 
     677        [DllImport("Kernel32.dll", SetLastError = true)] 
     678        [return: MarshalAs(UnmanagedType.Bool)] 
     679        private extern static bool DeviceIoControl(SafeFileHandle hDevice, 
     680            uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, 
     681            out long lpOutBuffer, uint nOutBufferSize, out uint lpBytesReturned, 
     682            IntPtr lpOverlapped); 
     683 
     684        public static bool DeviceIoControl(SafeFileHandle hDevice, 
     685            uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, 
     686            out long lpOutBuffer, out uint lpBytesReturned, IntPtr lpOverlapped) 
     687        { 
     688            return DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, 
     689                out lpOutBuffer, sizeof(long), out lpBytesReturned, lpOverlapped); 
     690        } 
     691 
     692        /// <summary> 
     693        /// Retrieves the length of the specified disk, volume, or partition. 
     694        /// </summary> 
     695        public const int IOCTL_DISK_GET_LENGTH_INFO = 
     696            (0x00000007 << 16) | (0x0001 << 14) | (0x0017 << 2); 
     697 
    677698        [DllImport("Kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 
    678699        [return: MarshalAs(UnmanagedType.Bool)] 
Note: See TracChangeset for help on using the changeset viewer.