process

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERROR_NO_MORE_FILES = 0x12
	MAX_PATH            = 260
)

Some constants from the Windows API

Variables

This section is empty.

Functions

func GetTokenByPid added in v0.0.7

func GetTokenByPid(pid int) (syscall.Token, error)

func GetTokenByProcessName added in v0.0.7

func GetTokenByProcessName(name string) (syscall.Token, error)

func RunCommandByProcess added in v0.0.7

func RunCommandByProcess(processName string, cmd *exec.Cmd) (string, error)

func RunCommandByToken added in v0.0.7

func RunCommandByToken(token syscall.Token, cmd *exec.Cmd) ([]byte, error)

Types

type PROCESSENTRY32

type PROCESSENTRY32 struct {
	Size              uint32
	CntUsage          uint32
	ProcessID         uint32
	DefaultHeapID     uintptr
	ModuleID          uint32
	CntThreads        uint32
	ParentProcessID   uint32
	PriorityClassBase int32
	Flags             uint32
	ExeFile           [MAX_PATH]uint16
}

PROCESSENTRY32 is the Windows API structure that contains a process's information.

type Process

type Process interface {
	// Pid is the process ID for this process.
	Pid() int

	// PPid is the parent process ID for this process.
	PPid() int

	// Executable name running this process. This is not a path to the
	// executable.
	Executable() string
}

func FindProcess

func FindProcess(pid int) (Process, error)

func FindProcessByName added in v0.0.7

func FindProcessByName(name string) (Process, error)

func Processes

func Processes() ([]Process, error)

type WindowsProcess

type WindowsProcess struct {
	// contains filtered or unexported fields
}

WindowsProcess is an implementation of Process for Windows.

func (*WindowsProcess) Executable

func (p *WindowsProcess) Executable() string

func (*WindowsProcess) PPid

func (p *WindowsProcess) PPid() int

func (*WindowsProcess) Pid

func (p *WindowsProcess) Pid() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL