我的程序有什么问题? 怎么不行呢?(50分)

  • 主题发起人 主题发起人 边尘浪子
  • 开始时间 开始时间

边尘浪子

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; b:boolean;<br>&nbsp; processlistHandle:THandle;<br>&nbsp; processStruct:TprocessEntry32;<br>&nbsp; pid:Dword;<br>&nbsp; th:THandle;<br>&nbsp; dll_filename:PWideChar; &nbsp;// dll 文件名的指针<br>&nbsp; guest_file:String; &nbsp; &nbsp; &nbsp; // DLL 文件名<br>&nbsp; cb:integer; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// dll 路径名所需要的空间<br>&nbsp; dll_file_remote:Pointer;<br>&nbsp; tmp_return:dword;<br>&nbsp; tfnaddress:TFNThreadStartRoutine;<br>begin<br>&nbsp; processlistHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);<br>&nbsp; b:=Process32First(processlistHandle,processStruct);<br>&nbsp; while b do<br>&nbsp; begin<br>&nbsp; &nbsp; Memo1.Lines.Add(IntToStr(processStruct.th32ProcessID)+' - '+processStruct.szExeFile);<br>&nbsp; &nbsp; if processStruct.szExeFile='explorer.exe' then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; pid:=processStruct.th32ProcessID;<br>&nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; end;<br>&nbsp; &nbsp; b:=Process32Next(processlistHandle,processStruct);<br>&nbsp; end;<br><br><br>&nbsp; th:=OpenProcess(PROCESS_CREATE_THREAD+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PROCESS_VM_OPERATION+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PROCESS_VM_WRITE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FALSE,pid);<br>&nbsp; if th&lt;=0 then exit;<br><br>&nbsp; //划一块内存<br>&nbsp; guest_file:='project1.dll';<br>&nbsp; GetMem(dll_filename,Length(guest_file)*2+1);<br>&nbsp; StringToWideChar(guest_file,dll_filename,Length(guest_file)*2+1);<br><br>&nbsp; cb:= (lstrlenW(dll_filename)+1)*SizeOf(WChar);<br>&nbsp; dll_file_remote:=PWideString(VirtualAllocEx(th,nil,cb,MEM_COMMIT,PAGE_READWRITE));<br><br>&nbsp; b:=WriteProcessMemory(th,dll_file_remote,dll_filename,cb,tmp_return);<br><br>&nbsp; if not b then exit;<br><br>&nbsp; tfnaddress:=GetProcAddress(GetModuleHandle('Kernel32'),'LoadLibraryW');<br>&nbsp; tmp_return:=0;<br>&nbsp; CreateRemoteThread(th,nil,0,tfnaddress,dll_file_remote,0,tmp_return);<br>&nbsp; FreeMem(dll_filename);<br>end;
 
这样就行了,做什么呀?看着挺有意思的,我e问不好,能给点资料或代码么?<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp;b:boolean;<br>&nbsp;processlistHandle:THandle;<br>&nbsp;processStruct:LPPROCESSENTRY32; &nbsp; //TprocessEntry32;<br>&nbsp;pid:Dword;<br>&nbsp;th:THandle;<br>&nbsp;dll_filename:PWideChar; &nbsp;// dll 文件名的指针<br>&nbsp;guest_file:String; &nbsp; &nbsp; &nbsp; // DLL 文件名<br>&nbsp;cb:integer; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// dll 路径名所需要的空间<br>&nbsp;dll_file_remote:Pointer;<br>&nbsp;tmp_return:dword;<br>&nbsp;tfnaddress:TFNThreadStartRoutine;<br>begin<br>&nbsp;new(processStruct);<br>&nbsp;processlistHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPALL,0);<br>&nbsp;b:=Process32First(processlistHandle,processStruct^);<br>&nbsp;while b do<br>&nbsp;begin<br>&nbsp; &nbsp;Memo1.Lines.Add(IntToStr(processStruct.th32ProcessID)+' - '+processStruct.szExeFile);<br>&nbsp; &nbsp;if processStruct.szExeFile='explorer.exe' then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;pid:=processStruct.th32ProcessID;<br>&nbsp; &nbsp; &nbsp;break;<br>&nbsp; &nbsp;end;<br>&nbsp; &nbsp;b:=Process32Next(processlistHandle,processStruct^);<br>&nbsp;end;<br><br><br>&nbsp;th:=OpenProcess(PROCESS_CREATE_THREAD+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PROCESS_VM_OPERATION+<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PROCESS_VM_WRITE,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FALSE,pid);<br>&nbsp;if th&lt;=0 then exit;<br><br>&nbsp;//划一块内存<br>&nbsp;guest_file:='project1.dll';<br>&nbsp;GetMem(dll_filename,Length(guest_file)*2+1);<br>&nbsp;StringToWideChar(guest_file,dll_filename,Length(guest_file)*2+1);<br><br>&nbsp;cb:= (lstrlenW(dll_filename)+1)*SizeOf(WChar);<br>&nbsp;dll_file_remote:=PWideString(VirtualAllocEx(th,nil,cb,MEM_COMMIT,PAGE_READWRITE));<br><br>&nbsp;b:=WriteProcessMemory(th,dll_file_remote,dll_filename,cb,tmp_return);<br><br>&nbsp;if not b then exit;<br><br>&nbsp;tfnaddress:=GetProcAddress(GetModuleHandle('Kernel32'),'LoadLibraryW');<br>&nbsp;tmp_return:=0;<br>&nbsp;CreateRemoteThread(th,nil,0,tfnaddress,dll_file_remote,0,tmp_return);<br>&nbsp;FreeMem(dll_filename);<br>end;<br>
 
等我回家试一下 给你分数哦
 
怎么,还有问题,在我这里行啊!<br>我用d7+xpsp1<br>用的时候要uses TlHelp32
 
后退
顶部