Jump to content

VB6.0:Tutorial, WipeFile

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Introduction:-
Welcome to another tutorial of VB, in this tutorial I will tell you on how to delete a program permanently! how? simple just first we open the file replace it with and letter, number or symbol we want then delete it! So even if the file is brought back after deletion with any special software it will still be not accessible!

Solution:-
Well I will show you just the basics, because in my original program I made more but here I will just place the basic for newbies to understand better!
Ok so first we have to include the component of the CommonDialog here is how:-
Posted Image

and Select:-
Posted Image

Then Add a Command button

Add This Code:-


Sub Wipe(FileName As String)

On Error GoTo err

  Dim Part1 As String

  Dim hFileHandle As Integer, i As Long

  Const SIZE = 1024

  Part1 = String(SIZE, "#")

  hFileHandle = FreeFile

    

    Open FileName For Binary As hFileHandle

    For i = 1 To hFileHandle

    Put hFileHandle, , Part1

    Next i

    Close hFileHandle

Exit Sub

err:

   Exit Sub

End Sub


Private Sub Command1_Click()

CommonDialog1.ShowOpen

Wipe CommonDialog1.FileName

Kill CommonDialog1.FileName

MsgBox "File Deleted Safely", vbInformation, "WipeFile"

End Sub


Explanation:-

Sub Wipe(FileName As String)

This is the sub we will call to delete the file when pressing the command button

On Error GoTo err
For a better explanation read this tutorial:-


  Dim Part1 As String

  Dim hFileHandle As Integer, i As Long

  Const SIZE = 1024

  Part1 = String(SIZE, "#")

  hFileHandle = FreeFile


Here we are declaring some variables etc.. and assigning some things
the important thing here is the line 'Part1 = String(SIZE, "#")' the symbol # means what you want to replace every bit with! you can change it to 0 or so! for example if you try this on an exe file and then open it with a HEX viewer all you see will be that symbol!
like this:-
Posted Image


    Open FileName For Binary As hFileHandle

    For i = 1 To hFileHandle

    Put hFileHandle, , Part1

    Next i

    Close hFileHandle

Here we are opening the file as binary then we loop to replace everything with a # when everything is replaced we close the file!


Private Sub Command1_Click()

CommonDialog1.ShowOpen

Wipe CommonDialog1.FileName

Kill CommonDialog1.FileName

MsgBox "File Deleted Safely", vbInformation, "WipeFile"

End Sub

When we press the command button the Open Dialog will be showed, then you choose a file to delete "WARNING FILE WILL BE PERMANENTLY DELETED!!" and after that we call the Sub Wipe to replace it with the symbol after we kill the file ( delete ) and then it shows a msgbox saying that the file was deleted!

NOTE:- To see that this really works delete the line that says 'Kill CommonDialog1.FileName' then go to that file, open it with a hex editor and you will see that this really works!! all you will see is that symbol you specify!!
As i already showed you here is what you will see:-
Posted Image

Conclusion:-
As Always Feedback is welcome and the full source is attached!! NOTE:- The source code is a little modified and contains more functions! If you don't have VB installed and can't run the code but you need the program, just request here and I will upload the EXE file for those without VB installed

Attached Files



#2
Cosmet

Cosmet

    Learning Programmer

  • Members
  • PipPipPip
  • 58 posts
Wow, nice tutorial! I was thinking about creating this myself the other day. This basically overwrites the file with bad data so if it is recovered, it means nothing! Cheers!

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Yup thats the purpose! and it works!!

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Nice tutorial, rep left.

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts

Jordan said:

Nice tutorial, rep left.

Thanks for that :)

#6
hackimi

hackimi

    Newbie

  • Members
  • Pip
  • 1 posts
thanks for view code

#7
K3Y

K3Y

    Newbie

  • Members
  • PipPip
  • 17 posts
great tut, thanks


easy to follow, and it will come into use into the program im writing =D

cheers dude

#8
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Welcome mate.

What program is that?

#9
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Um, a program deletion program? :)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#10
AcroneShadow

AcroneShadow

    Newbie

  • Members
  • PipPip
  • 16 posts
ooo very good. as always thanks a lot for the post

#11
Zizooooo

Zizooooo

    Newbie

  • Members
  • PipPip
  • 15 posts
Very nice you really inspire me TcM

greetings
Zizooooo