Changeset 2196
- Timestamp:
- 6/19/2010 1:29:09 AM (3 years ago)
- Location:
- trunk/eraser/Eraser.Util
- Files:
-
- 2 edited
-
NativeMethods/Kernel.cs (modified) (1 diff)
-
PhysicalDriveInfo.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.Util/NativeMethods/Kernel.cs
r2187 r2196 646 646 public const uint FSCTL_LOCK_VOLUME = 0x90018; 647 647 public const uint FSCTL_UNLOCK_VOLUME = 0x9001C; 648 public const uint IOCTL_DISK_DELETE_DRIVE_LAYOUT = 649 (0x00000007 << 16) | ((0x01 | 0x02) << 14) | (0x0040 << 2); 648 650 649 651 [DllImport("Kernel32.dll", SetLastError = true)] -
trunk/eraser/Eraser.Util/PhysicalDriveInfo.cs
r2191 r2196 149 149 150 150 /// <summary> 151 /// Destroys all partitioning information on the drive. 152 /// </summary> 153 public void DeleteDriveLayout() 154 { 155 //Open the drive for read/write access 156 using (SafeFileHandle handle = OpenHandle(FileAccess.ReadWrite, FileShare.ReadWrite, 157 FileOptions.None)) 158 { 159 //Issue the IOCTL_DISK_DELETE_DRIVE_LAYOUT control code 160 uint returnSize = 0; 161 if (!NativeMethods.DeviceIoControl(handle, 162 NativeMethods.IOCTL_DISK_DELETE_DRIVE_LAYOUT, IntPtr.Zero, 0, IntPtr.Zero, 163 0, out returnSize, IntPtr.Zero)) 164 { 165 throw Win32ErrorCode.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); 166 } 167 } 168 } 169 170 /// <summary> 151 171 /// Opens a file with read, write, or read/write access. 152 172 /// </summary>
Note: See TracChangeset
for help on using the changeset viewer.
