--====----====----====----====----====----====----====----====----====----===-- -- Name: femmefatalle -- Purpose: Terminates a system process based on a filename passed -- Values: sProcess: the process (e.g. apache.exe) to search for -- Returns: True if the process exists and was terminated, false if either -- the process wasn't terminated, or no process matched requested. --====----====----====----====----====----====----====----====----====----===-- function mortifere(sProcess) -- ****( DECLARE LOCAL VARIABLES )**** local tProcesses = {}; local tSplitPath = {}; local sFilename = ""; local bReturn = false; -- ****( GET TABLE OF ALL SYSTEM PROCESSES )**** tProcesses = System.EnumerateProcesses(false); -- ****( TRAVERSE THE PROCESS TABLE )**** for nHandle, sProcessPath in tProcesses do -- ****( SPLIT THE CURRENT PATH, GET JUST FILENAME AND EXTENSION )**** tSplitPath = String.SplitPath(sProcessPath); sFilename = tSplitPath.Filename .. tSplitPath.Extension; -- ****( IF THE CURRENT FILENAME/EXTENSION MATCHES PASSED )**** if String.CompareNoCase(sFilename, sProcess) == 0 then -- ****( PROCESSES MATCH, TERMINATE IT )**** System.TerminateProcess(nHandle); -- ****( GET THE LAST ERROR AND SET RETURN VALUE )**** err = Application.GetLastError(); if (err == 0) then bReturn = true; else bReturn = false; end end end -- ****( RETURN TRUE/FALSE )**** return bReturn end