yang3114 发表于 2014-2-8 16:12:59

AU3注入DLL的问题 100元请人修改。

$pid0 = ProcessExists("qq.exe")
$DllPath0 = @ScriptDir & "\test.dll"
If InDll() Then
MsgBox(64,"d","成功")
Else
MsgBox(16,"d","失败")
endif
Func InDll($pid = $pid0,$DllPath = $DllPath0)
Local $hp
Local $DllLen
Local $addr
Local $ret
Local $n
If FileExists($DllPath)=0 Then Return
$r = DllCall("KERNEL32.DLL", "long", "OpenProcess", "long", 2035711,"long", 0, "long", $pid)
$hp=$r
If $r=0 Then Return
$DllLen=ChrLenFixed($DllPath)+1
$r = DllCall("KERNEL32.DLL", "long", "VirtualAllocEx", "long", $hp,"ptr", 0, "long", $DllLen,"long",4096,"long",4)
$addr=$r
$r= DllCall("KERNEL32.DLL", "long", "WriteProcessMemory", "handle", $hp,"ptr",$addr,"str",$DllPath,"ulong_ptr",$DllLen,"ulong_ptr*",0)
If $r Then
$r=DllCall("KERNEL32.DLL", "long", "GetModuleHandle", "str","KERNEL32.DLL")
$ret=$r
$r=DllCall("KERNEL32.DLL", "long", "GetProcAddress","LONG",$ret,"str","LoadLibraryA")
$EntryPoint=$r
$r=DllCall("KERNEL32.DLL", "long", "CreateRemoteThread", "LONG",$hp,"long*",0,"long",0,"long",$EntryPoint,"long",$addr,"long",0,"ptr",0)
$ret=$r
If $ret Then
   $n=1
   $r=DllCall("KERNEL32.DLL", "long", "WaitForSingleObject","LONG",$ret,"long",4294967295)
   $r=DllCall("KERNEL32.DLL", "long", "GetExitCodeThread","LONG",$ret,"long*",0)   
EndIf
EndIf
If $addr Then $r=DllCall("KERNEL32.DLL", "long", "VirtualFreeEx", "LONG",$hp,"ptr",$addr,"long",0,"long",32768)
If $ret Then $r=DllCall("KERNEL32.DLL", "handle", "CloseHandle","LONG",$ret)
If $hp Then $r=DllCall("KERNEL32.DLL", "long", "CloseHandle","LONG",$hp)
Return $n
EndFunc
Func ChrLenFixed($c)
      Dim $ChrL = 0, $AscNum
      For $i = 1 To StringLen($c)
                $AscNum = AscW(StringMid($c, $i, 1))
                If $AscNum < 0 Then $AscNum = $AscNum + 65536
                If $AscNum > 255 Then
                        $ChrL = $ChrL + 2
                Else
                        $ChrL = $ChrL + 1
                EndIf
      Next
      Return $ChrL
EndFunc

这个代码在WIN7 64位系统中,不能注入成功。64位的系统中,也是将32位的DLL,注入到32位的进程中。有朋友可以修改的可以加QQ:863686908

Ycxw2008 发表于 2014-2-8 21:46:43

QQ 貌似有驱动的吧?

58fly 发表于 2014-2-13 03:25:42

貌似必须要用64位的DLL来注入,否则dllcall指针是错的

alice148 发表于 2015-1-26 16:28:20

谢谢楼主分享!

nmgwddj 发表于 2015-1-28 04:25:48

代码没问题,个别进程有保护,不让注。

Free-IT 发表于 2015-1-28 12:23:14

学习学习,好深奥呀
页: [1]
查看完整版本: AU3注入DLL的问题 100元请人修改。