kill进程的过程如下:
uses
tlhelp32....
procedure delprocess(s:string);//s为防火墙名,如:KAVPFW.EXE
var
ProcessListHandle,hhh: THandle;
ProcessStruct: TProcessEntry32;
kkk:bool;
aaa:dword;
begin
ProcessListHandle := CreateToolHelp32Snapshot(TH32CS_SNAPPROCESS, 0);
ProcessStruct.dwSize := Sizeof(ProcessStruct);
kkk:= Process32First(ProcessListHandle, ProcessStruct);
while Integer(kkk) <> 0 do
begin
if uppercase(extractfilename(ProcessStruct.szExeFile))=uppercase(s) then
begin
hhh:=openprocess(process_all_access,true,ProcessStruct.th32ProcessID);
getexitcodeprocess(hhh,aaa);
terminateprocess(hhh,aaa);
break;
end;
kkk:= Process32Next(ProcessListHandle, ProcessStruct);
end;
CloseHandle(ProcessListHandle);
end;