Changeset 1705
- Timestamp:
- 1/27/2010 5:58:28 AM (3 years ago)
- Location:
- branches/eraser6/CodeReview/Eraser.Util
- Files:
-
- 5 edited
-
File.cs (modified) (1 diff)
-
NtfsApi.cs (modified) (1 diff)
-
StreamInfo.cs (modified) (1 diff)
-
VolumeInfo.cs (modified) (10 diffs)
-
Win32ErrorCodes.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/File.cs
r1681 r1705 163 163 throw new IOException(string.Format(CultureInfo.CurrentCulture, 164 164 "Could not load file icon from {0}", path), 165 Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()));165 Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error())); 166 166 } 167 167 -
branches/eraser6/CodeReview/Eraser.Util/NtfsApi.cs
r1681 r1705 75 75 } 76 76 77 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());77 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 78 78 } 79 79 } -
branches/eraser6/CodeReview/Eraser.Util/StreamInfo.cs
r1701 r1705 362 362 //Check that the handle is valid 363 363 if (handle.IsInvalid) 364 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());364 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 365 365 366 366 //Return the FileStream -
branches/eraser6/CodeReview/Eraser.Util/VolumeInfo.cs
r1701 r1705 72 72 73 73 default: 74 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());74 throw Win32ErrorCode.GetExceptionForWin32Error(lastError); 75 75 } 76 76 } … … 326 326 break; 327 327 default: 328 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error()); 328 throw Win32ErrorCode.GetExceptionForWin32Error( 329 Marshal.GetLastWin32Error()); 329 330 } 330 331 } … … 382 383 } 383 384 384 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());385 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 385 386 } 386 387 } … … 400 401 } 401 402 402 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());403 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 403 404 } 404 405 } … … 423 424 } 424 425 425 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());426 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 426 427 } 427 428 } … … 445 446 } 446 447 447 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());448 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 448 449 } 449 450 } … … 462 463 } 463 464 464 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());465 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 465 466 } 466 467 } … … 479 480 } 480 481 481 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());482 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 482 483 } 483 484 } … … 587 588 //Check that the handle is valid 588 589 if (handle.IsInvalid) 589 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());590 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 590 591 591 592 //Return the FileStream … … 646 647 //Check that the handle is valid 647 648 if (handle.IsInvalid) 648 throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());649 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 649 650 650 651 //This only works if the user has turned on the disk performance -
branches/eraser6/CodeReview/Eraser.Util/Win32ErrorCodes.cs
r1701 r1705 25 25 using System.Runtime.InteropServices; 26 26 using System.IO; 27 using System.ComponentModel; 27 28 28 29 namespace Eraser.Util … … 53 54 case NoError: return null; 54 55 case SharingViolation: return new IOException(); 56 } 55 57 56 default: 57 int HR = GetHRForWin32Error(errorCode); 58 return Marshal.GetExceptionForHR(HR); 59 } 58 int HR = GetHRForWin32Error(errorCode); 59 Exception exception = Marshal.GetExceptionForHR(HR); 60 if (exception.GetType() == typeof(COMException)) 61 throw new Win32Exception(errorCode); 62 else 63 throw exception; 60 64 } 61 65
Note: See TracChangeset
for help on using the changeset viewer.
