Showing posts with label EXE in memory. Show all posts
Showing posts with label EXE in memory. Show all posts

Friday, 25 January 2013

VB.net .EXE in Memory

VB.net .EXE in Memory

First of all for this to work you will need to make a Windows Form Application.

Example 1:















Then Disable Application Framework:

Example 2:

















' Now We can Create Sub Main.
' Create A new Module, Add the following Code.

Sub Main(Byval args() As String)
Dim X As New Form1
X.ShowDialog
End Sub

' On Example 2 Change the Start up object to Sub Main

' Now This is the .EXE you want to load in Memory...
' Build...
' Locate the .EXE and Rename to .TXT
' Make a New Project.
' On Example 2, Click on the Resource Tab on the Left.
'














' Add your .TXT File.
' Now we have the File.

' Double Click on the Form.
' Should See this.


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

' Then Type This Code.


Dim a As System.Reflection.Assembly = System.Reflection.Assembly.Load(Encoding.Default.GetBytes(My.Resources.#YourExeFileName#)))
' search for the Entry Point
Dim method As MethodInfo = a.EntryPoint
If method IsNot Nothing Then
Dim o As Object = a.CreateInstance(method.Name)
Dim args() As String = Nothing
method.Invoke(o, New Object() {args})
End If
Me.Close()

' Then Run