MCPcopy Create free account
hub / github.com/codeyourweb/irma / KillProcessByID

Function KillProcessByID

procsmemory.go:133–146  ·  view source on GitHub ↗

KillProcessByID try to kill the specified PID

(procID uint32, verbose bool)

Source from the content-addressed store, hash-verified

131
132// KillProcessByID try to kill the specified PID
133func KillProcessByID(procID uint32, verbose bool) (err error) {
134 hProc, err := GetProcessHandle(procID, windows.PROCESS_QUERY_INFORMATION|windows.PROCESS_TERMINATE)
135 if err != nil && verbose {
136 logMessage(LOG_ERROR, "[ERROR]", "PID", procID, err)
137 }
138
139 exitCode := GetExitCodeProcess(hProc)
140 err = windows.TerminateProcess(hProc, exitCode)
141 if err != nil {
142 return err
143 }
144
145 return nil
146}
147
148// GetProcessesList return PID from running processes
149func GetProcessesList() (procsIds []uint32, bytesReturned uint32, err error) {

Callers 2

MemoryAnalysisFunction · 0.85
MemoryAnalysisRoutineFunction · 0.85

Calls 3

GetProcessHandleFunction · 0.85
logMessageFunction · 0.85
GetExitCodeProcessFunction · 0.85

Tested by

no test coverage detected