Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [HELP] Injector DLL

[HELP] Injector DLL

Posts 1–15 of 21 · Page 1 of 2
ED
edinho101
[HELP] Injector DLL
I need to put a checkbox that when checked he auto inject

Code:
Public Class Form1

    'for reading/writing the listbox content
    Dim sFile As String

    'declare stuffz for the injection

    Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer

    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)

    Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (ByVal hObject As Integer) As Integer


    Private Sub inject()
        Dim LoadLibParamAdr As Integer
        Dim Rtn As Integer
        Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)

        On Error GoTo 1 ' If error occurs, app will go below to "1:"

        TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)

        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")

        'count each listbox item
        For i = 0 To ListBox1.Items.Count - 1


            If selected.Checked = True Then
                pszLibFileRemote = ListBox1.SelectedItem
            Else
                pszLibFileRemote = ListBox1.Items.Item(i)
            End If


            TargetBufferSize = 1 + Len(pszLibFileRemote)


            LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
            Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
            CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
        Next i

        CloseHandle(TargetProcessHandle)
1:      labelx24.ForeColor = Color.Red
        labelx24.Text = "Erro ocurrido" 'error
    End Sub

    Public Sub ListBox_Save(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamWriter
        Dim i As Short

        'create a new streamwriter
        oStream = New IO.StreamWriter(sFile)

        'count each listbox item

        For i = 0 To ListBox.Items.Count - 1
            oStream.WriteLine(ListBox.Items(i))
        Next
        'close streamwriter
        oStream.Close()
    End Sub

    Public Sub ListBox_Read(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamReader
        Dim sLine As String

        ' Clear listbox
        ListBox.Items.Clear()

        ' Check if file exists
        Dim oFile As New IO.FileInfo(sFile)

        'if the list.dat exists then read it...
        If oFile.Exists() = True Then
            oStream = New IO.StreamReader(sFile)
            ' read file
            Do
                'read each line
                sLine = oStream.ReadLine()
                If IsNothing(sLine) Then Exit Do
                'add items to the listbox
                ListBox.Items.Add(sLine)
                'loop until it's done
            Loop
            'close the stream
            oStream.Close()
        End If
    End Sub

    Private Sub savelb()
        'save a list.dat with listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Save(ListBox1, sFile)
    End Sub

    Private Sub loadlb()
        'load a list.dat to fill in listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Read(ListBox1, sFile)
    End Sub

    Public Function IsProcessOpen(ByVal name As String) As Boolean

        'if isprocessopen("process") then...
        'if not isprocessopen("process") then...


        'get all current running processes
        For Each clsProcess As Process In Process.GetProcesses

            If clsProcess.ProcessName.Contains(name) Then


                Return True

            End If
        Next
        ' Do nothing 

        Return False
    End Function

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

        'check if process is running
        If Not IsProcessOpen(txtprocess.Text) Then
            labelx24.ForeColor = Color.Red
            labelx24.Text = "Inicie o processo"
        Else
            labelx24.ForeColor = Color.Green
            labelx24.Text = "Processo encontrado"
        End If
    End Sub

    Private Sub txtprocess_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtprocess.TextChanged
        'save current process textbox text in settings
        My.Settings.processs = txtprocess.Text

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub inject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdinject.Click

        'declare a process
        Try
            Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)


            'if txtprocess.text = ""
            If TargetProcess.Length = 0 Then
                MsgBox("Esperando por " & txtprocess.Text)
            Else

                'do injection
                Call inject()


                labelx24.Text = "Dll injetada com sucesso"
                Timer1.Stop()

            End If
        Catch
        End Try

        'save listbox content
        savelb()

        'set the process
        My.Settings.processs = txtprocess.Text

        'save settings
        My.Settings.Save()
        My.Settings.Reload()

        'close if 'close checkbox' is checked
        If closebox.Checked = True Then
            Me.Close()
        End If

    End Sub

    Private Sub selectdll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dll.Click

        'only .dlls files are selectable
        opf.Title = "Escolha a .dll"
        opf.Filter = "DLL (*.DLL)|*.Dll"
        opf.Multiselect = True

        'open the open file dialog
        opf.ShowDialog()
        'add the .dll to the listbox


        For Each item As String In opf.FileNames
            If Not ListBox1.Items.Contains(item) Then
                If Not opf.FileName = "OpenFileDialog1" Then



                    ListBox1.Items.Add(item)


                    ' dll.Text = System.IO.Path.GetFileName(opf.FileName)


                End If
            End If

        Next item

        'save listbox content
        savelb()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'load listbox content
        loadlb()

        'process textbox
        txtprocess.Text = My.Settings.processs

        'check/uncheck checkboxes
        selected.Checked = My.Settings.selectedonly
        closebox.Checked = My.Settings.close
    End Sub

    Private Sub clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
        'clear listbox(obviously)
        ListBox1.Items.Clear()

        'save listbox content
        savelb()
    End Sub


    Private Sub removeselected_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrs.Click
        'remove the selected item
        Try
            If ListBox1.SelectedIndex <> -1 Then
                ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
            End If
        Catch
        End Try

        'save listbox content
        savelb()
    End Sub

    Private Sub selected_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles selected.CheckedChanged
        'save checkbox setting
        My.Settings.selectedonly = selected.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub closebox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closebox.CheckedChanged
        'save checkbox setting
        My.Settings.close = closebox.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub
End Class
Credits Blubb1337

thanks
#1 · 15y ago
Blubb1337
Blubb1337
[php]If checkbox1.checked then
inject
end if[/php]

???
#2 · 15y ago
'Bruno
'Bruno
When you copy & paste code, you will obviously ask stupid questions...
#3 · 15y ago
NextGen1
NextGen1
Blubb got it really.


If CheckBox1.Checked then
Inject
End If

Simple, Sign up for some of the classes here

http://www.mpgh.net/forum/2-general/...develop-9.html

Take the Injector Seminar.

Also, You may want to apply for basic VB.net or at least the basics of Qbasic.

Just so you can understand the basic logic in the B.A.S.I.C Language.

Basic is setup the same way If Then statements work from logic in math class.

Concept:

If I have a apple then I will make apple sauce
I do not have a apple.
--------------------------------------------------
I will not make apple sauce.

In Basic the same concept is applied

-----"if I have a apple" ---------"I will make apple sauce"
If CheckBox1.Checked Then Inject()

--"I do not have apples--
When Application is running the user does not tick the check box

--"I will not make applesauce"--
Nothing happens

Make sense?
#4 · 15y ago
ED
edinho101
Quote Originally Posted by Blubb1337 View Post
[php]If checkbox1.checked then
inject
end if[/php]

???
sorry i am noob

where add this code?
#5 · 15y ago
Void
Void
Quote Originally Posted by edinho101 View Post
sorry i am noob

where add this code?
If you don't know how to code you should probably start from the basics. A great way to start is by signing up for the MPGH Introduction to Visual Basic seminars. Click the image in my signature and apply for a learning position in the thread you're directed to, remember to follow the application format.
#6 · 15y ago
ED
edinho101
I changed the app.conf

Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="Injector.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
        </sectionGroup>
    </configSections>
    <system.diagnostics>
        <sources>
            <!-- Dieser Abschnitt definiert die Protokollierungskonfiguration für My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Auskommentierung des nachfolgenden Abschnitts aufheben, um in das Anwendungsereignisprotokoll zu schreiben -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                 initializeData="FileLogWriter"/>
            <!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
    <userSettings>
        <Injector.My.MySettings>
            <setting name="dllpath" serializeAs="String">
                <value />
            </setting>
            <setting name="processs" serializeAs="String">
                <value />
            </setting>
            <setting name="close" serializeAs="String">
                <value>False</value>
            </setting>
            <setting name="selectedonly" serializeAs="String">
                <value>False</value>
            </setting>
            <setting name="Setting" serializeAs="String">
                <value />
            </setting>
            <setting name="inject" serializeAs="String">
                <value>False</value>
            </setting>
        </Injector.My.MySettings>
    </userSettings>
</configuration>
I changed the code also
Code:
Public Class Form1

    'for reading/writing the listbox content
    Dim sFile As String

    'declare stuffz for the injection

    Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer

    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)

    Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (ByVal hObject As Integer) As Integer


    Private Sub inject()
        Dim LoadLibParamAdr As Integer
        Dim Rtn As Integer
        Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)

        On Error GoTo 1 ' If error occurs, app will go below to "1:"

        TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)

        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")

        'count each listbox item
        For i = 0 To ListBox1.Items.Count - 1


            If selected.Checked = True Then
                pszLibFileRemote = ListBox1.SelectedItem
            Else
                pszLibFileRemote = ListBox1.Items.Item(i)
            End If


            TargetBufferSize = 1 + Len(pszLibFileRemote)


            LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
            Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
            CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
        Next i

        CloseHandle(TargetProcessHandle)
1:      labelx24.ForeColor = Color.Red
        labelx24.Text = "Ocorreu um erro" 'error
    End Sub

    Public Sub ListBox_Save(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamWriter
        Dim i As Short

        'create a new streamwriter
        oStream = New IO.StreamWriter(sFile)

        'count each listbox item

        For i = 0 To ListBox.Items.Count - 1
            oStream.WriteLine(ListBox.Items(i))
        Next
        'close streamwriter
        oStream.Close()
    End Sub

    Public Sub ListBox_Read(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamReader
        Dim sLine As String

        ' Clear listbox
        ListBox.Items.Clear()

        ' Check if file exists
        Dim oFile As New IO.FileInfo(sFile)

        'if the list.dat exists then read it...
        If oFile.Exists() = True Then
            oStream = New IO.StreamReader(sFile)
            ' read file
            Do
                'read each line
                sLine = oStream.ReadLine()
                If IsNothing(sLine) Then Exit Do
                'add items to the listbox
                ListBox.Items.Add(sLine)
                'loop until it's done
            Loop
            'close the stream
            oStream.Close()
        End If
    End Sub

    Private Sub savelb()
        'save a list.dat with listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Save(ListBox1, sFile)
    End Sub

    Private Sub loadlb()
        'load a list.dat to fill in listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Read(ListBox1, sFile)
    End Sub

    Public Function IsProcessOpen(ByVal name As String) As Boolean

        'if isprocessopen("process") then...
        'if not isprocessopen("process") then...


        'get all current running processes
        For Each clsProcess As Process In Process.GetProcesses

            If clsProcess.ProcessName.Contains(name) Then


                Return True

            End If
        Next
        ' Do nothing 

        Return False
    End Function

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

        'check if process is running
        If Not IsProcessOpen(txtprocess.Text) Then
            labelx24.ForeColor = Color.Red
            labelx24.Text = "Inicie o processo"
        Else
            labelx24.ForeColor = Color.Green
            labelx24.Text = "Processo encontrado"
        End If
    End Sub

    Private Sub txtprocess_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtprocess.TextChanged
        'save current process textbox text in settings
        My.Settings.processs = txtprocess.Text

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub inject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdinject.Click

        'declare a process
        Try
            Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)


            'if txtprocess.text = ""
            If TargetProcess.Length = 0 Then
                MsgBox("Esperando por " & txtprocess.Text)
            Else

                'do injection
                Call inject()


                labelx24.Text = "Dll injetada com sucesso"
                Timer1.Stop()

            End If
        Catch
        End Try

        'save listbox content
        savelb()

        'set the process
        My.Settings.processs = txtprocess.Text

        'save settings
        My.Settings.Save()
        My.Settings.Reload()

        'close if 'close checkbox' is checked
        If closebox.Checked = True Then
            Me.Close()
        End If

    End Sub

    Private Sub selectdll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dll.Click

        'only .dlls files are selectable
        opf.Title = "Escolha a .dll"
        opf.Filter = "DLL (*.DLL)|*.Dll"
        opf.Multiselect = True

        'open the open file dialog
        opf.ShowDialog()
        'add the .dll to the listbox


        For Each item As String In opf.FileNames
            If Not ListBox1.Items.Contains(item) Then
                If Not opf.FileName = "OpenFileDialog1" Then



                    ListBox1.Items.Add(item)


                    ' dll.Text = System.IO.Path.GetFileName(opf.FileName)


                End If
            End If

        Next item

        'save listbox content
        savelb()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'load listbox content
        loadlb()

        'process textbox
        txtprocess.Text = My.Settings.processs

        'check/uncheck checkboxes
        selected.Checked = My.Settings.selectedonly
        closebox.Checked = My.Settings.close
        Autoinject.Checked = My.Settings.inject
    End Sub

    Private Sub clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
        'clear listbox(obviously)
        ListBox1.Items.Clear()

        'save listbox content
        savelb()
    End Sub


    Private Sub removeselected_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrs.Click
        'remove the selected item
        Try
            If ListBox1.SelectedIndex <> -1 Then
                ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
            End If
        Catch
        End Try

        'save listbox content
        savelb()
    End Sub

    Private Sub selected_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles selected.CheckedChanged
        'save checkbox setting
        My.Settings.selectedonly = selected.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub closebox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closebox.CheckedChanged
        'save checkbox setting
        My.Settings.close = closebox.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub Autoinject_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Autoinject.CheckedChanged
        'save checkbox setting
        My.Settings.inject = Autoinject.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub
End Class
no errors and no work auto inject :P
HELP?
#7 · 15y ago
ED
edinho101
PLS HELP ME
#8 · 15y ago
NA
natinusala
Code:
Private Sub [always]
       While Checkbox1.Checkstatus = Checked Then
              If [check if the process is active] Then
                     Inject()
                     End()
              End If
              If Checkbox1.Checkstatus = Unchecked Then
                      [exit while]
              End If
       End While
End Sub
Approximatively (i don't have VS2010 on this PC), but, it should work.
#9 · edited 15y ago · 15y ago
ED
edinho101
Quote Originally Posted by natinusala View Post
Code:
Private Sub [always]
       While Checkbox1.Checkstatus = Checked Then
              If [check if the process is active] Then
                     Inject()
                     End()
              End If
              If Checkbox1.Checkstatus = Unchecked Then
                      [exit while]
              End If
       End While
End Sub
Approximatively (i don't have VS2010 on this PC), but, it should work.
i use VB 08
#10 · 15y ago
Blubb1337
Blubb1337
There is no difference in the coding.
#11 · 15y ago
NA
natinusala
Quote Originally Posted by edinho101 View Post
i use VB 08
It's the same code, no ?
#12 · 15y ago
ED
edinho101
Code:
Private Sub Autoinject_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 
 While Autoinject.Checkstatus = Checked Then
            If [check if the process is active]Then
                inject()
                     End()
            End If
            If Autoinject.Checkstatus = Unchecked Then
                      [exit while]
            End If
        End While
errors
I give up
#13 · 15y ago
Blubb1337
Blubb1337
........................
#14 · 15y ago
ED
edinho101
Quote Originally Posted by Blubb1337 View Post
........................
sorry for all
I could not put o checkbox auto inject

Code:
Public Class Form1

    'for reading/writing the listbox content
    Dim sFile As String

    'declare stuffz for the injection

    Private TargetProcessHandle As Integer
    Private pfnStartAddr As Integer
    Private pszLibFileRemote As String
    Private TargetBufferSize As Integer

    Public Const PROCESS_VM_READ = &H10
    Public Const TH32CS_SNAPPROCESS = &H2
    Public Const MEM_COMMIT = 4096
    Public Const PAGE_READWRITE = 4
    Public Const PROCESS_CREATE_THREAD = (&H2)
    Public Const PROCESS_VM_OPERATION = (&H8)
    Public Const PROCESS_VM_WRITE = (&H20)

    Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Integer
    Public Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Integer, ByVal lpAddress As Integer, ByVal dwSize As Integer, ByVal flAllocationType As Integer, ByVal flProtect As Integer) As Integer
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByVal lpBuffer As String, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Integer, ByVal lpProcName As String) As Integer
    Private Declare Function GetModuleHandle Lib "Kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Integer
    Public Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Integer, ByVal lpThreadAttributes As Integer, ByVal dwStackSize As Integer, ByVal lpStartAddress As Integer, ByVal lpParameter As Integer, ByVal dwCreationFlags As Integer, ByRef lpThreadId As Integer) As Integer
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (ByVal hObject As Integer) As Integer


    Private Sub inject()
        Dim LoadLibParamAdr As Integer
        Dim Rtn As Integer
        Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)

        On Error GoTo 1 ' If error occurs, app will go below to "1:"

        TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)

        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")

        'count each listbox item
        For i = 0 To ListBox1.Items.Count - 1


            If selected.Checked = True Then
                pszLibFileRemote = ListBox1.SelectedItem
            Else
                pszLibFileRemote = ListBox1.Items.Item(i)
            End If


            TargetBufferSize = 1 + Len(pszLibFileRemote)


            LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
            Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
            CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
        Next i

        CloseHandle(TargetProcessHandle)
1:      labelx24.ForeColor = Color.Red
        labelx24.Text = "Ocorreu um erro" 'error
    End Sub

    Public Sub ListBox_Save(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamWriter
        Dim i As Short

        'create a new streamwriter
        oStream = New IO.StreamWriter(sFile)

        'count each listbox item

        For i = 0 To ListBox.Items.Count - 1
            oStream.WriteLine(ListBox.Items(i))
        Next
        'close streamwriter
        oStream.Close()
    End Sub

    Public Sub ListBox_Read(ByVal ListBox As ListBox, ByVal sFile As String)

        ' Save content
        Dim oStream As IO.StreamReader
        Dim sLine As String

        ' Clear listbox
        ListBox.Items.Clear()

        ' Check if file exists
        Dim oFile As New IO.FileInfo(sFile)

        'if the list.dat exists then read it...
        If oFile.Exists() = True Then
            oStream = New IO.StreamReader(sFile)
            ' read file
            Do
                'read each line
                sLine = oStream.ReadLine()
                If IsNothing(sLine) Then Exit Do
                'add items to the listbox
                ListBox.Items.Add(sLine)
                'loop until it's done
            Loop
            'close the stream
            oStream.Close()
        End If
    End Sub

    Private Sub savelb()
        'save a list.dat with listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Save(ListBox1, sFile)
    End Sub

    Private Sub loadlb()
        'load a list.dat to fill in listbox content
        sFile = Application.StartupPath & "\List.dat"
        ListBox_Read(ListBox1, sFile)
    End Sub

    Public Function IsProcessOpen(ByVal name As String) As Boolean

        'if isprocessopen("process") then...
        'if not isprocessopen("process") then...


        'get all current running processes
        For Each clsProcess As Process In Process.GetProcesses

            If clsProcess.ProcessName.Contains(name) Then


                Return True

            End If
        Next
        ' Do nothing 

        Return False
    End Function

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

        'check if process is running
        If Not IsProcessOpen(txtprocess.Text) Then
            labelx24.ForeColor = Color.Red
            labelx24.Text = "Inicie o processo"
        Else
            labelx24.ForeColor = Color.Green
            labelx24.Text = "Processo encontrado"
        End If
    End Sub

    Private Sub txtprocess_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtprocess.TextChanged
        'save current process textbox text in settings
        My.Settings.processs = txtprocess.Text

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub inject_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdinject.Click

        'declare a process
        Try
            Dim TargetProcess As Process() = Process.GetProcessesByName(txtprocess.Text)


            'if txtprocess.text = ""
            If TargetProcess.Length = 0 Then
                MsgBox("Esperando por " & txtprocess.Text)
            Else

                'do injection
                Call inject()


                labelx24.Text = "Dll injetada com sucesso"
                Timer1.Stop()

            End If
        Catch
        End Try

        'save listbox content
        savelb()

        'set the process
        My.Settings.processs = txtprocess.Text

        'save settings
        My.Settings.Save()
        My.Settings.Reload()

        'close if 'close checkbox' is checked
        If closebox.Checked = True Then
            Me.Close()
        End If

    End Sub

    Private Sub selectdll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dll.Click

        'only .dlls files are selectable
        opf.Title = "Escolha a .dll"
        opf.Filter = "DLL (*.DLL)|*.Dll"
        opf.Multiselect = True

        'open the open file dialog
        opf.ShowDialog()
        'add the .dll to the listbox


        For Each item As String In opf.FileNames
            If Not ListBox1.Items.Contains(item) Then
                If Not opf.FileName = "OpenFileDialog1" Then



                    ListBox1.Items.Add(item)


                    ' dll.Text = System.IO.Path.GetFileName(opf.FileName)


                End If
            End If

        Next item

        'save listbox content
        savelb()

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'load listbox content
        loadlb()

        'process textbox
        txtprocess.Text = My.Settings.processs

        'check/uncheck checkboxes
        selected.Checked = My.Settings.selectedonly
        closebox.Checked = My.Settings.close
        Autoinject.Checked = My.Settings.inject
    End Sub

    Private Sub clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdclear.Click
        'clear listbox(obviously)
        ListBox1.Items.Clear()

        'save listbox content
        savelb()
    End Sub


    Private Sub removeselected_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrs.Click
        'remove the selected item
        Try
            If ListBox1.SelectedIndex <> -1 Then
                ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
            End If
        Catch
        End Try

        'save listbox content
        savelb()
    End Sub

    Private Sub selected_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles selected.CheckedChanged
        'save checkbox setting
        My.Settings.selectedonly = selected.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub closebox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closebox.CheckedChanged
        'save checkbox setting
        My.Settings.close = closebox.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub

    Private Sub Autoinject_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Autoinject.CheckedChanged
        'save checkbox setting
        My.Settings.inject = Autoinject.Checked

        'save/reload settings
        My.Settings.Save()
        My.Settings.Reload()
    End Sub
End Class
Please someone
I need to work auto inject
look part red
This was supposed to be a checkbox auto inject

Please pass code ready
i need

#15 · edited 15y ago · 15y ago
Posts 1–15 of 21 · Page 1 of 2

Post a Reply

Tags for this Thread

None