procedure InjectKernelModule(ProcessName ,DllName: Pchar);
//This is a function written by Hke.
//利用远程线程讲把Dll注入进程
var
tmp:longword;//这个专门来占格式收集垃圾
Mysize:longword;//放字符串长度
Parameter:pointer;//放那个参数的指针(位置在目标进程内)
hThread:longword;
MyHandle,PID:longword;
Tkernel:pchar;//为了取得指针
begin
if GetModule(ProcessName , DllName)=0 then //如果已经注入就不重复了
begin
Tkernel:= DllName;
Pid:=NameToPID(ProcessName);
GetDebugPrivs;
Myhandle:=OpenProcess(PROCESS_ALL_ACCESS, False, Pid);
Mysize:=strlen(MyKernel)+1;
Parameter:= VirtualAllocEx(Myhandle, nil, Mysize, MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory(Myhandle, Parameter, Pointer(Tkernel), MySize, tmp);
hThread:= CreateRemoteThread(Myhandle,nil, 0, GetProcAddress(GetModuleHandle(''KERNEL32.DLL''), ''LoadLibraryA''), Parameter, 0 , tmp);
if hThread <> 0 then
begin
WaitForSingleObject(hThread, IN