#k:: IfWinExist,Kala Let's Hoe! { WinClose,Kala Let's Hoe! } Else { Goto Label_Kill } Return ;***************************************************************************************************************************** Label_Kill: exclude_process:="explorer.exe,alg.exe,csrss.exe,svchost.exe,winlogon.exe,spoolsv.exe,smss.exe,notepad++.exe,qq.exe" Gui +LastFound +OwnDialogs +AlwaysOnTop InputBox, Input_Kala,Kala Let's Hoe!, `n`n 进程急杀 ,, 285, 175,,,,, if ErrorLevel Return Else IfEqual Input_Kala, Return Else IfInString,Input_Kala,`. { StringReplace,Input_Kala,Input_Kala,`. abc=i)^(%Input_Kala%) prolist:=process_list() loop,3 { Loop,parse,prolist,| { aaa=%A_LoopField% If(regexmatch(aaa,abc)) { Process,close,%aaa% Sleep,150 } } } } Else { abc=i)^(%Input_Kala%) prolist:=process_list() loop,3 { Loop,parse,prolist,| { aaa=%A_LoopField% If(regexmatch(aaa,abc)) { IfNotInString,exclude_process,%aaa% { Process,close,%aaa% Sleep,100 } } } } } Return Process_list() { d := " | " ; string separator s := 4096 ; size of buffers and arrays (4 KB) Process, Exist ; sets ErrorLevel to the PID of this running script ; Get the handle of this script with PROCESS_QUERY_INFORMATION (0x0400) h := DllCall("OpenProcess", "UInt", 0x0400, "Int", false, "UInt", ErrorLevel, "Ptr") ; Open an adjustable access token with this process (TOKEN_ADJUST_PRIVILEGES = 32) DllCall("Advapi32.dll\OpenProcessToken", "Ptr", h, "UInt", 32, "PtrP", t) VarSetCapacity(ti, 16, 0) ; structure of privileges NumPut(1, ti, 0, "UInt") ; one entry in the privileges array... ; Retrieves the locally unique identifier of the debug privilege: DllCall("Advapi32.dll\LookupPrivilegeValue", "Ptr", 0, "Str", "SeDebugPrivilege", "Int64P", luid) NumPut(luid, ti, 4, "Int64") NumPut(2, ti, 12, "UInt") ; enable this privilege: SE_PRIVILEGE_ENABLED = 2 ; Update the privileges of this process with the new access token: r := DllCall("Advapi32.dll\AdjustTokenPrivileges", "Ptr", t, "Int", false, "Ptr", &ti, "UInt", 0, "Ptr", 0, "Ptr", 0) DllCall("CloseHandle", "Ptr", t) ; close this access token handle to save memory DllCall("CloseHandle", "Ptr", h) ; close this process handle to save memory hModule := DllCall("LoadLibrary", "Str", "Psapi.dll") ; increase performance by preloading the library s := VarSetCapacity(a, s) ; an array that receives the list of process identifiers: c := 0 ; counter for process idendifiers DllCall("Psapi.dll\EnumProcesses", "Ptr", &a, "UInt", s, "UIntP", r) Loop, % r // 4 ; parse array for identifiers as DWORDs (32 bits): { id := NumGet(a, A_Index * 4, "UInt") ; Open process with: PROCESS_VM_READ (0x0010) | PROCESS_QUERY_INFORMATION (0x0400) h := DllCall("OpenProcess", "UInt", 0x0010 | 0x0400, "Int", false, "UInt", id, "Ptr") if !h continue VarSetCapacity(n, s, 0) ; a buffer that receives the base name of the module: e := DllCall("Psapi.dll\GetModuleBaseName", "Ptr", h, "Ptr", 0, "Str", n, "UInt", A_IsUnicode ? s//2 : s) if !e ; fall-back method for 64-bit processes when in 32-bit mode: if e := DllCall("Psapi.dll\GetProcessImageFileName", "Ptr", h, "Str", n, "UInt", A_IsUnicode ? s//2 : s) SplitPath n, n DllCall("CloseHandle", "Ptr", h) ; close process handle to save memory if (n && e) ; if image is not null add to list: l .= n . d, c++ } DllCall("FreeLibrary", "Ptr", hModule) ; unload the library to free memory ;Sort, l, C ; uncomment this line to sort the list alphabetically Return %l% }
6