Results 1 to 5 of 5

Thread: Completely delete

  1. #1

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Exclamation

    I want to overwrite all binary data on a harddisk with zeros. - Complete cleaning.

    Any ideas? Perhaps something with API?

    thx, vbzero

  2. #2
    Lively Member
    Join Date
    May 1999
    Posts
    100
    Download PGPfreeware =)

  3. #3
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    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.

  4. #4
    Guest
    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.

  5. #5

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Thumbs up

    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
  •  



Click Here to Expand Forum to Full Width