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 with DLL Injector!

Help with DLL Injector!

Posts 1–2 of 2 · Page 1 of 1
Ragehax
Ragehax
Help with DLL Injector!
Down Below is my code for the dll injector... but it always fails at WriteProcessMemory...

can anyone tell me why?



Code:
Imports System.IO
Imports System.Diagnostics
Public Class Form1
    Private Declare Function CreateRemoteThread Lib "kernel32.dll" (ByVal hProcess As Int32, ByRef lpThreadAttributes As Security_Attributes, ByVal dwStackSize As Int32, ByRef lpStartAddress As Int32, ByVal lpParameter As Int32, ByVal dwCreationFlags As Int32, ByRef lpThreadId As Int32) As Int32
    Private Declare Function VirtualAllocEx Lib "kernel32.dll" (ByVal hProcess As Int32, ByVal lpAddress As Int32, ByRef dwSize As Int32, ByVal flAllocationType As Int32, ByVal flProtect As Int32) As Int32
    Private Declare Function WriteProcessMemory Lib "kernel32.dll" (ByVal hProcess As Int32, ByVal lpBaseAddress As Int32, ByRef lpBuffer As Byte(), ByVal nSize As Int32, ByRef lpNumberOfBytesWritten As Int32) As Int32
    Private Declare Function VirtualFreeEx Lib "kernel32.dll" (ByVal hProcess As Int32, ByVal lpAddress As Int32, ByRef dwSize As Int32, ByVal dwFreeType As Int32) As Int32
    Private Declare Function SetWindowsHookEx Lib "user32.dll" Alias "SetWindowsHookExA" (ByVal idHook As Int32, ByVal lpfn As Int32, ByVal hmod As Int32, ByVal dwThreadId As Int32) As Int32
    Private Declare Function GetExitCodeThread Lib "kernel32.dll" (ByVal hThread As Int32, ByRef lpExitCode As Int32) As Int32
    Private Declare Function GetModuleHandle Lib "kernel32.dll" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Int32
    Private Declare Function LoadLibrary Lib "kernel32.dll" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Int32
    Private Declare Function GetProcAddress Lib "kernel32.dll" (ByVal hModule As Int32, ByVal lpProcName As String) As Int32
    Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Int32, ByVal bInheritHandle As Int32, ByVal dwProcessId As Int32) As Int32
    Private Declare Function CreateRemoteThreadex Lib "kernal32.dll" (ByVal HProcess As IntPtr, ByVal dwstacksize As Int32, ByVal LpStartAddress As Int32, ByVal LpParameter As Int32, ByVal DwCreationFlags As UInt32, ByVal lpAttributeList As Integer, ByRef lpThreadid As Int32) As Int32
    Private Process_All_Access As Integer = &H1F0FFF

    Public Structure Security_Attributes
        Dim nLength As UInteger
        Dim LpSecurityDescriptor As IntPtr
        Dim bInheritHandle As Boolean
    End Structure


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog
        With ofd
            .Filter = "Dll's (*.dll)|*.dll"
            .Title = "Select a dll to inject.."
            .CheckPathExists = True
            .CheckFileExists = True
        End With
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim lvi As New ListViewItem(ofd.SafeFileName)
            lvi.SubItems.Add(ofd.FileName)
            ListView1.Items.Add(lvi)
        End If
    End Sub


    Public Function DllInjection(ByVal DllBfile() As Byte, ByVal ProcessHandle As Int32)
        Try
            Dim DllVirtLoc As Int32
            Dim DllLength As Int32
            Dim Inject As Int32
            Dim LibAddress As Int32
            Dim CreateThread As Int32
            Dim ThreadID As Int32
            DllLength = UBound(DllBfile)
            DllVirtLoc = VirtualAllocEx(ProcessHandle, 0, DllLength, &H1000, &H4)
            If DllVirtLoc = 0 Then
                MessageBox.Show("Call to VirtualAllocEx Failed", "Error", MessageBoxButtons.OK)
                Exit Function
            Else
                Inject = WriteProcessMemory(ProcessHandle, DllVirtLoc, DllBfile, DllLength, Nothing)
                If Inject = 0 Then
                    MessageBox.Show("Call To WriteProcessMemory", "Error", MessageBoxButtons.OK)
                    Exit Function
                Else
                    Dim mHandle As Int32
                    mHandle = GetModuleHandle("Kernal32.dll")
                    If mHandle = 0 Then
                        MessageBox.Show("Call to GetModuleHandle failed.", "Error", MessageBoxButtons.OK)
                        Exit Function
                    Else
                        LibAddress = GetProcAddress(mHandle, "LoadLibraryA")
                        If LibAddress = 0 Then
                            MessageBox.Show("Error Getting Address of LoadLibrary", "Error", MessageBoxButtons.OK)
                            Exit Function
                        Else
                            CreateThread = CreateRemoteThread(ProcessHandle, Nothing, 0, LibAddress, DllVirtLoc, 0, ThreadID)
                            If CreateThread = 0 Then
                                MessageBox.Show("Call to CreateRemoteThread Failed", "Error", MessageBoxButtons.OK)
                                Exit Function
                            Else
                                StatusStrip1.Text = "Injected!"
                                StatusStrip1.ForeColor = Color.Green
                            End If
                        End If
                    End If
                End If
            End If
        Catch ex As Exception
        End Try
    End Function

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim splits() As String
        Dim myprocess As Process() = Process.GetProcessesByName(TextBox1.Text)
        Dim Hhandle As Int32
        Dim i As Integer

        splits = Split(TextBox1.Text, ".")
        If TextBox1.Text = "" Then
            Exit Sub
        ElseIf UBound(splits) <> 0 Then
            MessageBox.Show("Dont include the '.exe' at the end of the Process Name", "Error", MessageBoxButtons.OK)
            Exit Sub
        End If
        Try
            Hhandle = OpenProcess(Process_All_Access, 0, myprocess(0).Id)
        Catch ex As Exception
        End Try
        For i = 0 To ListView1.Items.Count - 1
            Dim items As String
            items = ListView1.Items(i).SubItems(1).Text
            Dim bfile() As Byte
            Dim Fileinfo1 As New FileInfo(ListView1.Items(i).SubItems(1).Text)
            Dim Fs As FileStream
            Fs = Fileinfo1.OpenRead()
            bfile = New Byte((Fs.Length - 1)) {}
            Fs.Read(bfile, 0, Fileinfo1.Length)
            DllInjection(bfile, Hhandle)
        Next i
    End Sub
End Class
#1 · 16y ago
WT
wtfiwantthatname
Ill tell you. Your writing the whole dll as a byte array to the process not as its path(string). All attach my new source. I was wondering where you got my old source at? Also if your on vista or 64 bit OS set debugPrivileges.

P.S: It also is not your code.
#2 · edited 16y ago · 16y ago
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

  • please help with dll injector, there's videoBy /b/oss in Programming Tutorials
    2Last post 16y ago
  • Help with the injectors and and the dllsBy pergel in CrossFire Spammers, Injectors and Multi Tools
    0Last post 15y ago
  • Need help with my injectorBy grrgto in Combat Arms Hacks & Cheats
    1Last post 17y ago
  • help with dll in hack!By bldymarien in C++/C Programming
    0Last post 18y ago
  • hey ! Help about Dll injectorBy wschiam in Blackshot Hacks & Cheats
    0Last post 17y ago

Tags for this Thread

#dll#injector