- 注册时间
- 2011-3-6
- 最后登录
- 1970-1-1
该用户从未签到
|
uses TlHelp32;
------------
var
//检查自己的进程的父进程
Pn:TProcesseNtry32;
sHandle:THandle;
Found:Boolean;
Buffer:array[0..1023]of Char;
runexe,ExeFile,Path:string;
begin
//反调试
// H:= 0;
// ExplProc:= 0;
//ParentProc:= 0;
//得到Windows的目录
SetString(Path,Buffer, GetWindowsDirectory(Buffer,Sizeof(Buffer)- 1));
ExeFile:= UpperCase(Path)+ '\EXPLORER.EXE';//得到Explorer的路径
//得到所有进程的列表快照
// ShowMessage(ParamStr(0));
sHandle:= CreateToolHelp32SnapShot(TH32CS_SNAPALL,0);
Found:= Process32First(sHandle,Pn);//查找进程
// if found then ShowMessage('1');
while Found do //遍历所有进程
begin
if pos(UpperCase(Pn.szExeFile),UpperCase( ParamStr(0)))>0 then //自己的进程
begin
// ShowMessage(UpperCase(Pn.szExeFile));
ParentProc:= Pn.th32ParentProcessID;//得到父进程的进程ID
// ShowMessage(UpperCase(get_proc_name_nt(ParentProc)));
// ShowMessage(UpperCase(ExeFile));
//父进程不是系统进程
if UpperCase(get_proc_name_nt(ParentProc))<> UpperCase(ExeFile) then
begin
//父进程的句柄
ParentHandle:= OpenProcess(PROCESS_ALL_ACCESS,True,Pn.th32ParentProcessID);
Application.Terminate;
TerminateProcess(ParentHandle,0);
end;
// ShowMessage(inttostr(ParentHandle));
end;
Found:= Process32Next(sHandle,Pn);//查找下一个
end;
end;
现在很多人喜欢用DEDE或其他软件进行自动反编译delphi的程序,把这子程序加入到程序建窗体里,可以达到目的
以后教大家如何用vmp加壳进行虚拟机加密 |
|