appcontrol

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package appcontrol knows about Windows' Smart App Control: whether it's on, whether the programs and libraries about to be installed are signed so that it would let them run, and how to say so when it blocks one. On other systems it has nothing to say.

Smart App Control lets a program or DLL load only if Microsoft's reputation service knows it, or it's signed by a publisher Windows trusts. There's no exception for one program, and once turned off it can't be turned on again without reinstalling Windows, so nothing here ever suggests turning it off.

Index

Constants

View Source
const (
	Off        = "off"
	On         = "on"
	Evaluation = "evaluation" // watching, not blocking yet: it turns itself on or off later
)

Smart App Control's states, as Windows Security names them.

Variables

This section is empty.

Functions

func CheckInstall

func CheckInstall(dir, what, fix string) error

CheckInstall answers before files are installed: a *Blocked when Smart App Control is on and any program or library under dir isn't signed, otherwise nil. While Smart App Control is only in evaluation, it blocks nothing, so neither does this.

func Explain

func Explain(err error, path, fix string) error

Explain turns a failure to start the program at path into a *Blocked when Windows refused it for its application control policy, which is what Smart App Control does. Other errors are returned as they are.

func IsPE

func IsPE(path string) bool

IsPE reports whether the file is a Windows program or library, by its first bytes rather than its name, so a renamed DLL isn't missed.

func State

func State() string

State is Smart App Control's state on this computer, or "" where there's no such thing (not Windows, or a Windows without it).

func Unsigned

func Unsigned(dir string) ([]string, error)

Unsigned lists the Windows programs and libraries under dir (or dir itself, if it's a file) that Windows' own check doesn't find signed by a publisher it trusts, as paths relative to dir. Elsewhere it lists nothing.

func Words

func Words(s string) string

Words says the state for people.

Types

type Blocked

type Blocked struct {
	What  string   // "this module", "this core"
	Files []string // the files it would block, or did
	Ran   bool     // Windows refused to start it, rather than a check before installing
	Fix   string   // what to do instead
}

Blocked is the answer when Smart App Control would block, or has blocked, a file.

func (*Blocked) Error

func (b *Blocked) Error() string

Jump to

Keyboard shortcuts

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