[Help] Injector problems, wtfux.
Okay well I have not the slightest clue what is wrong with this code. Like really, what the bejeebus.
It's pretty much the original code from Blubb's [OS] injector code except I made it just a single .dll inject only because I couldn't be bothered making it full listbox and all that shizniz.
Anywho, this is the code:
Code:
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
pszLibFileRemote = ListBox1.SelectedIndex
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)
txtStatus.Text = ".DLL successfully injected!"
txtStatus.ForeColor = Color.Green
AutoInject.Checked = False
If Closebox.Checked = True Then
Me.Close()
End If
1: txtStatus.Text = "Error has occurred"
txtStatus.ForeColor = Color.Red
End Sub
Every time I press inject, it returns an error.
Oh yeah I'm not 100% sure but I'm pretty sure there's an error in open source injector too. It always SAYS .Dll injection successful, but if you have a look at the code,
Code:
labelx24.Text = ".dll injection successful"
labelx24.ForeColor = Color.Green
Is placed INSIDE THE INJECT *BUTTON*, not in the Inject sub. So every time you press "Inject" it make labelx24.text = ".dll Injection Successful"
I removed it from the inject button and transferred it the to inject sub just after close handle and lo and behold, it ALSO returns errors every time you try to inject.
So If anyone has
a) an alternate single .dll injection code they don't mind sharing (credits given of course) or
b) a solution to my current code
Thanks in advance. This crap is stalling progress on my CA Multi-Tool, grr.
J-Deezy.