[Help] Injector problems, wtfux.

Posts 1–15 of 20 · Page 1 of 2
[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.
1: MsgBox("ErrorToString")
You can use:

[php]on error goto 1
1: MsgBox("ErrorToString")[/php]
this is what i said above.
most likely this causing the problem.
Code:
For i = 0 To ListBox1.Items.Count - 1
            pszLibFileRemote = ListBox1.SelectedIndex
Remove the for i to listbox and pszlibFileRemote = textbox1.text Or what ever you used to display the path to the dll.
Just use

[php]
Try

Catch Ex as Exception

End Try

[/php]

Catch the actual exception error, post, and we can help get it resolved
Okay this is the error.



So there must be something wrong with this line of code I'm assuming.

Code:
Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (ByVal hObject As Integer) As Integer
(Yes I know, I'm amazingly smart in figuring that out)

So I figure I have got the alias name declared wrong?
Did you ever try another game/dll?
Yes I tried

Injecting CA with multiple .DLLs
Injecting NotePad with multiple .DLLs.

I'm also positive the .DLLs worked because I've used them with PerX before and they worked fine.
Its alias should be
Code:
Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
Code:
Private Declare Function CloseHandle Lib "kernel32" Alias "CloseHandleA" (ByVal hObject As Integer) As Integer
is working fine for me.
Issue could be a few things,

A. What OS
B. What dll ?

You would assume the error comes from the CloseHandle part of the code, but likley it is what closehandle is "Pointing to"

"Process as"

So.... What program are you trying to inject, are you adding the process naem correctly.

Could be a numerous reasons

Also, post your whole code, you could be missing or messing up declarations, namespace imports etc.

Want to help, just assuming it is the code that is error(ing) isn't a good idea, alot of times the cause of the error could be completely unrelated (or somewhat) which is what I am thinking

Or just pm me the whole project, may work better, cause the issue could be simple or more complex.

and it really depends on how familiar with the language you are.
Hmm I don't think it's anything necessarily wrong with my code, perhaps my OS?

Because I downloaded Blubb's whole project and tried using it and it also returned errors

My running OS: Vista - 64bit <- yuck.
.DLL I was trying to inject: Longevity's public, Bravia's public, Topblast's public.
Process: "Notepad" and "Engine"

Anything else you need?

I'll PM you my injector code after school.
Okay pupils, what have we learned over the course of your few months here?
32Bit - 64 Bit Integer to Long ..... Remember?

Try
[php]

Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
[/php]

If not replace Integer to long

@
WhatTheF&^%#%^isyourname

Both alias should work find (just a note)
okay NextGen i changed it to

Code:
      Private Declare Function CloseHandle Lib "kernel32" _
                              (ByVal hObject As Long) As Long
And now the injector returns an empty msgbox...hmm.

Should I change all function declarations to Long instead of Integer?
Posts 1–15 of 20 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us