Changeset 1551 for branches/eraser6/CodeReview/Eraser.Util/VolumeInfo.cs
- Timestamp:
- 1/18/2010 5:23:07 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.Util/VolumeInfo.cs
r1550 r1551 52 52 pathNamesBuffer, (uint)pathNamesBuffer.Capacity, out returnLength)) 53 53 { 54 if (Marshal.GetLastWin32Error() == 234 /*ERROR_MORE_DATA*/)54 if (Marshal.GetLastWin32Error() == (int)Win32ErrorCodes.MoreData) 55 55 pathNamesBuffer.EnsureCapacity((int)returnLength); 56 56 else … … 93 93 { 94 94 int lastError = Marshal.GetLastWin32Error(); 95 switch ( lastError)96 { 97 case 0: //ERROR_NO_ERROR98 case 21: //ERROR_NOT_READY99 case 87: //ERROR_INVALID_PARAMETER:when the volume given is not mounted.100 case 1005: //ERROR_UNRECOGNIZED_VOLUME95 switch ((Win32ErrorCodes)lastError) 96 { 97 case Win32ErrorCodes.Success: 98 case Win32ErrorCodes.NotReady: 99 case Win32ErrorCodes.InvalidParameter: //when the volume given is not mounted. 100 case Win32ErrorCodes.UnrecognizedVolume: 101 101 break; 102 102 … … 148 148 149 149 //Close the handle 150 if (Marshal.GetLastWin32Error() == 18 /*ERROR_NO_MORE_FILES*/)150 if (Marshal.GetLastWin32Error() == (int)Win32ErrorCodes.NoMoreFiles) 151 151 NativeMethods.FindVolumeClose(handle); 152 152 … … 177 177 else 178 178 { 179 switch ( Marshal.GetLastWin32Error())179 switch ((Win32ErrorCodes)Marshal.GetLastWin32Error()) 180 180 { 181 case 1: //ERROR_INVALID_FUNCTION182 case 2: //ERROR_FILE_NOT_FOUND183 case 3: //ERROR_PATH_NOT_FOUND184 case 4390: //ERROR_NOT_A_REPARSE_POINT181 case Win32ErrorCodes.InvalidFunction: 182 case Win32ErrorCodes.FileNotFound: 183 case Win32ErrorCodes.PathNotFound: 184 case Win32ErrorCodes.NotAReparsePoint: 185 185 break; 186 186 default: … … 194 194 195 195 throw Marshal.GetExceptionForHR(KernelApi.GetHRForWin32Error( 196 4390 /*ERROR_NOT_A_REPARSE_POINT*/));196 (int)Win32ErrorCodes.NotAReparsePoint)); 197 197 } 198 198 … … 272 272 return totalNumberOfFreeBytes != freeBytesAvailable; 273 273 } 274 else if (Marshal.GetLastWin32Error() == 21 /*ERROR_NOT_READY*/)274 else if (Marshal.GetLastWin32Error() == (int)Win32ErrorCodes.NotReady) 275 275 { 276 276 //For the lack of more appropriate responses. … … 362 362 363 363 //Close the handle 364 if (Marshal.GetLastWin32Error() == 18 /*ERROR_NO_MORE_FILES*/)364 if (Marshal.GetLastWin32Error() == (int)Win32ErrorCodes.NoMoreFiles) 365 365 NativeMethods.FindVolumeMountPointClose(handle); 366 366
Note: See TracChangeset
for help on using the changeset viewer.
