Ver Mensaje Individual
  #1  
Antiguo 06-02-2008
lostprophets lostprophets is offline
Miembro
 
Registrado: sep 2006
Posts: 33
Reputación: 0
lostprophets Va por buen camino
Ayuda Matar un proceso aunque cambie de nombre

weno actualmente uso esto:

Código Delphi [-]
function KillTask(FileName:String):integer;
var 
ContinueLoop:BOOL;
FSnapshotHandle:THandle;
FProcessEntry32:TProcessEntry32;
const 
PROCESS_TERMINATE=$0001;
begin 
FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
FProcessEntry32.dwSize:=Sizeof(FProcessEntry32);
ContinueLoop:=Process32First(FSnapshotHandle,FProcessEntry32);
while integer(ContinueLoop)<>0 do 
begin 
if 
((UpperCase(ExtractFileName(FProcessEntry32.szExeFile))=UpperCase(FileName))
or (UpperCase(FProcessEntry32.szExeFile)=UpperCase(FileName)))
then 

Result:=Integer(TerminateProcess(OpenProcess(PROCESS_TERMINATE,BOOL(0),

FProcessEntry32.th32ProcessID),0));
ContinueLoop:=Process32Next(FSnapshotHandle,FProcessEntry32);
end; 
CloseHandle(FSnapshotHandle);
end; 


begin 
KillTask('Notepad.exe');
end

pero si le cambio de nombre al archivo se va a poder ejecutar no?

algo fijo y unico del archivo aparte del CRC ? PID? ayuda?

Última edición por lostprophets fecha: 06-02-2008 a las 21:14:15.
Responder Con Cita