procedure TForm1.Button3Click(Sender: TObject);<br>var<br> dllname:string;<br> progmanhandle:dword;<br> threadid:dword;<br> processid:dword;<br> funcp
ointer;<br> procid
dword;<br> virp
ointer;<br> tmp:dword;<br> kerhandle:dword;<br>begin<br> ////////////////////////////////////////////////////////<br> kerhandle:=GetModuleHandle(pchar('Kernel32.dll'));<br> if kerhandle<>0 then begin<br> funcp:=GetProcAddress(kerhandle,'LoadLibraryA');<br> end else exit;<br> ////////////////////////////////////////////////////////<br> dllname:='g:/wpdll/wpdll.dll';<br> procid:=allocmem(4);<br> progmanhandle:=findwindow('Progman','Program Manager');<br> if progmanhandle<>0 then begin<br> threadid:=GetWindowThreadProcessId(progmanhandle,procid);<br> if threadid<>0 then begin<br> processid:=OpenProcess(PROCESS_CREATE_THREAD or PROCESS_VM_OPERATION or<br> PROCESS_VM_WRITE,FALSE,procid^);<br> if processid<>0 then begin<br> virp:=VirtualAllocEx(processid,nil,MAX_PATH,MEM_COMMIT,PAGE_READWRITE);<br> if virp<>nil then begin<br> if writeProcessMemory(processid,virp,pchar(dllname),MAX_PATH,tmp) then begin<br> CreateRemoteThread(processid,nil,0,funcp,virp,0,threadid);<br> end;<br> end;<br> end;<br> end;<br> end;<br> freemem(procid);