Changeset 2187 for trunk/eraser/Eraser.Util/VolumeInfo.cs
- Timestamp:
- 6/18/2010 11:33:59 AM (3 years ago)
- File:
-
- 1 edited
-
trunk/eraser/Eraser.Util/VolumeInfo.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Util/VolumeInfo.cs
r2185 r2187 463 463 get 464 464 { 465 if (!IsReady)466 throw new InvalidOperationException("The volume has not been mounted or is not " +467 "currently ready.");468 469 465 ulong result, dummy; 470 466 if (NativeMethods.GetDiskFreeSpaceEx(VolumeId, out dummy, out result, out dummy)) … … 473 469 } 474 470 471 //Try the alternative method 472 using (SafeFileHandle handle = OpenHandle(NativeMethods.GENERIC_READ, 473 FileShare.ReadWrite, FileOptions.None)) 474 { 475 if (handle.IsInvalid) 476 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 477 478 long result2; 479 uint returned = 0; 480 if (NativeMethods.DeviceIoControl(handle, 481 NativeMethods.IOCTL_DISK_GET_LENGTH_INFO, IntPtr.Zero, 0, out result2, 482 out returned, IntPtr.Zero)) 483 { 484 return result2; 485 } 486 } 487 488 //Otherwise, throw 475 489 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 476 490 }
Note: See TracChangeset
for help on using the changeset viewer.
