部分软件为了保护自己,会在自己运行时检测其父进程,如果不是“我的电脑”(即explorer.exe)运行它时,就会退出。为了绕过这种检测,有没有办法以我的电脑身份运行它,除了 模拟双击图标 或 选中图标发送回车键消息。
本人尝试用API函数ShellExecute去运行,仍然未能实现,不知有没有什么问题,请高手指点。或者高手们有更好的方法破解这一软件行为(用编程手段而不是修改其反汇编代码)
procedure TForm1.Button1Click(Sender: TObject);
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
eProcess:THandle;
pProcess:Thandle;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := Sizeof(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
while integer(ContinueLoop) <> 0 do
begin
//showmessage(FProcessEntry32.szExeFile);
if Uppercase(FProcessEntry32.szExeFile) = 'EXPLORER.EXE' then
begin
eProcess:= FProcessEntry32.th32ProcessID;
pProcess:= FProcessEntry32.th32ParentProcessID ;
//showmessage('我的电脑主进程ID是:'+inttostr(eProcess)+' 其父进程ID是:'+inttostr(pProcess));
ShellExecute(eProcess,'open', 'C:\abc.exe', nil, nil, SW_ShowNormal);
//模拟父进程去运行指定文件.
exit;
end;
ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);
end;
CloseHandle (FSnapshotHandle);
end;
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课