Changeset 1745
- Timestamp:
- 2/3/2010 3:37:13 AM (3 years ago)
- Location:
- branches/eraser6/CodeReview
- Files:
-
- 1 added
- 25 edited
-
. (modified) (1 prop)
-
Eraser.DefaultPlugins/ErasureMethods/FirstLast16KB.cs (modified) (2 diffs)
-
Eraser.DefaultPlugins/FileSystems/Windows.cs (modified) (1 diff)
-
Eraser.Manager/DirectExecutor.cs (modified) (4 diffs)
-
Eraser.Manager/FileSystem.cs (modified) (2 diffs)
-
Eraser.Manager/RemoteExecutor.cs (modified) (2 diffs)
-
Eraser.Manager/Task.cs (modified) (5 diffs)
-
Eraser.Util.Native/OpenHandle.NameResolver.cpp (modified) (1 diff)
-
Eraser.Util/BlackBox.cs (modified) (1 diff)
-
Eraser.Util/Eraser.Util.csproj (modified) (1 diff)
-
Eraser.Util/Security.cs (modified) (2 diffs)
-
Eraser.Util/Shell.cs (added)
-
Eraser.Util/VolumeInfo.cs (modified) (1 diff)
-
Eraser.msbuild (modified) (1 prop)
-
Eraser/BlackBoxMainForm.it.resx (modified) (1 prop)
-
Eraser/BlackBoxUploadForm.it.resx (modified) (1 prop)
-
Eraser/LogForm.cs (modified) (2 diffs)
-
Eraser/MainForm.cs (modified) (1 diff)
-
Eraser/Program.GuiProgram.cs (modified) (1 diff)
-
Eraser/ProgressForm.cs (modified) (2 diffs)
-
Eraser/SchedulerPanel.cs (modified) (3 diffs)
-
Eraser/Strings.NL.resx (modified) (1 diff)
-
Eraser/Strings.en.resx (modified) (1 diff)
-
Eraser/Strings.it.resx (modified) (1 diff)
-
Eraser/Strings.resx (modified) (1 diff)
-
ShellExt/CtxMenu.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview
- Property svn:mergeinfo changed
/branches/eraser6/6.0 merged: 1721,1723,1730,1732,1734-1735,1737-1738,1740,1742 /trunk/eraser6 merged: 1706-1743
- Property svn:mergeinfo changed
-
branches/eraser6/CodeReview/Eraser.DefaultPlugins/ErasureMethods/FirstLast16KB.cs
r1681 r1745 113 113 "limited, since this is a self-limiting erasure method.")); 114 114 115 //If the target stream is shorter than 16kb, just forward it to the default116 // function.117 if (strm.Length < dataSize )115 //If the target stream is shorter than or equal to 32kb, just forward it to 116 //the default function. 117 if (strm.Length < dataSize * 2) 118 118 { 119 119 method.Erase(strm, erasureLength, prng, callback); … … 121 121 } 122 122 123 //We need to intercept the callback function as we run the erasure method 124 //twice on two parts of the file. 125 ErasureMethodProgressFunction customCallback = 126 delegate(long lastWritten, long totalData, int currentPass) 127 { 128 callback(lastWritten, dataSize * 2, currentPass); 129 }; 130 123 131 //Seek to the beginning and write 16kb. 124 132 strm.Seek(0, SeekOrigin.Begin); 125 method.Erase(strm, dataSize, prng, callback );133 method.Erase(strm, dataSize, prng, callback == null ? null: customCallback); 126 134 127 135 //Seek to the end - 16kb, and write. 128 136 strm.Seek(-dataSize, SeekOrigin.End); 129 method.Erase(strm, long.MaxValue, prng, callback );137 method.Erase(strm, long.MaxValue, prng, callback == null ? null : customCallback); 130 138 } 131 139 -
branches/eraser6/CodeReview/Eraser.DefaultPlugins/FileSystems/Windows.cs
r1709 r1745 72 72 private void DeleteFileSystemInfo(FileSystemInfo info) 73 73 { 74 //If the file/directory doesn't exist, pass. 75 if (!info.Exists) 76 return; 77 74 78 //Set the date of the file to be invalid to prevent forensic 75 79 //detection 80 info.Attributes = FileAttributes.NotContentIndexed; 76 81 info.CreationTime = info.LastWriteTime = info.LastAccessTime = MinTimestamp; 77 info.Attributes = FileAttributes.Normal;78 info.Attributes = FileAttributes.NotContentIndexed;79 82 80 83 //Rename the file a few times to erase the entry from the file system -
branches/eraser6/CodeReview/Eraser.Manager/DirectExecutor.cs
r1709 r1745 275 275 throw; 276 276 } 277 catch (ThreadAbortException) 278 { 279 } 277 280 catch (Exception e) 278 281 { … … 417 420 fsManager.EraseClusterTips(VolumeInfo.FromMountPoint(target.Drive), 418 421 method, task.Log, searchProgress, eraseProgress); 419 } 420 422 tipProgress.MarkComplete(); 423 } 424 425 bool lowDiskSpaceNotifications = Shell.LowDiskSpaceNotificationsEnabled; 421 426 info = info.CreateSubdirectory(Path.GetFileName( 422 427 FileSystem.GenerateRandomFileName(info, 18))); … … 427 432 if (info.IsCompressed()) 428 433 info.Uncompress(); 434 435 //Disable the low disk space notifications 436 Shell.LowDiskSpaceNotificationsEnabled = false; 429 437 430 438 ProgressManager mainProgress = new ProgressManager(); … … 515 523 fsManager.DeleteFolder(info); 516 524 tempFiles.Completed = tempFiles.Total; 525 526 //Reset the low disk space notifications 527 Shell.LowDiskSpaceNotificationsEnabled = lowDiskSpaceNotifications; 517 528 } 518 529 -
branches/eraser6/CodeReview/Eraser.Manager/FileSystem.cs
r1711 r1745 114 114 { 115 115 string shadowFile = null; 116 IList<string> entries = ManagerLibrary.Settings.PlausibleDeniabilityFiles; 116 List<string> entries = new List<string>( 117 ManagerLibrary.Settings.PlausibleDeniabilityFiles); 117 118 Prng prng = PrngManager.GetInstance(ManagerLibrary.Settings.ActivePrng); 118 119 do … … 136 137 entries.RemoveAt(index); 137 138 } 138 while (shadowFile == null || shadowFile.Length == 0 );139 while (shadowFile == null || shadowFile.Length == 0 || !File.Exists(shadowFile)); 139 140 shadowFileInfo = new FileInfo(shadowFile); 140 141 } -
branches/eraser6/CodeReview/Eraser.Manager/RemoteExecutor.cs
r1681 r1745 100 100 thread = new Thread(Main); 101 101 serverLock = new Semaphore(maxServerInstances, maxServerInstances); 102 103 thread.Start();104 Thread.Sleep(0);105 102 } 106 103 … … 125 122 126 123 base.Dispose(disposing); 124 } 125 126 public override void Run() 127 { 128 thread.Start(); 129 Thread.Sleep(0); 130 base.Run(); 127 131 } 128 132 -
branches/eraser6/CodeReview/Eraser.Manager/Task.cs
r1709 r1745 456 456 string adsPath = file + ':' + adsName; 457 457 list.Add(adsPath); 458 Util.StreamInfo info = new Util.StreamInfo(adsPath);458 StreamInfo info = new StreamInfo(adsPath); 459 459 totalSize += info.Length; 460 460 } … … 693 693 Regex excludePattern = new Regex(regex, RegexOptions.IgnoreCase); 694 694 foreach (FileInfo file in files) 695 if ((file.Attributes & FileAttributes.ReparsePoint) == 0 && 695 if (file.Exists && 696 (file.Attributes & FileAttributes.ReparsePoint) == 0 && 696 697 excludePattern.Matches(file.FullName).Count == 0) 697 698 { … … 704 705 foreach (FileInfo file in files) 705 706 { 706 if ( (file.Attributes & FileAttributes.ReparsePoint) != 0)707 if (!file.Exists || (file.Attributes & FileAttributes.ReparsePoint) != 0) 707 708 continue; 708 709 … … 807 808 continue; 808 809 809 GetRecyclerFiles(dir, re f result, ref totalSize);810 GetRecyclerFiles(dir, result, ref totalSize); 810 811 } 811 812 } … … 820 821 /// <param name="paths">The list of files to store path information in.</param> 821 822 /// <param name="totalSize">Receives the total size of the files.</param> 822 private void GetRecyclerFiles(DirectoryInfo info, refList<string> paths,823 private void GetRecyclerFiles(DirectoryInfo info, List<string> paths, 823 824 ref long totalSize) 824 825 { 825 826 try 826 827 { 827 foreach (File SystemInfo fsInfo in info.GetFileSystemInfos())828 foreach (FileInfo fileInfo in info.GetFiles()) 828 829 { 829 FileInfo fileInfo = fsInfo as FileInfo; 830 if (fileInfo != null) 831 { 832 totalSize += fileInfo.Length; 833 GetPathADSes(paths, out totalSize, fileInfo.FullName); 834 paths.Add(fileInfo.FullName); 835 } 836 else 837 GetRecyclerFiles((DirectoryInfo)fsInfo, ref paths, ref totalSize); 830 if (!fileInfo.Exists || (fileInfo.Attributes & FileAttributes.ReparsePoint) != 0) 831 continue; 832 833 totalSize += fileInfo.Length; 834 GetPathADSes(paths, out totalSize, fileInfo.FullName); 835 paths.Add(fileInfo.FullName); 838 836 } 837 838 foreach (DirectoryInfo directoryInfo in info.GetDirectories()) 839 if ((directoryInfo.Attributes & FileAttributes.ReparsePoint) == 0) 840 GetRecyclerFiles(directoryInfo, paths, ref totalSize); 839 841 } 840 842 catch (UnauthorizedAccessException e) -
branches/eraser6/CodeReview/Eraser.Util.Native/OpenHandle.NameResolver.cpp
r1686 r1745 88 88 } 89 89 90 #pragma managed(pop)91 92 90 void CreateNameThread(HANDLE& handle, NameResolutionThreadParams& params) 93 91 { -
branches/eraser6/CodeReview/Eraser.Util/BlackBox.cs
r1709 r1745 408 408 { 409 409 return new FileStream(System.IO.Path.Combine(Path, BlackBox.DebugLogFileName), 410 FileMode.Open, FileAccess.Read );410 FileMode.Open, FileAccess.Read, FileShare.Read); 411 411 } 412 412 } -
branches/eraser6/CodeReview/Eraser.Util/Eraser.Util.csproj
r1710 r1745 109 109 <Compile Include="NativeMethods\Sfc.cs" /> 110 110 <Compile Include="ProgressManager.cs" /> 111 <Compile Include="Shell.cs" /> 111 112 <Compile Include="Win32ErrorCodes.cs" /> 112 113 </ItemGroup> -
branches/eraser6/CodeReview/Eraser.Util/Security.cs
r1687 r1745 117 117 118 118 handle = new SafeCryptHandle(); 119 if (NativeMethods.CryptAcquireContext(out handle, string.Empty,119 if (NativeMethods.CryptAcquireContext(out handle, null, 120 120 IntelDefaultProvider, NativeMethods.PROV_INTEL_SEC, 0)) 121 121 { 122 122 return; 123 123 } 124 else if (NativeMethods.CryptAcquireContext(out handle, string.Empty,125 string.Empty, NativeMethods.PROV_RSA_FULL, 0))124 else if (NativeMethods.CryptAcquireContext(out handle, null, 125 null, NativeMethods.PROV_RSA_FULL, 0)) 126 126 { 127 127 return; … … 130 130 { 131 131 //Default keyset doesn't exist, attempt to create a new one 132 if (NativeMethods.CryptAcquireContext(out handle, string.Empty, string.Empty,132 if (NativeMethods.CryptAcquireContext(out handle, null, null, 133 133 NativeMethods.PROV_RSA_FULL, NativeMethods.CRYPT_NEWKEYSET)) 134 134 { -
branches/eraser6/CodeReview/Eraser.Util/VolumeInfo.cs
r1711 r1745 58 58 fileSystemName = new StringBuilder(NativeMethods.MaxPath * sizeof(char)); 59 59 uint serialNumber, maxComponentLength, filesystemFlags; 60 if ( !NativeMethods.GetVolumeInformation(volumeId, volumeName, NativeMethods.MaxPath,60 if (NativeMethods.GetVolumeInformation(volumeId, volumeName, NativeMethods.MaxPath, 61 61 out serialNumber, out maxComponentLength, out filesystemFlags, fileSystemName, 62 62 NativeMethods.MaxPath)) 63 63 { 64 int lastError = Marshal.GetLastWin32Error();65 switch (lastError)66 {67 case Win32ErrorCode.Success:68 case Win32ErrorCode.NotReady:69 case Win32ErrorCode.InvalidParameter: //when the volume given is not mounted.70 case Win32ErrorCode.UnrecognizedVolume:71 break;72 73 default:74 throw Win32ErrorCode.GetExceptionForWin32Error(lastError);75 }76 }77 else78 {79 64 IsReady = true; 80 VolumeLabel = volumeName.ToString(); 81 VolumeFormat = fileSystemName.ToString(); 82 83 //Determine whether it is FAT12 or FAT16 84 if (VolumeFormat == "FAT") 85 { 86 uint clusterSize, sectorSize, freeClusters, totalClusters; 87 if (NativeMethods.GetDiskFreeSpace(VolumeId, out clusterSize, 88 out sectorSize, out freeClusters, out totalClusters)) 89 { 90 if (totalClusters <= 0xFF0) 91 VolumeFormat += "12"; 92 else 93 VolumeFormat += "16"; 94 } 65 } 66 67 //If GetVolumeInformation returns zero some of the information may 68 //have been stored, so we just try to extract it. 69 VolumeLabel = volumeName.Length == 0 ? null : volumeName.ToString(); 70 VolumeFormat = fileSystemName.Length == 0 ? null : fileSystemName.ToString(); 71 72 //Determine whether it is FAT12 or FAT16 73 if (VolumeFormat == "FAT") 74 { 75 uint clusterSize, sectorSize, freeClusters, totalClusters; 76 if (NativeMethods.GetDiskFreeSpace(VolumeId, out clusterSize, 77 out sectorSize, out freeClusters, out totalClusters)) 78 { 79 if (totalClusters <= 0xFF0) 80 VolumeFormat += "12"; 81 else 82 VolumeFormat += "16"; 95 83 } 96 84 } -
branches/eraser6/CodeReview/Eraser.msbuild
- Property svn:mergeinfo changed
/trunk/eraser6/Eraser.msbuild merged: 1706-1743
- Property svn:mergeinfo changed
-
branches/eraser6/CodeReview/Eraser/BlackBoxMainForm.it.resx
- Property svn:mergeinfo changed
/trunk/eraser6/Eraser/BlackBoxMainForm.it.resx (added) merged: 1706-1743
- Property svn:mergeinfo changed
-
branches/eraser6/CodeReview/Eraser/BlackBoxUploadForm.it.resx
- Property svn:mergeinfo changed
/trunk/eraser6/Eraser/BlackBoxUploadForm.it.resx (added) merged: 1706-1743
- Property svn:mergeinfo changed
-
branches/eraser6/CodeReview/Eraser/LogForm.cs
r1681 r1745 78 78 private void task_NewSession(object sender, EventArgs e) 79 79 { 80 if ( !IsHandleCreated)80 if (IsDisposed || !IsHandleCreated) 81 81 return; 82 82 if (InvokeRequired) … … 91 91 private void task_Logged(object sender, LogEventArgs e) 92 92 { 93 if ( !IsHandleCreated)93 if (IsDisposed || !IsHandleCreated) 94 94 return; 95 95 if (InvokeRequired) -
branches/eraser6/CodeReview/Eraser/MainForm.cs
r1681 r1745 48 48 contentPanel.Controls.Add(SchedulerPage); 49 49 contentPanel.Controls.Add(SettingsPage); 50 if (!IsHandleCreated) 51 CreateHandle(); 50 52 51 53 Theming.ApplyTheme(this); -
branches/eraser6/CodeReview/Eraser/Program.GuiProgram.cs
r1521 r1745 158 158 S.IsRightToLeft(null) ? MessageBoxOptions.RtlReading : 0); 159 159 } 160 catch (IOException ex) 161 { 162 MessageBox.Show(S._("Another instance of Eraser is already running but " + 163 "cannot be connected to.\n\nThe error returned was: {0}", ex.Message, 164 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error, 165 MessageBoxDefaultButton.Button1, 166 S.IsRightToLeft(null) ? MessageBoxOptions.RtlReading : 0)); 167 } 160 168 catch (TimeoutException) 161 169 { -
branches/eraser6/CodeReview/Eraser/ProgressForm.cs
r1681 r1745 65 65 private void task_ProgressChanged(object sender, ProgressChangedEventArgs e) 66 66 { 67 if ( !IsHandleCreated)67 if (IsDisposed || !IsHandleCreated) 68 68 return; 69 69 if (InvokeRequired) … … 91 91 private void task_TaskFinished(object sender, TaskEventArgs e) 92 92 { 93 if ( !IsHandleCreated)93 if (IsDisposed || !IsHandleCreated) 94 94 return; 95 95 if (InvokeRequired) -
branches/eraser6/CodeReview/Eraser/SchedulerPanel.cs
r1701 r1745 45 45 InitializeComponent(); 46 46 Theming.ApplyTheme(schedulerDefaultMenu); 47 CreateHandle(); 47 if (!IsHandleCreated) 48 CreateHandle(); 48 49 49 50 //Populate the scheduler list-view with the current task list … … 187 188 void task_TaskStarted(object sender, TaskEventArgs e) 188 189 { 189 if ( scheduler.InvokeRequired)190 if (InvokeRequired) 190 191 { 191 192 Invoke((EventHandler<TaskEventArgs>)task_TaskStarted, sender, e); … … 213 214 //Make sure we handle the event in the main thread as this requires 214 215 //GUI calls. 215 if ( scheduler.InvokeRequired)216 if (InvokeRequired) 216 217 { 217 218 Invoke((EventHandler<ProgressChangedEventArgs>)task_ProgressChanged, sender, e); -
branches/eraser6/CodeReview/Eraser/Strings.NL.resx
r1681 r1745 175 175 <value>(Untranslated)</value> 176 176 </data> 177 <data name="Another instance of Eraser is already running but cannot be connected to.\n\nThe error returned was: {0}Eraser" xml:space="preserve"> 178 <value>(Untranslated)</value> 179 </data> 177 180 <data name="Total: {0,2:#0.00%}" xml:space="preserve"> 178 181 <value>(Untranslated)</value> -
branches/eraser6/CodeReview/Eraser/Strings.en.resx
r1681 r1745 175 175 <value>Another instance of Eraser is already running but it is running with higher privileges than this instance of Eraser.\n\nEraser will now exit.</value> 176 176 </data> 177 <data name="Another instance of Eraser is already running but cannot be connected to.\n\nThe error returned was: {0}Eraser" xml:space="preserve"> 178 <value>(Untranslated)</value> 179 </data> 177 180 <data name="Total: {0,2:#0.00%}" xml:space="preserve"> 178 181 <value>Total: {0,2:#0.00%}</value> -
branches/eraser6/CodeReview/Eraser/Strings.it.resx
r1681 r1745 175 175 <value>Un'altra occorrenza di Eraser è già in esecuzione, ma con privilegi più elevati di questa.\n\nEraser adesso si chiuderà.</value> 176 176 </data> 177 <data name="Another instance of Eraser is already running but cannot be connected to.\n\nThe error returned was: {0}Eraser" xml:space="preserve"> 178 <value>(Untranslated)</value> 179 </data> 177 180 <data name="Total: {0,2:#0.00%}" xml:space="preserve"> 178 181 <value>Totale: {0,2:#0.00%}</value> -
branches/eraser6/CodeReview/Eraser/Strings.resx
r1681 r1745 175 175 <value>Another instance of Eraser is already running but it is running with higher privileges than this instance of Eraser.\n\nEraser will now exit.</value> 176 176 </data> 177 <data name="Another instance of Eraser is already running but cannot be connected to.\n\nThe error returned was: {0}Eraser" xml:space="preserve"> 178 <value>Another instance of Eraser is already running but cannot be connected to.\n\nThe error returned was: {0}Eraser</value> 179 </data> 177 180 <data name="Total: {0,2:#0.00%}" xml:space="preserve"> 178 181 <value>Total: {0,2:#0.00%}</value> -
branches/eraser6/CodeReview/ShellExt/CtxMenu.cpp
r1681 r1745 954 954 NULL, NULL, &startupInfo, &processInfo)) 955 955 { 956 //Why did we fail? Is it because we have too many files 956 957 if (GetLastError() == ERROR_FILENAME_EXCED_RANGE) 957 958 throw FormatString(LoadString(IDS_ERROR_TOO_MANY_FILES)); 959 960 //Or if elevation is required for this operation 961 else if (GetLastError() == ERROR_ELEVATION_REQUIRED) 962 return RunEraser(action, parameters, true, parent, show); 963 964 //Or otherwise? 958 965 else 959 966 throw FormatString(LoadString(IDS_ERROR_MISC), FormatError().c_str());
Note: See TracChangeset
for help on using the changeset viewer.
