|
-
Nov 17th, 2000, 01:42 PM
#1
Thread Starter
Hyperactive Member
I want to overwrite all binary data on a harddisk with zeros. - Complete cleaning.
Any ideas? Perhaps something with API?
thx, vbzero
-
Nov 17th, 2000, 02:47 PM
#2
Lively Member
-
Nov 17th, 2000, 04:06 PM
#3
Guru
I guess you could open the drive as binary mode with the CreateFile API and then use WriteFile to write zeroes.
For some reason, I don't want to test this.
-
Nov 18th, 2000, 11:32 PM
#4
You could use the SHFormatDrive api function.
I think I found this code on the forums..from Mark Sreeves.
Code:
Private Declare Function SHFormatDrive Lib "shell32" _
(ByVal hwnd As Long, ByVal Drive As Long, ByVal fmtID As Long, _
ByVal options As Long) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias _
"GetDriveTypeA" (ByVal nDrive As String) As Long
Private Sub Command1_Click()
Dim DriveLetter$, DriveNumber&, DriveType&
Dim RetVal&, RetFromMsg%
DriveLetter = UCase(Drive1.Drive)
DriveNumber = (Asc(DriveLetter) - 65) ' Change letter to Number: A=0
DriveType = GetDriveType(DriveLetter)
If DriveType = 2 Then 'Floppies, etc
RetVal = SHFormatDrive(Me.hwnd, DriveNumber, 0&, 0&
Else
RetFromMsg = MsgBox("This drive is NOT a removeable" & vbCrLf & _
"drive! Format this drive?", 276, "SHFormatDrive Example")
Select Case RetFromMsg
Case 6 'Yes
' UnComment to do it...
'RetVal = SHFormatDrive(Me.hwnd, DriveNumber, 0&, 0&
Case 7 'No
' Do nothing
End Select
End If
End Sub
Private Sub Command2_Click()
' DiskCopyRunDll takes two parameters- From and To
Dim DriveLetter$, DriveNumber&, DriveType&
Dim RetVal&, RetFromMsg&
DriveLetter = UCase(Drive1.Drive)
DriveNumber = (Asc(DriveLetter) - 65)
DriveType = GetDriveType(DriveLetter)
If DriveType = 2 Then 'Floppies, etc
RetVal = Shell("rundll32.exe diskcopy.dll,DiskCopyRunDll " _
& DriveNumber & "," & DriveNumber, 1) 'Notice space after
Else ' Just in Case 'DiskCopyRunDll
RetFromMsg = MsgBox("Only floppies can" & vbCrLf & _
"be diskcopied!", 64, "DiskCopy Example")
End If
End Sub
'Add 1 ListDrive name Drive1
Private Sub Drive1_Change()
Dim DriveLetter$, DriveNumber&, DriveType&
DriveLetter = UCase(Drive1.Drive)
DriveNumber = (Asc(DriveLetter) - 65)
DriveType = GetDriveType(DriveLetter)
If DriveType = 2 Then 'Floppies, etc
Command2.Enabled = False
Else
Command2.Enabled = True
End If
End Sub
Disclaimer: I take no responsibility for your actions..blah blah blah.
-
Nov 19th, 2000, 07:09 AM
#5
Thread Starter
Hyperactive Member
Thanks again!
zhx, vbzero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|