用过"xx安全卫士"、"XX管家"等的的朋友都知道,它的进程是无法杀掉的,在任务管理器中杀进程的话,会弹出一个消息框提示拒绝访问!那么这是怎么实现的呢?很简单,就是使用了HOOK API的方法。
1.我用delphi来写程序好了,先写个dll。
const
PRG_NAME = 'ddos.exe';
var TerminateProcessNext : function (processHandle, exitCode: dword) : bool; stdcall;
NtTerminateProcessNext : function (processHandle, exitCode: dword) : dword; stdcall;
{$R *.res}
function ThisIsOurProcess(processHandle: dword) : boolean;
var pid : dword;
arrCh : array [0..MAX_PATH] of char;
begin
pid := ProcessHandleToId(processHandle);
result := (pid <> 0) and ProcessIdToFileName(pid, arrCh) and
(PosText(PRG_NAME, arrCh) > 0);
end;
function TerminateProcessCallback(processHandle, exitCode: dword) : bool; stdcall;
begin
if ThisIsOurProcess(processHandle) then
begin
result := false;
SetLastError(ERROR_ACCESS_DENIED);
end
else
result :