CreateFileWithCode

This utility can be used to recreate any file at runtime.

It works by reading the input file with binaryreader and creates a function that can be called to recreate the input file.

Usage: CreateFileWithCode INPUTFILE > OUTPUTFILE

Attachment(s): [list-attachments]

[sourcecode language=”vb”]
Private Sub CreateFile()
Try
Dim objBinaryWriter As System.IO.BinaryWriter

objBinaryWriter = New System.IO.BinaryWriter(System.IO.File.Open("CreateFileWithCode.exe", System.IO.FileMode.Create))

Dim intValue As Int32
Dim arrValues() As Int32 = { _
9460301, _
3, _
4, _
65535, _
184, _
0, _
64, _
0, _
0, _
0, _
0, _
0, _
0, _
0, _
0, _
128, _
247078670, _
-855002112, _
1275181089, _


0 _
}
For Each intValue In arrValues
objBinaryWriter.Write(intValue)
Next
Catch ex As Exception

End Try
End Sub
[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.