Moin,
Also folgendes ich habe derzeit wieder angefangen mit Autoit und da ich noch nicht wirklich soviel ahnung hab von GWCA wollt ich hier nun mal fragen, Also ich bin derzeit an einem Bot schreiben und möchte dort eine Self Injection einbauen. den passenden code habe ich schon im www gefunden. Soweit alles gut, doch wenn ich nun den Bot Ausführe steht zwar dran das es Injectet wurde aber oben links im GW fenster steht nicht mein Name dran. Hier mal der Code
Hoffe ihr könnt mir helfen.
greetz HoimeBase
Also folgendes ich habe derzeit wieder angefangen mit Autoit und da ich noch nicht wirklich soviel ahnung hab von GWCA wollt ich hier nun mal fragen, Also ich bin derzeit an einem Bot schreiben und möchte dort eine Self Injection einbauen. den passenden code habe ich schon im www gefunden. Soweit alles gut, doch wenn ich nun den Bot Ausführe steht zwar dran das es Injectet wurde aber oben links im GW fenster steht nicht mein Name dran. Hier mal der Code
PHP Code:
;InjectDLL
Global $bot = "General"
Global $inject = 1
If Not FileExists(@ScriptDir & "\Graphics.dll") Then
loggen("Die Dll wurde nicht gefunden")
$msgbox = MsgBox(36, "Error", "Die Dll wurde nicht gefunden!" & Chr(13) & Chr(13) & "Herunterladen?")
If $msgbox = 6 Then
InetGet("http://gwca.googlecode.com/files/Graphics.dll", "Graphics.dll", 1, 1)
While @InetGetActive
TrayTip("Downloading", "Es wurden " & @InetGetBytesRead & " Bytes heruntergeladen!", 10, 16)
Sleep(100)
WEnd
MsgBox(0, "Update", "Die Datei wurde heruntergeladen!")
MsgBox(0, "Update", "Es befindet sich nun eine neue Graphics.dll im Ordner!")
EndIf
EndIf
$hwnd = WinGetHandle("Guild Wars")
Global Const $dllpath = @ScriptDir & "\Graphics.dll"
If Not FileExists($dllpath) Then Exit
$iDLL = InjectDll($hwnd, $dllpath)
If Not @error Then
TrayTip("", "Injection Successfull", 1)
loggen("Dll erfolgreich injected")
Global $inject = 1
Else
MsgBox(0x10, "Error in DLL Injection", "Guild Wars ist möglicherweise nicht gestartet" )
Global $inject = -1
loggen("Fehler beim injecten der Dll")
EndIf
Func InjectDll($hWnd, $dllpath)
If IsHWnd($hwnd) = 0 Then
SetError(-1)
Return False
ElseIf StringLen($dllpath) <= 4 Or StringRight($dllpath, 4) <> ".dll" Then
SetError(-2)
Return False
EndIf
Local $pid, $pHandle, $pLibRemote, $modHandle, $LoadLibraryA, $hThread
Local $kernel32 = DllOpen("kernel32.dll")
If $kernel32 = -1 Then
Exit
EndIf
$pid = DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $hWnd, "int*", 0)
If IsArray($pid) Then
$pid = $pid[2]
Else
SetError(-3)
Return False
EndIf
$pHandle = DllCall($kernel32, "int", "OpenProcess", "int", 0x1F0FFF, "int", 0, "int", $pid)
If IsArray($pHandle) And $pHandle[0] > 0 Then
$pHandle = $pHandle[0]
Else
SetError(-4)
Return False
EndIf
$pLibRemote = DllCall($kernel32, "int", "VirtualAllocEx", "int", $pHandle, "short", 0, "int", 0x1000, "int", 0x1000, "int", 4)
If IsArray($pLibRemote) Then
If $pLibRemote[0] > 0 Then
$pLibRemote = $pLibRemote[0]
Else
SetError(-5)
Return False
EndIf
Else
SetError(-6)
Return False
EndIf
For $i = 0 To StringLen($dllpath)
$ret = DllCall("kernel32.dll", "int", "WriteProcessMemory", "int", $pHandle, "int", $pLibRemote + $i, "int*", Asc(StringMid($dllpath, $i + 1, 1)), "int", 1, "int", 0)
If IsArray($ret) Then
If $ret[0] = 0 Then
SetError(-7)
Return False
EndIf
Else
SetError(-8)
Return False
EndIf
Next
$modHandle = DllCall($kernel32, "long", "GetModuleHandle", "str", "kernel32.dll")
If IsArray($modHandle) Then
If $modHandle[0] > 0 Then
$modHandle = $modHandle[0]
Else
SetError(-9)
Return False
EndIf
Else
SetError(-10)
Return False
EndIf
$LoadLibraryA = DllCall($kernel32, "long", "GetProcAddress", "long", $modHandle, "str", "LoadLibraryA")
If IsArray($LoadLibraryA) Then
If $LoadLibraryA[0] > 0 Then
$LoadLibraryA = $LoadLibraryA[0]
Else
SetError(-11)
Return False
EndIf
Else
SetError(-12)
Return False
EndIf
$hThread = DllCall($kernel32, "int", "CreateRemoteThread", "int", $pHandle, "int", 0, "int", 0, "long", $LoadLibraryA, "long", $pLibRemote, "int", 0, "int", 0)
If IsArray($hThread) Then
If $hThread[0] > 0 Then
$hThread = $hThread[0]
Else
SetError(-13)
Return False
EndIf
Else
SetError(-14)
Return False
EndIf
DllCall($kernel32, "int", "VirtualFreeEx", "int", $pHandle, "int", $pLibRemote, "int", 0x1000, "int", 0x8000)
DllCall($kernel32, "int", "CloseHandle", "int", $hThread)
DllCall($kernel32, "int", "CloseHandle", "int", $pHandle)
DllClose($kernel32)
Return True
EndFunc
greetz HoimeBase