Code for Injector; Importing DLL into Listbox

Posts 1–6 of 6 · Page 1 of 1
Code for Injector; Importing DLL into Listbox
Hey all
I'm currently working on an injector at the mo', and i need the code for adding the dll to a listbox. I'm Importing the dll from there like this, tell me if its correct;

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If IO.File.Exists(Application.StartupPath & "\" + ListBox1.Text + ".dll") Then
Dim TargetProcess As Process() = Process.GetProcessesByName("HSUpdate")
If TargetProcess.Length = 0 Then

Else
Timer1.Stop()
Call Inject()
Moved to Visual Basic section.
On Form Load Or Button Click
Code:
  Dim fl() As String
        Dim fn As String
        Dim fp As String
        Dim I As Integer
        fp = "directory for dlls"

        fn = Dir(fp & "*.dll") ' You can change this to a specific file if you only need one dll (as opposed to *.dll it will be filename.dll
        While fn <> ""
            I = I + 1
            ReDim Preserve fl(0 To I)
            fl(I) = fn
            fn = Dir()
        End While

        If I = 0 Then
            MsgBox("Error Control here")
            Exit Sub
        End If
        For I = 1 To UBound(fl)
            ListBox1.Items.Add(fl(I))
        Next
Nextgen your always so confusing lol. Plain and simple


To Load Items
Code:
Dim open As New OpenFileDialog
        open.Multiselect = True
        open.Filter = "DLL Files(*.dll) |*.dll"
        open.CheckFileExists = True
        open.ShowDialog()

        If (open.FileName = "") Then
        Else
            For Each item As String In open.FileNames
                Dim listItem As New ListViewItem
                listItem.Text = item
                Dim subItem As New ListViewItem.ListViewSubItem()
                subItem.Text = My.Computer.FileSystem.GetName(item)
                listItem.SubItems.Add(subItem)
                ListView1.Items.Add(listItem)
            Next
        End If

To Delete Items
Code:
        For Each lrow As ListViewItem In ListView1.SelectedItems
            ListView1.Items.Remove(lrow)
        Next
To Inject The Current Items
Code:
Private Sub Inject()
        Try
            For Each lrow As ListViewItem In ListView1.Items
                Timer1.Stop()
                Dim TargetProcess As Process() = Process.GetProcessesByName(ComboBox1.Text) 'Change to your .exe
                TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
                pszLibFileRemote = lrow.Text
                pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
                TargetBufferSize = 1 + Len(pszLibFileRemote)
                Dim Rtn As Integer
                Dim LoadLibParamAdr As Integer
                LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
                Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
                CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
                CloseHandle(TargetProcessHandle)
                Success(1)
                Me.Close()
            Next
        Catch es As Exception
            Success(2)
            Me.Close()
        End Try
Off topic

I go off my head as far as answering questions to the best I can udnerstand the question, So If I am Always confusing you or you find my answers confusing, feel free to PM me and I will Clear it up.

I don't take advantage to the luxury of copying and pasting answers found on the net or in others code examples here, so it makes it slightly more "complex" for me.

On Topic, He wanted to import a single DLL, not a list of dll's, my answer solves importing all dll's so "Yours" may be optimum here.
wut r u tlkin NG1 is clear as possible
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us