Changeset 1873 for trunk/eraser6/Eraser.Util/VolumeInfo.cs
- Timestamp:
- 3/1/2010 9:52:43 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/eraser6/Eraser.Util/VolumeInfo.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.Util/VolumeInfo.cs
r1867 r1873 620 620 //Check that the handle is valid 621 621 if (handle.IsInvalid) 622 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 622 { 623 int errorCode = Marshal.GetLastWin32Error(); 624 handle.Close(); 625 throw Win32ErrorCode.GetExceptionForWin32Error(errorCode); 626 } 623 627 624 628 //Return the FileStream … … 660 664 if (openPath.Length > 0 && openPath[openPath.Length - 1] == '\\') 661 665 openPath = openPath.Remove(openPath.Length - 1); 662 SafeFileHandle result = NativeMethods.CreateFile(openPath, access, 663 (uint)share, IntPtr.Zero, (uint)FileMode.Open, (uint)options, IntPtr.Zero); 664 if (result.IsInvalid) 665 { 666 int errorCode = Marshal.GetLastWin32Error(); 667 result.Close(); 668 throw Win32ErrorCode.GetExceptionForWin32Error(errorCode); 669 } 670 671 return result; 666 return NativeMethods.CreateFile(openPath, access, (uint)share, IntPtr.Zero, 667 (uint)FileMode.Open, (uint)options, IntPtr.Zero); 672 668 } 673 669
Note: See TracChangeset
for help on using the changeset viewer.
