Tag Archives: cheap dotnet tutorial

ByAlexia Pamelov

Cheap Windows ASP.NET Tutorial – Tips Run external .NET Program from RAM Memory

CheapWindowsHosting.com | Run external app directly from RAM. You can load the specific file into a Byte [] Array with a StreamReader () or even download it from WEB via a direct link provided.

The point of this technique is to maintain anonymity to a fragile file, thus leaving no chance to a reverse engineer to crack the details.

Also note, to keep the variables such as the one referencing the MethodInfo() on a Class basis. You then should Dispose() or set to Nothing these variables at the FormClosing() Event to prevent memory leak.

programmer vs artist

Tips Run external .NET Program from RAM Memory

Dim method As System.Reflection.MethodInfo
Sub Run
        Dim bb() As Byte = IO.File.ReadAllBytes("file.exe")

            Dim a As System.Reflection.Assembly = System.Reflection.Assembly.Load(bb)

           'or a = Reflection.Assembly.Load(New WebClient().DownloadData("https://...."))
            method = a.EntryPoint
            If (Not method Is Nothing) Then

                Dim o As Object = a.CreateInstance(method.Name)
                method.Invoke(o, Nothing)

            'if your app receives parameters
            'method.Invoke(o, New Object() {New String(){"Hello}})
                Throw New NullReferenceException("method is null.")
            End If

        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & "File length: = " & bb.Length.ToString)
        End Try
End Sub

If your app is WinForms and not ConsoleApplication, then follow the steps below:

Your external application needs to start from a Main() Sub to be compatible with this. Otherwise, change the solution property of your external app:

  • Disable ApplicationFramework
  • Add new module to your project (Module1)
  • Select ‘STARTUP OBJECT’ Module1
  • Add this code to Module1
Public Sub Main()
     Application.Run(New Form1)
     'Form1 is your first WinForm that your app displays
End Sub

 or if your app receives parameters:

Public Sub Main(ByVal args As String())
     Application.Run(New Form1)
     'Form1 is your first WinForm that your app displays
End Sub

 I hope this post helpful for you 🙂