Changeset 2178 for trunk/eraser/Eraser.Util/VolumeInfo.cs
- Timestamp:
- 6/18/2010 6:44:31 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/eraser/Eraser.Util/VolumeInfo.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Util/VolumeInfo.cs
r2177 r2178 98 98 { 99 99 uint returnLength = 0; 100 StringBuilder pathNamesBuffer = new StringBuilder(); 101 pathNamesBuffer.EnsureCapacity(NativeMethods.MaxPath); 100 char[] pathNamesBuffer = new char[NativeMethods.MaxPath]; 102 101 while (!NativeMethods.GetVolumePathNamesForVolumeName(VolumeId, 103 pathNamesBuffer, (uint)pathNamesBuffer. Capacity, out returnLength))102 pathNamesBuffer, (uint)pathNamesBuffer.Length, out returnLength)) 104 103 { 105 104 int errorCode = Marshal.GetLastWin32Error(); … … 110 109 return result; 111 110 case Win32ErrorCode.MoreData: 112 pathNamesBuffer .EnsureCapacity((int)returnLength);111 pathNamesBuffer = new char[pathNamesBuffer.Length * 2]; 113 112 break; 114 113 default: … … 117 116 } 118 117 119 if (pathNamesBuffer.Length < returnLength) 120 pathNamesBuffer.Length = (int)returnLength; 121 pathNames = pathNamesBuffer.ToString().Substring(0, (int)returnLength); 118 pathNames = new string(pathNamesBuffer, 0, (int)returnLength); 122 119 } 123 120
Note: See TracChangeset
for help on using the changeset viewer.
