.NET, Development

CreateFileWithCode

Written in 2012 for the Windows versions of the time. Check that the tool or steps still suit your environment before using them.

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

Download: CreateFileWithCode.zip

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

Posted on

Tagged C#

No comments yet

Comments are moderated and appear once approved.