Changeset 1638


Ignore:
Timestamp:
1/22/2010 5:27:54 AM (5 years ago)
Author:
lowjoel
Message:

Forward port from Eraser 6.0: Fixed exception when the filesystem object being erased is non-existent (i.e. when a task for erasing a removable drive was created, drive was removed and task executed)

  • StreamInfo? will have the Exists property return false if the directory containing the stream is not found either (this was an oversight)
  • VolumeInfo? will not throw a COMException when the the path is not a reparse point and if the provided mountpoint is non-existent.
Location:
trunk/eraser6
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6

  • trunk/eraser6/Eraser.Manager/DirectExecutor.cs

    r1611 r1638  
    568568                    new ProgressChangedEventArgs(step, 
    569569                        new TaskProgressChangedEventArgs(paths[i], 0, method.Passes))); 
    570                  
    571                 //Get the filesystem provider to handle the secure file erasures 
     570 
     571                //Check that the file exists - we do not want to bother erasing nonexistant files 
    572572                StreamInfo info = new StreamInfo(paths[i]); 
    573                 FileSystem fsManager = FileSystemManager.Get( 
    574                     VolumeInfo.FromMountpoint(info.DirectoryName)); 
    575  
    576                 //Check that the file exists - we do not want to bother erasing nonexistant files 
    577573                if (!info.Exists) 
    578574                { 
     
    581577                    continue; 
    582578                } 
     579 
     580                //Get the filesystem provider to handle the secure file erasures 
     581                FileSystem fsManager = FileSystemManager.Get( 
     582                    VolumeInfo.FromMountpoint(info.DirectoryName)); 
    583583 
    584584                bool isReadOnly = false; 
  • trunk/eraser6/Eraser.Util/StreamInfo.cs

    r1360 r1638  
    134134                    if (!handle.IsInvalid) 
    135135                        return true; 
    136                     else if (Marshal.GetLastWin32Error() == 2 /*ERROR_FILE_NOT_FOUND*/) 
     136                    else if (Marshal.GetLastWin32Error() == 2 /*ERROR_FILE_NOT_FOUND*/ || 
     137                        Marshal.GetLastWin32Error() == 3 /*ERROR_PATH_NOT_FOUND*/) 
    137138                        return false; 
    138139 
  • trunk/eraser6/Eraser.Util/VolumeInfo.cs

    r1360 r1638  
    178178            StringBuilder volumeID = new StringBuilder(50 * sizeof(char)); 
    179179 
     180            //Verify that the mountpoint given exists; if it doesn't we'll raise 
     181            //a PathNotFound exception. 
     182            if (!mountpointDir.Exists) 
     183                throw new DirectoryNotFoundException(); 
     184 
    180185            do 
    181186            { 
Note: See TracChangeset for help on using the changeset viewer.