Changeset 2647
- Timestamp:
- 5/22/2012 11:41:03 AM (13 months ago)
- Location:
- trunk/eraser/Eraser.Util
- Files:
-
- 2 edited
-
VolumeInfo.cs (modified) (1 diff)
-
Win32ErrorCodes.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Util/VolumeInfo.cs
r2644 r2647 622 622 NativeMethods.VOLUME_DISK_EXTENTS header; 623 623 624 if(!NativeMethods.DeviceIoControl(handle,624 while (!NativeMethods.DeviceIoControl(handle, 625 625 NativeMethods.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, IntPtr.Zero, 0, 626 626 buffer, (uint)bufferSize, out returnSize, IntPtr.Zero)) 627 627 { 628 628 int error = Marshal.GetLastWin32Error(); 629 if (error == Win32ErrorCode.InvalidFunction) 629 if (error == Win32ErrorCode.InvalidFunction || 630 error == Win32ErrorCode.NotSupported) 630 631 return null; 631 632 else if (error != Win32ErrorCode.MoreData) 632 633 throw Win32ErrorCode.GetExceptionForWin32Error(error); 633 634 634 //Calculate the size of the buffer required 635 header = (NativeMethods.VOLUME_DISK_EXTENTS) 636 Marshal.PtrToStructure(buffer, 637 typeof(NativeMethods.VOLUME_DISK_EXTENTS)); 638 Marshal.FreeHGlobal(buffer); 639 bufferSize += (int)(header.NumberOfDiskExtents - 1) * 640 Marshal.SizeOf(typeof(NativeMethods.DISK_EXTENT)); 641 buffer = Marshal.AllocHGlobal(bufferSize); 642 643 if (!NativeMethods.DeviceIoControl(handle, 644 NativeMethods.IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, IntPtr.Zero, 0, 645 buffer, (uint)bufferSize, out returnSize, IntPtr.Zero)) 646 { 647 throw Win32ErrorCode.GetExceptionForWin32Error( 648 Marshal.GetLastWin32Error()); 649 } 635 buffer = Marshal.ReAllocHGlobal(buffer, (IntPtr)(bufferSize *= 2)); 650 636 } 651 637 -
trunk/eraser/Eraser.Util/Win32ErrorCodes.cs
r2642 r2647 98 98 public const int NotAReparsePoint = 4390; 99 99 public const int BadCommand = 22; 100 public const int NotSupported = 50; 100 101 } 101 102 }
Note: See TracChangeset
for help on using the changeset viewer.
