Tinkering
This commit is contained in:
parent
ff5600d6c2
commit
d923ec2721
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ assets/
|
||||
*.unused
|
||||
*.toml
|
||||
*.swp
|
||||
*.test
|
||||
|
1
go.mod
1
go.mod
@ -12,6 +12,7 @@ require (
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0
|
||||
github.com/manifoldco/promptui v0.9.0
|
||||
github.com/mazznoer/colorgrad v0.9.0
|
||||
github.com/muesli/termenv v0.12.0
|
||||
github.com/rs/zerolog v1.27.0
|
||||
github.com/spf13/viper v1.12.0
|
||||
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2
|
||||
|
3
go.sum
3
go.sum
@ -283,6 +283,8 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/muesli/termenv v0.12.0 h1:KuQRUE3PgxRFWhq4gHvZtPSLCGDqM5q/cYr1pZ39ytc=
|
||||
github.com/muesli/termenv v0.12.0/go.mod h1:WCCv32tusQ/EEZ5S8oUIIrC/nIuBcxCVqlN4Xfkv+7A=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
@ -576,6 +578,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=
|
||||
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -196,9 +196,9 @@ func StartCLI() {
|
||||
for _, br := range ziggy.Lucifer.Bridges {
|
||||
grpmap, err := getGroupMap(br)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("error getting group map")
|
||||
log.Fatal().Err(err).Msg("error getting group map")
|
||||
} else {
|
||||
processGroups(br, grpmap)
|
||||
processGroups(grpmap)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
cli "git.tcp.direct/Mirrors/go-prompt"
|
||||
@ -79,7 +80,9 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||
return errors.New("not enough arguments")
|
||||
}
|
||||
|
||||
var target interface {
|
||||
type (
|
||||
action func() error
|
||||
targeted interface {
|
||||
On() error
|
||||
Off() error
|
||||
Bri(uint8) error
|
||||
@ -90,12 +93,14 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||
SetState(huego.State) error
|
||||
Alert(string) error
|
||||
}
|
||||
)
|
||||
|
||||
var groupmap map[string]*huego.Group
|
||||
|
||||
type action func() error
|
||||
var actions []action
|
||||
var currentState *huego.State
|
||||
var (
|
||||
groupmap map[string]*huego.Group
|
||||
actions []action
|
||||
currentState *huego.State
|
||||
target targeted
|
||||
)
|
||||
|
||||
var argHead = -1
|
||||
for range args {
|
||||
@ -115,10 +120,13 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||
return errors.New("no group specified")
|
||||
}
|
||||
argHead++
|
||||
g, ok := groupmap[args[argHead]]
|
||||
g, ok := groupmap[strings.TrimSpace(args[argHead])]
|
||||
if !ok {
|
||||
return errors.New("group not found")
|
||||
return fmt.Errorf("group %s not found (argHead: %d)", args[argHead], argHead)
|
||||
}
|
||||
log.Trace().Str("group", g.Name).Msgf("found group %s via args[%d]",
|
||||
args[argHead], argHead,
|
||||
)
|
||||
target = g
|
||||
case "on":
|
||||
actions = append(actions, target.On)
|
||||
@ -190,7 +198,7 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||
switch cpuOn {
|
||||
case false:
|
||||
load, err := system.CPULoadGradient(cpuCtx,
|
||||
"deepskyblue", "seagreen", "darkorchid", "gold", "deeppink")
|
||||
"deepskyblue", "gold", "deeppink", "darkorange", "red")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -269,12 +277,17 @@ func cmdSet(bridge *ziggy.Bridge, args []string) error {
|
||||
|
||||
func getGroupMap(br *ziggy.Bridge) (map[string]*huego.Group, error) {
|
||||
var groupmap = make(map[string]*huego.Group)
|
||||
gs, err := br.Bridge.GetGroups()
|
||||
gs, err := br.GetGroups()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, g := range gs {
|
||||
groupmap[g.Name] = &g
|
||||
for i, g := range gs {
|
||||
grp, gerr := br.GetGroup(i)
|
||||
if gerr != nil {
|
||||
log.Warn().Msgf("[%s] %w", g.Name, gerr)
|
||||
continue
|
||||
}
|
||||
groupmap[g.Name] = grp
|
||||
}
|
||||
return groupmap, nil
|
||||
}
|
||||
@ -287,8 +300,8 @@ func cmdGroups(br *ziggy.Bridge, args []string) error {
|
||||
if len(groupmap) == 0 {
|
||||
return errors.New("no groups found")
|
||||
}
|
||||
for _, g := range groupmap {
|
||||
log.Info().Str("caller", g.Name).Str("type", g.Type).Int("ID", g.ID).
|
||||
for n, g := range groupmap {
|
||||
log.Info().Str("caller", g.Name).Str("mapname", n).Str("type", g.Type).Int("ID", g.ID).
|
||||
Str("class", g.Class).Bool("on", g.IsOn()).Msgf("%v", g.GroupState)
|
||||
}
|
||||
return nil
|
||||
@ -307,7 +320,7 @@ type completeMapper map[*cli.Suggest][]cli.Suggest
|
||||
|
||||
var suggestions completeMapper = make(map[*cli.Suggest][]cli.Suggest)
|
||||
|
||||
func processGroups(br *ziggy.Bridge, grps map[string]*huego.Group) {
|
||||
func processGroups(grps map[string]*huego.Group) {
|
||||
set := &cli.Suggest{
|
||||
Text: "set",
|
||||
}
|
||||
@ -315,14 +328,14 @@ func processGroups(br *ziggy.Bridge, grps map[string]*huego.Group) {
|
||||
{Text: "light"},
|
||||
}
|
||||
|
||||
/* for grp, g := range grps {
|
||||
for grp, g := range grps {
|
||||
suggestions[set] = append(
|
||||
suggestions[set],
|
||||
cli.Suggest{
|
||||
Text: grp,
|
||||
Description: br.ID + ": " + g.Type,
|
||||
Description: g.Type,
|
||||
})
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
func processBridges(brs map[string]*ziggy.Bridge) {
|
||||
|
@ -14,7 +14,7 @@ func cpuLoad(ctx context.Context) (chan int, error) {
|
||||
loadChan := make(chan int, 10)
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
time.Sleep(2 * time.Second)
|
||||
cpu, err := syStats.GetCPU()
|
||||
if err != nil {
|
||||
return
|
||||
@ -33,7 +33,7 @@ func cpuLoad(ctx context.Context) (chan int, error) {
|
||||
func CPULoadGradient(ctx context.Context, colors ...string) (chan colorful.Color, error) {
|
||||
grad, err := colorgrad.NewGradient().
|
||||
HtmlColors(colors...).
|
||||
Domain(0, 100).
|
||||
Domain(0, 75).
|
||||
Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
31
internal/system/stats_test.go
Normal file
31
internal/system/stats_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/muesli/termenv"
|
||||
)
|
||||
|
||||
func TestCPULoadGradient(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
grad, err := CPULoadGradient(ctx, "deepskyblue", "deeppink")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
p := termenv.ColorProfile()
|
||||
spew.Dump(p)
|
||||
s := termenv.String("yeet")
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
col := <-grad
|
||||
fmt.Println(col.Hex() + ": " + s.Foreground(p.Color(col.Hex())).String())
|
||||
}
|
||||
}
|
||||
}
|
15
vendor/github.com/muesli/termenv/.gitignore
generated
vendored
Normal file
15
vendor/github.com/muesli/termenv/.gitignore
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
47
vendor/github.com/muesli/termenv/.golangci-soft.yml
generated
vendored
Normal file
47
vendor/github.com/muesli/termenv/.golangci-soft.yml
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
run:
|
||||
tests: false
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0001
|
||||
- EXC0005
|
||||
- EXC0011
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
linters:
|
||||
enable:
|
||||
# - dupl
|
||||
- exhaustive
|
||||
# - exhaustivestruct
|
||||
- goconst
|
||||
- godot
|
||||
- godox
|
||||
- gomnd
|
||||
- gomoddirectives
|
||||
- goprintffuncname
|
||||
- ifshort
|
||||
# - lll
|
||||
- misspell
|
||||
- nakedret
|
||||
- nestif
|
||||
- noctx
|
||||
- nolintlint
|
||||
- prealloc
|
||||
- wrapcheck
|
||||
|
||||
# disable default linters, they are already enabled in .golangci.yml
|
||||
disable:
|
||||
- deadcode
|
||||
- errcheck
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- typecheck
|
||||
- unused
|
||||
- varcheck
|
29
vendor/github.com/muesli/termenv/.golangci.yml
generated
vendored
Normal file
29
vendor/github.com/muesli/termenv/.golangci.yml
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
run:
|
||||
tests: false
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0001
|
||||
- EXC0005
|
||||
- EXC0011
|
||||
- EXC0012
|
||||
- EXC0013
|
||||
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- exportloopref
|
||||
- goimports
|
||||
- gosec
|
||||
- nilerr
|
||||
- predeclared
|
||||
- revive
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- tparallel
|
||||
- unconvert
|
||||
- unparam
|
||||
- whitespace
|
21
vendor/github.com/muesli/termenv/LICENSE
generated
vendored
Normal file
21
vendor/github.com/muesli/termenv/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Christian Muehlhaeuser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
359
vendor/github.com/muesli/termenv/README.md
generated
vendored
Normal file
359
vendor/github.com/muesli/termenv/README.md
generated
vendored
Normal file
@ -0,0 +1,359 @@
|
||||
<p align="center">
|
||||
<img src="https://stuff.charm.sh/termenv.png" width="480" alt="termenv Logo">
|
||||
<br />
|
||||
<a href="https://github.com/muesli/termenv/releases"><img src="https://img.shields.io/github/release/muesli/termenv.svg" alt="Latest Release"></a>
|
||||
<a href="https://godoc.org/github.com/muesli/termenv"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
|
||||
<a href="https://github.com/muesli/termenv/actions"><img src="https://github.com/muesli/termenv/workflows/build/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://coveralls.io/github/muesli/termenv?branch=master"><img src="https://coveralls.io/repos/github/muesli/termenv/badge.svg?branch=master" alt="Coverage Status"></a>
|
||||
<a href="https://goreportcard.com/report/muesli/termenv"><img src="https://goreportcard.com/badge/muesli/termenv" alt="Go ReportCard"></a>
|
||||
<br />
|
||||
<img src="https://github.com/muesli/termenv/raw/master/examples/hello-world/hello-world.png" alt="Example terminal output">
|
||||
</p>
|
||||
|
||||
`termenv` lets you safely use advanced styling options on the terminal. It
|
||||
gathers information about the terminal environment in terms of its ANSI & color
|
||||
support and offers you convenient methods to colorize and style your output,
|
||||
without you having to deal with all kinds of weird ANSI escape sequences and
|
||||
color conversions.
|
||||
|
||||
## Features
|
||||
|
||||
- RGB/TrueColor support
|
||||
- Detects the supported color range of your terminal
|
||||
- Automatically converts colors to the best matching, available colors
|
||||
- Terminal theme (light/dark) detection
|
||||
- Chainable syntax
|
||||
- Nested styles
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
go get github.com/muesli/termenv
|
||||
```
|
||||
|
||||
## Query Terminal Support
|
||||
|
||||
`termenv` can query the terminal it is running in, so you can safely use
|
||||
advanced features, like RGB colors. `ColorProfile` returns the color profile
|
||||
supported by the terminal:
|
||||
|
||||
```go
|
||||
profile := termenv.ColorProfile()
|
||||
```
|
||||
|
||||
This returns one of the supported color profiles:
|
||||
|
||||
- `termenv.Ascii` - no ANSI support detected, ASCII only
|
||||
- `termenv.ANSI` - 16 color ANSI support
|
||||
- `termenv.ANSI256` - Extended 256 color ANSI support
|
||||
- `termenv.TrueColor` - RGB/TrueColor support
|
||||
|
||||
Alternatively, you can use `termenv.EnvColorProfile` which evaluates the
|
||||
terminal like `ColorProfile`, but also respects the `NO_COLOR` and
|
||||
`CLICOLOR_FORCE` environment variables.
|
||||
|
||||
You can also query the terminal for its color scheme, so you know whether your
|
||||
app is running in a light- or dark-themed environment:
|
||||
|
||||
```go
|
||||
// Returns terminal's foreground color
|
||||
color := termenv.ForegroundColor()
|
||||
|
||||
// Returns terminal's background color
|
||||
color := termenv.BackgroundColor()
|
||||
|
||||
// Returns whether terminal uses a dark-ish background
|
||||
darkTheme := termenv.HasDarkBackground()
|
||||
```
|
||||
|
||||
## Colors
|
||||
|
||||
`termenv` supports multiple color profiles: ANSI (16 colors), ANSI Extended
|
||||
(256 colors), and TrueColor (24-bit RGB). Colors will automatically be degraded
|
||||
to the best matching available color in the desired profile:
|
||||
|
||||
`TrueColor` => `ANSI 256 Colors` => `ANSI 16 Colors` => `Ascii`
|
||||
|
||||
```go
|
||||
s := termenv.String("Hello World")
|
||||
|
||||
// Retrieve color profile supported by terminal
|
||||
p := termenv.ColorProfile()
|
||||
|
||||
// Supports hex values
|
||||
// Will automatically degrade colors on terminals not supporting RGB
|
||||
s.Foreground(p.Color("#abcdef"))
|
||||
// but also supports ANSI colors (0-255)
|
||||
s.Background(p.Color("69"))
|
||||
// ...or the color.Color interface
|
||||
s.Foreground(p.FromColor(color.RGBA{255, 128, 0, 255}))
|
||||
|
||||
// Combine fore- & background colors
|
||||
s.Foreground(p.Color("#ffffff")).Background(p.Color("#0000ff"))
|
||||
|
||||
// Supports the fmt.Stringer interface
|
||||
fmt.Println(s)
|
||||
```
|
||||
|
||||
## Styles
|
||||
|
||||
You can use a chainable syntax to compose your own styles:
|
||||
|
||||
```go
|
||||
s := termenv.String("foobar")
|
||||
|
||||
// Text styles
|
||||
s.Bold()
|
||||
s.Faint()
|
||||
s.Italic()
|
||||
s.CrossOut()
|
||||
s.Underline()
|
||||
s.Overline()
|
||||
|
||||
// Reverse swaps current fore- & background colors
|
||||
s.Reverse()
|
||||
|
||||
// Blinking text
|
||||
s.Blink()
|
||||
|
||||
// Combine multiple options
|
||||
s.Bold().Underline()
|
||||
```
|
||||
|
||||
## Template Helpers
|
||||
|
||||
```go
|
||||
// load template helpers
|
||||
f := termenv.TemplateFuncs(termenv.ColorProfile())
|
||||
tpl := template.New("tpl").Funcs(f)
|
||||
|
||||
// apply bold style in a template
|
||||
bold := `{{ Bold "Hello World" }}`
|
||||
|
||||
// examples for colorized templates
|
||||
col := `{{ Color "#ff0000" "#0000ff" "Red on Blue" }}`
|
||||
fg := `{{ Foreground "#ff0000" "Red Foreground" }}`
|
||||
bg := `{{ Background "#0000ff" "Blue Background" }}`
|
||||
|
||||
// wrap styles
|
||||
wrap := `{{ Bold (Underline "Hello World") }}`
|
||||
|
||||
// parse and render
|
||||
tpl, err = tpl.Parse(bold)
|
||||
|
||||
var buf bytes.Buffer
|
||||
tpl.Execute(&buf, nil)
|
||||
fmt.Println(&buf)
|
||||
```
|
||||
|
||||
Other available helper functions are: `Faint`, `Italic`, `CrossOut`,
|
||||
`Underline`, `Overline`, `Reverse`, and `Blink`.
|
||||
|
||||
## Positioning
|
||||
|
||||
```go
|
||||
// Move the cursor to a given position
|
||||
termenv.MoveCursor(row, column)
|
||||
|
||||
// Save the cursor position
|
||||
termenv.SaveCursorPosition()
|
||||
|
||||
// Restore a saved cursor position
|
||||
termenv.RestoreCursorPosition()
|
||||
|
||||
// Move the cursor up a given number of lines
|
||||
termenv.CursorUp(n)
|
||||
|
||||
// Move the cursor down a given number of lines
|
||||
termenv.CursorDown(n)
|
||||
|
||||
// Move the cursor up a given number of lines
|
||||
termenv.CursorForward(n)
|
||||
|
||||
// Move the cursor backwards a given number of cells
|
||||
termenv.CursorBack(n)
|
||||
|
||||
// Move the cursor down a given number of lines and place it at the beginning
|
||||
// of the line
|
||||
termenv.CursorNextLine(n)
|
||||
|
||||
// Move the cursor up a given number of lines and place it at the beginning of
|
||||
// the line
|
||||
termenv.CursorPrevLine(n)
|
||||
```
|
||||
|
||||
## Screen
|
||||
|
||||
```go
|
||||
// Reset the terminal to its default style, removing any active styles
|
||||
termenv.Reset()
|
||||
|
||||
// RestoreScreen restores a previously saved screen state
|
||||
termenv.RestoreScreen()
|
||||
|
||||
// SaveScreen saves the screen state
|
||||
termenv.SaveScreen()
|
||||
|
||||
// Switch to the altscreen. The former view can be restored with ExitAltScreen()
|
||||
termenv.AltScreen()
|
||||
|
||||
// Exit the altscreen and return to the former terminal view
|
||||
termenv.ExitAltScreen()
|
||||
|
||||
// Clear the visible portion of the terminal
|
||||
termenv.ClearScreen()
|
||||
|
||||
// Clear the current line
|
||||
termenv.ClearLine()
|
||||
|
||||
// Clear a given number of lines
|
||||
termenv.ClearLines(n)
|
||||
|
||||
// Set the scrolling region of the terminal
|
||||
termenv.ChangeScrollingRegion(top, bottom)
|
||||
|
||||
// Insert the given number of lines at the top of the scrollable region, pushing
|
||||
// lines below down
|
||||
termenv.InsertLines(n)
|
||||
|
||||
// Delete the given number of lines, pulling any lines in the scrollable region
|
||||
// below up
|
||||
termenv.DeleteLines(n)
|
||||
```
|
||||
|
||||
## Session
|
||||
|
||||
```go
|
||||
// SetWindowTitle sets the terminal window title
|
||||
termenv.SetWindowTitle(title)
|
||||
|
||||
// SetForegroundColor sets the default foreground color
|
||||
termenv.SetForegroundColor(color)
|
||||
|
||||
// SetBackgroundColor sets the default background color
|
||||
termenv.SetBackgroundColor(color)
|
||||
|
||||
// SetCursorColor sets the cursor color
|
||||
termenv.SetCursorColor(color)
|
||||
|
||||
// Hide the cursor
|
||||
termenv.HideCursor()
|
||||
|
||||
// Show the cursor
|
||||
termenv.ShowCursor()
|
||||
```
|
||||
|
||||
## Mouse
|
||||
|
||||
```go
|
||||
// Enable X10 mouse mode, only button press events are sent
|
||||
termenv.EnableMousePress()
|
||||
|
||||
// Disable X10 mouse mode
|
||||
termenv.DisableMousePress()
|
||||
|
||||
// Enable Mouse Tracking mode
|
||||
termenv.EnableMouse()
|
||||
|
||||
// Disable Mouse Tracking mode
|
||||
termenv.DisableMouse()
|
||||
|
||||
// Enable Hilite Mouse Tracking mode
|
||||
termenv.EnableMouseHilite()
|
||||
|
||||
// Disable Hilite Mouse Tracking mode
|
||||
termenv.DisableMouseHilite()
|
||||
|
||||
// Enable Cell Motion Mouse Tracking mode
|
||||
termenv.EnableMouseCellMotion()
|
||||
|
||||
// Disable Cell Motion Mouse Tracking mode
|
||||
termenv.DisableMouseCellMotion()
|
||||
|
||||
// Enable All Motion Mouse mode
|
||||
termenv.EnableMouseAllMotion()
|
||||
|
||||
// Disable All Motion Mouse mode
|
||||
termenv.DisableMouseAllMotion()
|
||||
```
|
||||
|
||||
## Optional Feature Support
|
||||
|
||||
| Terminal | Alt Screen | Query Color Scheme | Query Cursor Position | Set Window Title | Change Cursor Color | Change Default Foreground Setting | Change Default Background Setting |
|
||||
| ---------------- | :--------: | :----------------: | :-------------------: | :--------------: | :-----------------: | :-------------------------------: | :-------------------------------: |
|
||||
| alacritty | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| foot | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| kitty | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Konsole | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
|
||||
| rxvt | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| screen | ✅ | ⛔[^mux] | ✅ | ✅ | ❌ | ❌ | ✅ |
|
||||
| st | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| tmux | ✅ | ⛔[^mux] | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| vte-based[^vte] | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||
| wezterm | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| xterm | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
||||
| Linux Console | ✅ | ❌ | ✅ | ⛔ | ❌ | ❌ | ❌ |
|
||||
| Apple Terminal | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
|
||||
| iTerm | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
|
||||
| Windows cmd | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Windows Terminal | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
||||
|
||||
[^vte]: This covers all vte-based terminals, including Gnome Terminal, guake, Pantheon Terminal, Terminator, Tilix, XFCE Terminal.
|
||||
[^mux]: Unavailable as multiplexers (like tmux or screen) can be connected to multiple terminals (with different color settings) at the same time.
|
||||
|
||||
You can help improve this list! Check out [how to](ansi_compat.md) and open an issue or pull request.
|
||||
|
||||
### Color Support
|
||||
|
||||
- 24-bit (RGB): alacritty, foot, iTerm, kitty, Konsole, st, tmux, vte-based, wezterm, Windows Terminal
|
||||
- 8-bit (256): rxvt, screen, xterm, Apple Terminal
|
||||
- 4-bit (16): Linux Console
|
||||
|
||||
## Platform Support
|
||||
|
||||
`termenv` works on Unix systems (like Linux, macOS, or BSD) and Windows. While
|
||||
terminal applications on Unix support ANSI styling out-of-the-box, on Windows
|
||||
you need to enable ANSI processing in your application first:
|
||||
|
||||
```go
|
||||
mode, err := termenv.EnableWindowsANSIConsole()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer termenv.RestoreWindowsConsole(mode)
|
||||
```
|
||||
|
||||
## Color Chart
|
||||
|
||||
![ANSI color chart](https://github.com/muesli/termenv/raw/master/examples/color-chart/color-chart.png)
|
||||
|
||||
You can find the source code used to create this chart in `termenv`'s examples.
|
||||
|
||||
## Related Projects
|
||||
|
||||
- [reflow](https://github.com/muesli/reflow) - ANSI-aware text operations
|
||||
- [Lip Gloss](https://github.com/charmbracelet/lipgloss) - style definitions for nice terminal layouts 👄
|
||||
- [ansi](https://github.com/muesli/ansi) - ANSI sequence helpers
|
||||
|
||||
## termenv in the Wild
|
||||
|
||||
Need some inspiration or just want to see how others are using `termenv`? Check
|
||||
out these projects:
|
||||
|
||||
- [Bubble Tea](https://github.com/charmbracelet/bubbletea) - a powerful little TUI framework 🏗
|
||||
- [Glamour](https://github.com/charmbracelet/glamour) - stylesheet-based markdown rendering for your CLI apps 💇🏻♀️
|
||||
- [Glow](https://github.com/charmbracelet/glow) - a markdown renderer for the command-line 💅🏻
|
||||
- [duf](https://github.com/muesli/duf) - Disk Usage/Free Utility - a better 'df' alternative
|
||||
- [gitty](https://github.com/muesli/gitty) - contextual information about your git projects
|
||||
- [slides](https://github.com/maaslalani/slides) - terminal-based presentation tool
|
||||
|
||||
## Feedback
|
||||
|
||||
Got some feedback or suggestions? Please open an issue or drop me a note!
|
||||
|
||||
* [Twitter](https://twitter.com/mueslix)
|
||||
* [The Fediverse](https://mastodon.social/@fribbledom)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/muesli/termenv/raw/master/LICENSE)
|
48
vendor/github.com/muesli/termenv/ansi_compat.md
generated
vendored
Normal file
48
vendor/github.com/muesli/termenv/ansi_compat.md
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
## Change Foreground Color
|
||||
|
||||
This command should enable a blue foreground color:
|
||||
|
||||
```bash
|
||||
echo -ne "\033]10;#0000ff\007"
|
||||
```
|
||||
|
||||
## Change Background Color
|
||||
|
||||
This command should enable a green background color:
|
||||
|
||||
```bash
|
||||
echo -ne "\033]11;#00ff00\007"
|
||||
```
|
||||
|
||||
## Change Cursor Color
|
||||
|
||||
This command should enable a red cursor color:
|
||||
|
||||
```bash
|
||||
echo -ne "\033]12;#ff0000\007"
|
||||
```
|
||||
|
||||
## Query Color Scheme
|
||||
|
||||
These two commands should print out the currently active color scheme:
|
||||
|
||||
```bash
|
||||
echo -ne "\033]10;?\033\\"
|
||||
echo -ne "\033]11;?\033\\"
|
||||
```
|
||||
|
||||
## Query Cursor Position
|
||||
|
||||
This command should print out the current cursor position:
|
||||
|
||||
```bash
|
||||
echo -ne "\033[6n"
|
||||
```
|
||||
|
||||
## Set Window Title
|
||||
|
||||
This command should set the window title to "Test":
|
||||
|
||||
```bash
|
||||
echo -ne "\033]2;Test\007" && sleep 10
|
||||
```
|
281
vendor/github.com/muesli/termenv/ansicolors.go
generated
vendored
Normal file
281
vendor/github.com/muesli/termenv/ansicolors.go
generated
vendored
Normal file
@ -0,0 +1,281 @@
|
||||
package termenv
|
||||
|
||||
// ANSI color codes
|
||||
const (
|
||||
ANSIBlack ANSIColor = iota
|
||||
ANSIRed
|
||||
ANSIGreen
|
||||
ANSIYellow
|
||||
ANSIBlue
|
||||
ANSIMagenta
|
||||
ANSICyan
|
||||
ANSIWhite
|
||||
ANSIBrightBlack
|
||||
ANSIBrightRed
|
||||
ANSIBrightGreen
|
||||
ANSIBrightYellow
|
||||
ANSIBrightBlue
|
||||
ANSIBrightMagenta
|
||||
ANSIBrightCyan
|
||||
ANSIBrightWhite
|
||||
)
|
||||
|
||||
// RGB values of ANSI colors (0-255).
|
||||
var ansiHex = []string{
|
||||
"#000000",
|
||||
"#800000",
|
||||
"#008000",
|
||||
"#808000",
|
||||
"#000080",
|
||||
"#800080",
|
||||
"#008080",
|
||||
"#c0c0c0",
|
||||
"#808080",
|
||||
"#ff0000",
|
||||
"#00ff00",
|
||||
"#ffff00",
|
||||
"#0000ff",
|
||||
"#ff00ff",
|
||||
"#00ffff",
|
||||
"#ffffff",
|
||||
"#000000",
|
||||
"#00005f",
|
||||
"#000087",
|
||||
"#0000af",
|
||||
"#0000d7",
|
||||
"#0000ff",
|
||||
"#005f00",
|
||||
"#005f5f",
|
||||
"#005f87",
|
||||
"#005faf",
|
||||
"#005fd7",
|
||||
"#005fff",
|
||||
"#008700",
|
||||
"#00875f",
|
||||
"#008787",
|
||||
"#0087af",
|
||||
"#0087d7",
|
||||
"#0087ff",
|
||||
"#00af00",
|
||||
"#00af5f",
|
||||
"#00af87",
|
||||
"#00afaf",
|
||||
"#00afd7",
|
||||
"#00afff",
|
||||
"#00d700",
|
||||
"#00d75f",
|
||||
"#00d787",
|
||||
"#00d7af",
|
||||
"#00d7d7",
|
||||
"#00d7ff",
|
||||
"#00ff00",
|
||||
"#00ff5f",
|
||||
"#00ff87",
|
||||
"#00ffaf",
|
||||
"#00ffd7",
|
||||
"#00ffff",
|
||||
"#5f0000",
|
||||
"#5f005f",
|
||||
"#5f0087",
|
||||
"#5f00af",
|
||||
"#5f00d7",
|
||||
"#5f00ff",
|
||||
"#5f5f00",
|
||||
"#5f5f5f",
|
||||
"#5f5f87",
|
||||
"#5f5faf",
|
||||
"#5f5fd7",
|
||||
"#5f5fff",
|
||||
"#5f8700",
|
||||
"#5f875f",
|
||||
"#5f8787",
|
||||
"#5f87af",
|
||||
"#5f87d7",
|
||||
"#5f87ff",
|
||||
"#5faf00",
|
||||
"#5faf5f",
|
||||
"#5faf87",
|
||||
"#5fafaf",
|
||||
"#5fafd7",
|
||||
"#5fafff",
|
||||
"#5fd700",
|
||||
"#5fd75f",
|
||||
"#5fd787",
|
||||
"#5fd7af",
|
||||
"#5fd7d7",
|
||||
"#5fd7ff",
|
||||
"#5fff00",
|
||||
"#5fff5f",
|
||||
"#5fff87",
|
||||
"#5fffaf",
|
||||
"#5fffd7",
|
||||
"#5fffff",
|
||||
"#870000",
|
||||
"#87005f",
|
||||
"#870087",
|
||||
"#8700af",
|
||||
"#8700d7",
|
||||
"#8700ff",
|
||||
"#875f00",
|
||||
"#875f5f",
|
||||
"#875f87",
|
||||
"#875faf",
|
||||
"#875fd7",
|
||||
"#875fff",
|
||||
"#878700",
|
||||
"#87875f",
|
||||
"#878787",
|
||||
"#8787af",
|
||||
"#8787d7",
|
||||
"#8787ff",
|
||||
"#87af00",
|
||||
"#87af5f",
|
||||
"#87af87",
|
||||
"#87afaf",
|
||||
"#87afd7",
|
||||
"#87afff",
|
||||
"#87d700",
|
||||
"#87d75f",
|
||||
"#87d787",
|
||||
"#87d7af",
|
||||
"#87d7d7",
|
||||
"#87d7ff",
|
||||
"#87ff00",
|
||||
"#87ff5f",
|
||||
"#87ff87",
|
||||
"#87ffaf",
|
||||
"#87ffd7",
|
||||
"#87ffff",
|
||||
"#af0000",
|
||||
"#af005f",
|
||||
"#af0087",
|
||||
"#af00af",
|
||||
"#af00d7",
|
||||
"#af00ff",
|
||||
"#af5f00",
|
||||
"#af5f5f",
|
||||
"#af5f87",
|
||||
"#af5faf",
|
||||
"#af5fd7",
|
||||
"#af5fff",
|
||||
"#af8700",
|
||||
"#af875f",
|
||||
"#af8787",
|
||||
"#af87af",
|
||||
"#af87d7",
|
||||
"#af87ff",
|
||||
"#afaf00",
|
||||
"#afaf5f",
|
||||
"#afaf87",
|
||||
"#afafaf",
|
||||
"#afafd7",
|
||||
"#afafff",
|
||||
"#afd700",
|
||||
"#afd75f",
|
||||
"#afd787",
|
||||
"#afd7af",
|
||||
"#afd7d7",
|
||||
"#afd7ff",
|
||||
"#afff00",
|
||||
"#afff5f",
|
||||
"#afff87",
|
||||
"#afffaf",
|
||||
"#afffd7",
|
||||
"#afffff",
|
||||
"#d70000",
|
||||
"#d7005f",
|
||||
"#d70087",
|
||||
"#d700af",
|
||||
"#d700d7",
|
||||
"#d700ff",
|
||||
"#d75f00",
|
||||
"#d75f5f",
|
||||
"#d75f87",
|
||||
"#d75faf",
|
||||
"#d75fd7",
|
||||
"#d75fff",
|
||||
"#d78700",
|
||||
"#d7875f",
|
||||
"#d78787",
|
||||
"#d787af",
|
||||
"#d787d7",
|
||||
"#d787ff",
|
||||
"#d7af00",
|
||||
"#d7af5f",
|
||||
"#d7af87",
|
||||
"#d7afaf",
|
||||
"#d7afd7",
|
||||
"#d7afff",
|
||||
"#d7d700",
|
||||
"#d7d75f",
|
||||
"#d7d787",
|
||||
"#d7d7af",
|
||||
"#d7d7d7",
|
||||
"#d7d7ff",
|
||||
"#d7ff00",
|
||||
"#d7ff5f",
|
||||
"#d7ff87",
|
||||
"#d7ffaf",
|
||||
"#d7ffd7",
|
||||
"#d7ffff",
|
||||
"#ff0000",
|
||||
"#ff005f",
|
||||
"#ff0087",
|
||||
"#ff00af",
|
||||
"#ff00d7",
|
||||
"#ff00ff",
|
||||
"#ff5f00",
|
||||
"#ff5f5f",
|
||||
"#ff5f87",
|
||||
"#ff5faf",
|
||||
"#ff5fd7",
|
||||
"#ff5fff",
|
||||
"#ff8700",
|
||||
"#ff875f",
|
||||
"#ff8787",
|
||||
"#ff87af",
|
||||
"#ff87d7",
|
||||
"#ff87ff",
|
||||
"#ffaf00",
|
||||
"#ffaf5f",
|
||||
"#ffaf87",
|
||||
"#ffafaf",
|
||||
"#ffafd7",
|
||||
"#ffafff",
|
||||
"#ffd700",
|
||||
"#ffd75f",
|
||||
"#ffd787",
|
||||
"#ffd7af",
|
||||
"#ffd7d7",
|
||||
"#ffd7ff",
|
||||
"#ffff00",
|
||||
"#ffff5f",
|
||||
"#ffff87",
|
||||
"#ffffaf",
|
||||
"#ffffd7",
|
||||
"#ffffff",
|
||||
"#080808",
|
||||
"#121212",
|
||||
"#1c1c1c",
|
||||
"#262626",
|
||||
"#303030",
|
||||
"#3a3a3a",
|
||||
"#444444",
|
||||
"#4e4e4e",
|
||||
"#585858",
|
||||
"#626262",
|
||||
"#6c6c6c",
|
||||
"#767676",
|
||||
"#808080",
|
||||
"#8a8a8a",
|
||||
"#949494",
|
||||
"#9e9e9e",
|
||||
"#a8a8a8",
|
||||
"#b2b2b2",
|
||||
"#bcbcbc",
|
||||
"#c6c6c6",
|
||||
"#d0d0d0",
|
||||
"#dadada",
|
||||
"#e4e4e4",
|
||||
"#eeeeee",
|
||||
}
|
272
vendor/github.com/muesli/termenv/color.go
generated
vendored
Normal file
272
vendor/github.com/muesli/termenv/color.go
generated
vendored
Normal file
@ -0,0 +1,272 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"image/color"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/lucasb-eyer/go-colorful"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrInvalidColor gets returned when a color is invalid.
|
||||
ErrInvalidColor = errors.New("invalid color")
|
||||
)
|
||||
|
||||
// Foreground and Background sequence codes
|
||||
const (
|
||||
Foreground = "38"
|
||||
Background = "48"
|
||||
)
|
||||
|
||||
// Color is an interface implemented by all colors that can be converted to an
|
||||
// ANSI sequence.
|
||||
type Color interface {
|
||||
// Sequence returns the ANSI Sequence for the color.
|
||||
Sequence(bg bool) string
|
||||
}
|
||||
|
||||
// NoColor is a nop for terminals that don't support colors.
|
||||
type NoColor struct{}
|
||||
|
||||
func (c NoColor) String() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// ANSIColor is a color (0-15) as defined by the ANSI Standard.
|
||||
type ANSIColor int
|
||||
|
||||
func (c ANSIColor) String() string {
|
||||
return ansiHex[c]
|
||||
}
|
||||
|
||||
// ANSI256Color is a color (16-255) as defined by the ANSI Standard.
|
||||
type ANSI256Color int
|
||||
|
||||
func (c ANSI256Color) String() string {
|
||||
return ansiHex[c]
|
||||
}
|
||||
|
||||
// RGBColor is a hex-encoded color, e.g. "#abcdef".
|
||||
type RGBColor string
|
||||
|
||||
// ConvertToRGB converts a Color to a colorful.Color.
|
||||
func ConvertToRGB(c Color) colorful.Color {
|
||||
var hex string
|
||||
switch v := c.(type) {
|
||||
case RGBColor:
|
||||
hex = string(v)
|
||||
case ANSIColor:
|
||||
hex = ansiHex[v]
|
||||
case ANSI256Color:
|
||||
hex = ansiHex[v]
|
||||
}
|
||||
|
||||
ch, _ := colorful.Hex(hex)
|
||||
return ch
|
||||
}
|
||||
|
||||
// Convert transforms a given Color to a Color supported within the Profile.
|
||||
func (p Profile) Convert(c Color) Color {
|
||||
if p == Ascii {
|
||||
return NoColor{}
|
||||
}
|
||||
|
||||
switch v := c.(type) {
|
||||
case ANSIColor:
|
||||
return v
|
||||
|
||||
case ANSI256Color:
|
||||
if p == ANSI {
|
||||
return ansi256ToANSIColor(v)
|
||||
}
|
||||
return v
|
||||
|
||||
case RGBColor:
|
||||
h, err := colorful.Hex(string(v))
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if p < TrueColor {
|
||||
ac := hexToANSI256Color(h)
|
||||
if p == ANSI {
|
||||
return ansi256ToANSIColor(ac)
|
||||
}
|
||||
return ac
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
// Color creates a Color from a string. Valid inputs are hex colors, as well as
|
||||
// ANSI color codes (0-15, 16-255).
|
||||
func (p Profile) Color(s string) Color {
|
||||
if len(s) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var c Color
|
||||
if strings.HasPrefix(s, "#") {
|
||||
c = RGBColor(s)
|
||||
} else {
|
||||
i, err := strconv.Atoi(s)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if i < 16 {
|
||||
c = ANSIColor(i)
|
||||
} else {
|
||||
c = ANSI256Color(i)
|
||||
}
|
||||
}
|
||||
|
||||
return p.Convert(c)
|
||||
}
|
||||
|
||||
// FromColor creates a Color from a color.Color.
|
||||
func (p Profile) FromColor(c color.Color) Color {
|
||||
col, _ := colorful.MakeColor(c)
|
||||
return p.Color(col.Hex())
|
||||
}
|
||||
|
||||
// Sequence returns the ANSI Sequence for the color.
|
||||
func (c NoColor) Sequence(bg bool) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Sequence returns the ANSI Sequence for the color.
|
||||
func (c ANSIColor) Sequence(bg bool) string {
|
||||
col := int(c)
|
||||
bgMod := func(c int) int {
|
||||
if bg {
|
||||
return c + 10
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
if col < 8 {
|
||||
return fmt.Sprintf("%d", bgMod(col)+30)
|
||||
}
|
||||
return fmt.Sprintf("%d", bgMod(col-8)+90)
|
||||
}
|
||||
|
||||
// Sequence returns the ANSI Sequence for the color.
|
||||
func (c ANSI256Color) Sequence(bg bool) string {
|
||||
prefix := Foreground
|
||||
if bg {
|
||||
prefix = Background
|
||||
}
|
||||
return fmt.Sprintf("%s;5;%d", prefix, c)
|
||||
}
|
||||
|
||||
// Sequence returns the ANSI Sequence for the color.
|
||||
func (c RGBColor) Sequence(bg bool) string {
|
||||
f, err := colorful.Hex(string(c))
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
prefix := Foreground
|
||||
if bg {
|
||||
prefix = Background
|
||||
}
|
||||
return fmt.Sprintf("%s;2;%d;%d;%d", prefix, uint8(f.R*255), uint8(f.G*255), uint8(f.B*255))
|
||||
}
|
||||
|
||||
func xTermColor(s string) (RGBColor, error) {
|
||||
if len(s) < 24 || len(s) > 25 {
|
||||
return RGBColor(""), ErrInvalidColor
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.HasSuffix(s, "\a"):
|
||||
s = strings.TrimSuffix(s, "\a")
|
||||
case strings.HasSuffix(s, "\033"):
|
||||
s = strings.TrimSuffix(s, "\033")
|
||||
case strings.HasSuffix(s, "\033\\"):
|
||||
s = strings.TrimSuffix(s, "\033\\")
|
||||
default:
|
||||
return RGBColor(""), ErrInvalidColor
|
||||
}
|
||||
|
||||
s = s[4:]
|
||||
|
||||
prefix := ";rgb:"
|
||||
if !strings.HasPrefix(s, prefix) {
|
||||
return RGBColor(""), ErrInvalidColor
|
||||
}
|
||||
s = strings.TrimPrefix(s, prefix)
|
||||
|
||||
h := strings.Split(s, "/")
|
||||
hex := fmt.Sprintf("#%s%s%s", h[0][:2], h[1][:2], h[2][:2])
|
||||
return RGBColor(hex), nil
|
||||
}
|
||||
|
||||
func ansi256ToANSIColor(c ANSI256Color) ANSIColor {
|
||||
var r int
|
||||
md := math.MaxFloat64
|
||||
|
||||
h, _ := colorful.Hex(ansiHex[c])
|
||||
for i := 0; i <= 15; i++ {
|
||||
hb, _ := colorful.Hex(ansiHex[i])
|
||||
d := h.DistanceHSLuv(hb)
|
||||
|
||||
if d < md {
|
||||
md = d
|
||||
r = i
|
||||
}
|
||||
}
|
||||
|
||||
return ANSIColor(r)
|
||||
}
|
||||
|
||||
func hexToANSI256Color(c colorful.Color) ANSI256Color {
|
||||
v2ci := func(v float64) int {
|
||||
if v < 48 {
|
||||
return 0
|
||||
}
|
||||
if v < 115 {
|
||||
return 1
|
||||
}
|
||||
return int((v - 35) / 40)
|
||||
}
|
||||
|
||||
// Calculate the nearest 0-based color index at 16..231
|
||||
r := v2ci(c.R * 255.0) // 0..5 each
|
||||
g := v2ci(c.G * 255.0)
|
||||
b := v2ci(c.B * 255.0)
|
||||
ci := 36*r + 6*g + b /* 0..215 */
|
||||
|
||||
// Calculate the represented colors back from the index
|
||||
i2cv := [6]int{0, 0x5f, 0x87, 0xaf, 0xd7, 0xff}
|
||||
cr := i2cv[r] // r/g/b, 0..255 each
|
||||
cg := i2cv[g]
|
||||
cb := i2cv[b]
|
||||
|
||||
// Calculate the nearest 0-based gray index at 232..255
|
||||
var grayIdx int
|
||||
average := (r + g + b) / 3
|
||||
if average > 238 {
|
||||
grayIdx = 23
|
||||
} else {
|
||||
grayIdx = (average - 3) / 10 // 0..23
|
||||
}
|
||||
gv := 8 + 10*grayIdx // same value for r/g/b, 0..255
|
||||
|
||||
// Return the one which is nearer to the original input rgb value
|
||||
c2 := colorful.Color{R: float64(cr) / 255.0, G: float64(cg) / 255.0, B: float64(cb) / 255.0}
|
||||
g2 := colorful.Color{R: float64(gv) / 255.0, G: float64(gv) / 255.0, B: float64(gv) / 255.0}
|
||||
colorDist := c.DistanceHSLuv(c2)
|
||||
grayDist := c.DistanceHSLuv(g2)
|
||||
|
||||
if colorDist <= grayDist {
|
||||
return ANSI256Color(16 + ci)
|
||||
}
|
||||
return ANSI256Color(232 + grayIdx)
|
||||
}
|
8
vendor/github.com/muesli/termenv/constants_linux.go
generated
vendored
Normal file
8
vendor/github.com/muesli/termenv/constants_linux.go
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
package termenv
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
const (
|
||||
tcgetattr = unix.TCGETS
|
||||
tcsetattr = unix.TCSETS
|
||||
)
|
8
vendor/github.com/muesli/termenv/constants_solaris.go
generated
vendored
Normal file
8
vendor/github.com/muesli/termenv/constants_solaris.go
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
package termenv
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
const (
|
||||
tcgetattr = unix.TCGETS
|
||||
tcsetattr = unix.TCSETS
|
||||
)
|
13
vendor/github.com/muesli/termenv/constants_unix.go
generated
vendored
Normal file
13
vendor/github.com/muesli/termenv/constants_unix.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && !solaris && !illumos
|
||||
// +build darwin dragonfly freebsd netbsd openbsd
|
||||
// +build !solaris
|
||||
// +build !illumos
|
||||
|
||||
package termenv
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
const (
|
||||
tcgetattr = unix.TIOCGETA
|
||||
tcsetattr = unix.TIOCSETA
|
||||
)
|
258
vendor/github.com/muesli/termenv/screen.go
generated
vendored
Normal file
258
vendor/github.com/muesli/termenv/screen.go
generated
vendored
Normal file
@ -0,0 +1,258 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Sequence definitions.
|
||||
const (
|
||||
// Cursor positioning.
|
||||
CursorUpSeq = "%dA"
|
||||
CursorDownSeq = "%dB"
|
||||
CursorForwardSeq = "%dC"
|
||||
CursorBackSeq = "%dD"
|
||||
CursorNextLineSeq = "%dE"
|
||||
CursorPreviousLineSeq = "%dF"
|
||||
CursorHorizontalSeq = "%dG"
|
||||
CursorPositionSeq = "%d;%dH"
|
||||
EraseDisplaySeq = "%dJ"
|
||||
EraseLineSeq = "%dK"
|
||||
ScrollUpSeq = "%dS"
|
||||
ScrollDownSeq = "%dT"
|
||||
SaveCursorPositionSeq = "s"
|
||||
RestoreCursorPositionSeq = "u"
|
||||
ChangeScrollingRegionSeq = "%d;%dr"
|
||||
InsertLineSeq = "%dL"
|
||||
DeleteLineSeq = "%dM"
|
||||
|
||||
// Explicit values for EraseLineSeq.
|
||||
EraseLineRightSeq = "0K"
|
||||
EraseLineLeftSeq = "1K"
|
||||
EraseEntireLineSeq = "2K"
|
||||
|
||||
// Mouse.
|
||||
EnableMousePressSeq = "?9h" // press only (X10)
|
||||
DisableMousePressSeq = "?9l"
|
||||
EnableMouseSeq = "?1000h" // press, release, wheel
|
||||
DisableMouseSeq = "?1000l"
|
||||
EnableMouseHiliteSeq = "?1001h" // highlight
|
||||
DisableMouseHiliteSeq = "?1001l"
|
||||
EnableMouseCellMotionSeq = "?1002h" // press, release, move on pressed, wheel
|
||||
DisableMouseCellMotionSeq = "?1002l"
|
||||
EnableMouseAllMotionSeq = "?1003h" // press, release, move, wheel
|
||||
DisableMouseAllMotionSeq = "?1003l"
|
||||
|
||||
// Screen.
|
||||
RestoreScreenSeq = "?47l"
|
||||
SaveScreenSeq = "?47h"
|
||||
AltScreenSeq = "?1049h"
|
||||
ExitAltScreenSeq = "?1049l"
|
||||
|
||||
// Session.
|
||||
SetWindowTitleSeq = "2;%s\007"
|
||||
SetForegroundColorSeq = "10;%s\007"
|
||||
SetBackgroundColorSeq = "11;%s\007"
|
||||
SetCursorColorSeq = "12;%s\007"
|
||||
ShowCursorSeq = "?25h"
|
||||
HideCursorSeq = "?25l"
|
||||
)
|
||||
|
||||
// Reset the terminal to its default style, removing any active styles.
|
||||
func Reset() {
|
||||
fmt.Print(CSI + ResetSeq + "m")
|
||||
}
|
||||
|
||||
// SetForegroundColor sets the default foreground color.
|
||||
func SetForegroundColor(color Color) {
|
||||
fmt.Printf(OSC+SetForegroundColorSeq, color)
|
||||
}
|
||||
|
||||
// SetBackgroundColor sets the default background color.
|
||||
func SetBackgroundColor(color Color) {
|
||||
fmt.Printf(OSC+SetBackgroundColorSeq, color)
|
||||
}
|
||||
|
||||
// SetCursorColor sets the cursor color.
|
||||
func SetCursorColor(color Color) {
|
||||
fmt.Printf(OSC+SetCursorColorSeq, color)
|
||||
}
|
||||
|
||||
// RestoreScreen restores a previously saved screen state.
|
||||
func RestoreScreen() {
|
||||
fmt.Print(CSI + RestoreScreenSeq)
|
||||
}
|
||||
|
||||
// SaveScreen saves the screen state.
|
||||
func SaveScreen() {
|
||||
fmt.Print(CSI + SaveScreenSeq)
|
||||
}
|
||||
|
||||
// AltScreen switches to the alternate screen buffer. The former view can be
|
||||
// restored with ExitAltScreen().
|
||||
func AltScreen() {
|
||||
fmt.Print(CSI + AltScreenSeq)
|
||||
}
|
||||
|
||||
// ExitAltScreen exits the alternate screen buffer and returns to the former
|
||||
// terminal view.
|
||||
func ExitAltScreen() {
|
||||
fmt.Print(CSI + ExitAltScreenSeq)
|
||||
}
|
||||
|
||||
// ClearScreen clears the visible portion of the terminal.
|
||||
func ClearScreen() {
|
||||
fmt.Printf(CSI+EraseDisplaySeq, 2)
|
||||
MoveCursor(1, 1)
|
||||
}
|
||||
|
||||
// MoveCursor moves the cursor to a given position.
|
||||
func MoveCursor(row int, column int) {
|
||||
fmt.Printf(CSI+CursorPositionSeq, row, column)
|
||||
}
|
||||
|
||||
// HideCursor hides the cursor.
|
||||
func HideCursor() {
|
||||
fmt.Printf(CSI + HideCursorSeq)
|
||||
}
|
||||
|
||||
// ShowCursor shows the cursor.
|
||||
func ShowCursor() {
|
||||
fmt.Printf(CSI + ShowCursorSeq)
|
||||
}
|
||||
|
||||
// SaveCursorPosition saves the cursor position.
|
||||
func SaveCursorPosition() {
|
||||
fmt.Print(CSI + SaveCursorPositionSeq)
|
||||
}
|
||||
|
||||
// RestoreCursorPosition restores a saved cursor position.
|
||||
func RestoreCursorPosition() {
|
||||
fmt.Print(CSI + RestoreCursorPositionSeq)
|
||||
}
|
||||
|
||||
// CursorUp moves the cursor up a given number of lines.
|
||||
func CursorUp(n int) {
|
||||
fmt.Printf(CSI+CursorUpSeq, n)
|
||||
}
|
||||
|
||||
// CursorDown moves the cursor down a given number of lines.
|
||||
func CursorDown(n int) {
|
||||
fmt.Printf(CSI+CursorDownSeq, n)
|
||||
}
|
||||
|
||||
// CursorForward moves the cursor up a given number of lines.
|
||||
func CursorForward(n int) {
|
||||
fmt.Printf(CSI+CursorForwardSeq, n)
|
||||
}
|
||||
|
||||
// CursorBack moves the cursor backwards a given number of cells.
|
||||
func CursorBack(n int) {
|
||||
fmt.Printf(CSI+CursorBackSeq, n)
|
||||
}
|
||||
|
||||
// CursorNextLine moves the cursor down a given number of lines and places it at
|
||||
// the beginning of the line.
|
||||
func CursorNextLine(n int) {
|
||||
fmt.Printf(CSI+CursorNextLineSeq, n)
|
||||
}
|
||||
|
||||
// CursorPrevLine moves the cursor up a given number of lines and places it at
|
||||
// the beginning of the line.
|
||||
func CursorPrevLine(n int) {
|
||||
fmt.Printf(CSI+CursorPreviousLineSeq, n)
|
||||
}
|
||||
|
||||
// ClearLine clears the current line.
|
||||
func ClearLine() {
|
||||
fmt.Print(CSI + EraseEntireLineSeq)
|
||||
}
|
||||
|
||||
// ClearLineLeft clears the line to the left of the cursor.
|
||||
func ClearLineLeft() {
|
||||
fmt.Print(CSI + EraseLineLeftSeq)
|
||||
}
|
||||
|
||||
// ClearLineRight clears the line to the right of the cursor.
|
||||
func ClearLineRight() {
|
||||
fmt.Print(CSI + EraseLineRightSeq)
|
||||
}
|
||||
|
||||
// ClearLines clears a given number of lines.
|
||||
func ClearLines(n int) {
|
||||
clearLine := fmt.Sprintf(CSI+EraseLineSeq, 2)
|
||||
cursorUp := fmt.Sprintf(CSI+CursorUpSeq, 1)
|
||||
fmt.Print(clearLine + strings.Repeat(cursorUp+clearLine, n))
|
||||
}
|
||||
|
||||
// ChangeScrollingRegion sets the scrolling region of the terminal.
|
||||
func ChangeScrollingRegion(top, bottom int) {
|
||||
fmt.Printf(CSI+ChangeScrollingRegionSeq, top, bottom)
|
||||
}
|
||||
|
||||
// InsertLines inserts the given number of lines at the top of the scrollable
|
||||
// region, pushing lines below down.
|
||||
func InsertLines(n int) {
|
||||
fmt.Printf(CSI+InsertLineSeq, n)
|
||||
}
|
||||
|
||||
// DeleteLines deletes the given number of lines, pulling any lines in
|
||||
// the scrollable region below up.
|
||||
func DeleteLines(n int) {
|
||||
fmt.Printf(CSI+DeleteLineSeq, n)
|
||||
}
|
||||
|
||||
// EnableMousePress enables X10 mouse mode. Button press events are sent only.
|
||||
func EnableMousePress() {
|
||||
fmt.Print(CSI + EnableMousePressSeq)
|
||||
}
|
||||
|
||||
// DisableMousePress disables X10 mouse mode.
|
||||
func DisableMousePress() {
|
||||
fmt.Print(CSI + DisableMousePressSeq)
|
||||
}
|
||||
|
||||
// EnableMouse enables Mouse Tracking mode.
|
||||
func EnableMouse() {
|
||||
fmt.Print(CSI + EnableMouseSeq)
|
||||
}
|
||||
|
||||
// DisableMouse disables Mouse Tracking mode.
|
||||
func DisableMouse() {
|
||||
fmt.Print(CSI + DisableMouseSeq)
|
||||
}
|
||||
|
||||
// EnableMouseHilite enables Hilite Mouse Tracking mode.
|
||||
func EnableMouseHilite() {
|
||||
fmt.Print(CSI + EnableMouseHiliteSeq)
|
||||
}
|
||||
|
||||
// DisableMouseHilite disables Hilite Mouse Tracking mode.
|
||||
func DisableMouseHilite() {
|
||||
fmt.Print(CSI + DisableMouseHiliteSeq)
|
||||
}
|
||||
|
||||
// EnableMouseCellMotion enables Cell Motion Mouse Tracking mode.
|
||||
func EnableMouseCellMotion() {
|
||||
fmt.Print(CSI + EnableMouseCellMotionSeq)
|
||||
}
|
||||
|
||||
// DisableMouseCellMotion disables Cell Motion Mouse Tracking mode.
|
||||
func DisableMouseCellMotion() {
|
||||
fmt.Print(CSI + DisableMouseCellMotionSeq)
|
||||
}
|
||||
|
||||
// EnableMouseAllMotion enables All Motion Mouse mode.
|
||||
func EnableMouseAllMotion() {
|
||||
fmt.Print(CSI + EnableMouseAllMotionSeq)
|
||||
}
|
||||
|
||||
// DisableMouseAllMotion disables All Motion Mouse mode.
|
||||
func DisableMouseAllMotion() {
|
||||
fmt.Print(CSI + DisableMouseAllMotionSeq)
|
||||
}
|
||||
|
||||
// SetWindowTitle sets the terminal window title.
|
||||
func SetWindowTitle(title string) {
|
||||
fmt.Printf(OSC+SetWindowTitleSeq, title)
|
||||
}
|
121
vendor/github.com/muesli/termenv/style.go
generated
vendored
Normal file
121
vendor/github.com/muesli/termenv/style.go
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
)
|
||||
|
||||
// Sequence definitions.
|
||||
const (
|
||||
ResetSeq = "0"
|
||||
BoldSeq = "1"
|
||||
FaintSeq = "2"
|
||||
ItalicSeq = "3"
|
||||
UnderlineSeq = "4"
|
||||
BlinkSeq = "5"
|
||||
ReverseSeq = "7"
|
||||
CrossOutSeq = "9"
|
||||
OverlineSeq = "53"
|
||||
)
|
||||
|
||||
// Style is a string that various rendering styles can be applied to.
|
||||
type Style struct {
|
||||
string
|
||||
styles []string
|
||||
}
|
||||
|
||||
// String returns a new Style.
|
||||
func String(s ...string) Style {
|
||||
return Style{
|
||||
string: strings.Join(s, " "),
|
||||
}
|
||||
}
|
||||
|
||||
func (t Style) String() string {
|
||||
return t.Styled(t.string)
|
||||
}
|
||||
|
||||
// Styled renders s with all applied styles.
|
||||
func (t Style) Styled(s string) string {
|
||||
if len(t.styles) == 0 {
|
||||
return s
|
||||
}
|
||||
|
||||
seq := strings.Join(t.styles, ";")
|
||||
if seq == "" {
|
||||
return s
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s%sm%s%sm", CSI, seq, s, CSI+ResetSeq)
|
||||
}
|
||||
|
||||
// Foreground sets a foreground color.
|
||||
func (t Style) Foreground(c Color) Style {
|
||||
if c != nil {
|
||||
t.styles = append(t.styles, c.Sequence(false))
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// Background sets a background color.
|
||||
func (t Style) Background(c Color) Style {
|
||||
if c != nil {
|
||||
t.styles = append(t.styles, c.Sequence(true))
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
// Bold enables bold rendering.
|
||||
func (t Style) Bold() Style {
|
||||
t.styles = append(t.styles, BoldSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Faint enables faint rendering.
|
||||
func (t Style) Faint() Style {
|
||||
t.styles = append(t.styles, FaintSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Italic enables italic rendering.
|
||||
func (t Style) Italic() Style {
|
||||
t.styles = append(t.styles, ItalicSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Underline enables underline rendering.
|
||||
func (t Style) Underline() Style {
|
||||
t.styles = append(t.styles, UnderlineSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Overline enables overline rendering.
|
||||
func (t Style) Overline() Style {
|
||||
t.styles = append(t.styles, OverlineSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Blink enables blink mode.
|
||||
func (t Style) Blink() Style {
|
||||
t.styles = append(t.styles, BlinkSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Reverse enables reverse color mode.
|
||||
func (t Style) Reverse() Style {
|
||||
t.styles = append(t.styles, ReverseSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// CrossOut enables crossed-out rendering.
|
||||
func (t Style) CrossOut() Style {
|
||||
t.styles = append(t.styles, CrossOutSeq)
|
||||
return t
|
||||
}
|
||||
|
||||
// Width returns the width required to print all runes in Style.
|
||||
func (t Style) Width() int {
|
||||
return runewidth.StringWidth(t.string)
|
||||
}
|
55
vendor/github.com/muesli/termenv/templatehelper.go
generated
vendored
Normal file
55
vendor/github.com/muesli/termenv/templatehelper.go
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
// TemplateFuncs contains a few useful template helpers.
|
||||
func TemplateFuncs(p Profile) template.FuncMap {
|
||||
return template.FuncMap{
|
||||
"Color": func(values ...interface{}) string {
|
||||
s := String(values[len(values)-1].(string))
|
||||
switch len(values) {
|
||||
case 2:
|
||||
s = s.Foreground(p.Color(values[0].(string)))
|
||||
case 3:
|
||||
s = s.
|
||||
Foreground(p.Color(values[0].(string))).
|
||||
Background(p.Color(values[1].(string)))
|
||||
}
|
||||
|
||||
return s.String()
|
||||
},
|
||||
"Foreground": func(values ...interface{}) string {
|
||||
s := String(values[len(values)-1].(string))
|
||||
if len(values) == 2 {
|
||||
s = s.Foreground(p.Color(values[0].(string)))
|
||||
}
|
||||
|
||||
return s.String()
|
||||
},
|
||||
"Background": func(values ...interface{}) string {
|
||||
s := String(values[len(values)-1].(string))
|
||||
if len(values) == 2 {
|
||||
s = s.Background(p.Color(values[0].(string)))
|
||||
}
|
||||
|
||||
return s.String()
|
||||
},
|
||||
"Bold": styleFunc(Style.Bold),
|
||||
"Faint": styleFunc(Style.Faint),
|
||||
"Italic": styleFunc(Style.Italic),
|
||||
"Underline": styleFunc(Style.Underline),
|
||||
"Overline": styleFunc(Style.Overline),
|
||||
"Blink": styleFunc(Style.Blink),
|
||||
"Reverse": styleFunc(Style.Reverse),
|
||||
"CrossOut": styleFunc(Style.CrossOut),
|
||||
}
|
||||
}
|
||||
|
||||
func styleFunc(f func(Style) Style) func(...interface{}) string {
|
||||
return func(values ...interface{}) string {
|
||||
s := String(values[0].(string))
|
||||
return f(s).String()
|
||||
}
|
||||
}
|
110
vendor/github.com/muesli/termenv/termenv.go
generated
vendored
Normal file
110
vendor/github.com/muesli/termenv/termenv.go
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrStatusReport gets returned when the terminal can't be queried.
|
||||
ErrStatusReport = errors.New("unable to retrieve status report")
|
||||
)
|
||||
|
||||
// Profile is a color profile: Ascii, ANSI, ANSI256, or TrueColor.
|
||||
type Profile int
|
||||
|
||||
const (
|
||||
// Control Sequence Introducer
|
||||
CSI = "\x1b["
|
||||
// Operating System Command
|
||||
OSC = "\x1b]"
|
||||
|
||||
// Ascii, uncolored profile.
|
||||
Ascii = Profile(iota) //nolint:revive
|
||||
// ANSI, 4-bit color profile
|
||||
ANSI
|
||||
// ANSI256, 8-bit color profile
|
||||
ANSI256
|
||||
// TrueColor, 24-bit color profile
|
||||
TrueColor
|
||||
)
|
||||
|
||||
func isTTY(fd uintptr) bool {
|
||||
if len(os.Getenv("CI")) > 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
return isatty.IsTerminal(fd)
|
||||
}
|
||||
|
||||
// ColorProfile returns the supported color profile:
|
||||
// Ascii, ANSI, ANSI256, or TrueColor.
|
||||
func ColorProfile() Profile {
|
||||
if !isTTY(os.Stdout.Fd()) {
|
||||
println("not tty")
|
||||
return Ascii
|
||||
}
|
||||
|
||||
return colorProfile()
|
||||
}
|
||||
|
||||
// ForegroundColor returns the terminal's default foreground color.
|
||||
func ForegroundColor() Color {
|
||||
if !isTTY(os.Stdout.Fd()) {
|
||||
return NoColor{}
|
||||
}
|
||||
|
||||
return foregroundColor()
|
||||
}
|
||||
|
||||
// BackgroundColor returns the terminal's default background color.
|
||||
func BackgroundColor() Color {
|
||||
if !isTTY(os.Stdout.Fd()) {
|
||||
return NoColor{}
|
||||
}
|
||||
|
||||
return backgroundColor()
|
||||
}
|
||||
|
||||
// HasDarkBackground returns whether terminal uses a dark-ish background.
|
||||
func HasDarkBackground() bool {
|
||||
c := ConvertToRGB(BackgroundColor())
|
||||
_, _, l := c.Hsl()
|
||||
return l < 0.5
|
||||
}
|
||||
|
||||
// EnvNoColor returns true if the environment variables explicitly disable color output
|
||||
// by setting NO_COLOR (https://no-color.org/)
|
||||
// or CLICOLOR/CLICOLOR_FORCE (https://bixense.com/clicolors/)
|
||||
// If NO_COLOR is set, this will return true, ignoring CLICOLOR/CLICOLOR_FORCE
|
||||
// If CLICOLOR=="0", it will be true only if CLICOLOR_FORCE is also "0" or is unset.
|
||||
func EnvNoColor() bool {
|
||||
return os.Getenv("NO_COLOR") != "" || (os.Getenv("CLICOLOR") == "0" && !cliColorForced())
|
||||
}
|
||||
|
||||
// EnvColorProfile returns the color profile based on environment variables set
|
||||
// Supports NO_COLOR (https://no-color.org/)
|
||||
// and CLICOLOR/CLICOLOR_FORCE (https://bixense.com/clicolors/)
|
||||
// If none of these environment variables are set, this behaves the same as ColorProfile()
|
||||
// It will return the Ascii color profile if EnvNoColor() returns true
|
||||
// If the terminal does not support any colors, but CLICOLOR_FORCE is set and not "0"
|
||||
// then the ANSI color profile will be returned.
|
||||
func EnvColorProfile() Profile {
|
||||
if EnvNoColor() {
|
||||
return Ascii
|
||||
}
|
||||
p := ColorProfile()
|
||||
if cliColorForced() && p == Ascii {
|
||||
return ANSI
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func cliColorForced() bool {
|
||||
if forced := os.Getenv("CLICOLOR_FORCE"); forced != "" {
|
||||
return forced != "0"
|
||||
}
|
||||
return false
|
||||
}
|
18
vendor/github.com/muesli/termenv/termenv_other.go
generated
vendored
Normal file
18
vendor/github.com/muesli/termenv/termenv_other.go
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
//go:build js || plan9 || aix
|
||||
// +build js plan9 aix
|
||||
|
||||
package termenv
|
||||
|
||||
func colorProfile() Profile {
|
||||
return ANSI256
|
||||
}
|
||||
|
||||
func foregroundColor() Color {
|
||||
// default gray
|
||||
return ANSIColor(7)
|
||||
}
|
||||
|
||||
func backgroundColor() Color {
|
||||
// default black
|
||||
return ANSIColor(0)
|
||||
}
|
17
vendor/github.com/muesli/termenv/termenv_posix.go
generated
vendored
Normal file
17
vendor/github.com/muesli/termenv/termenv_posix.go
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd
|
||||
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func isForeground(fd int) bool {
|
||||
pgrp, err := unix.IoctlGetInt(fd, unix.TIOCGPGRP)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return pgrp == unix.Getpgrp()
|
||||
}
|
22
vendor/github.com/muesli/termenv/termenv_solaris.go
generated
vendored
Normal file
22
vendor/github.com/muesli/termenv/termenv_solaris.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
//go:build solaris || illumos
|
||||
// +build solaris illumos
|
||||
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func isForeground(fd int) bool {
|
||||
pgrp, err := unix.IoctlGetInt(fd, unix.TIOCGPGRP)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
g, err := unix.Getpgrp()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return pgrp == g
|
||||
}
|
264
vendor/github.com/muesli/termenv/termenv_unix.go
generated
vendored
Normal file
264
vendor/github.com/muesli/termenv/termenv_unix.go
generated
vendored
Normal file
@ -0,0 +1,264 @@
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
const (
|
||||
// timeout for OSC queries
|
||||
OSCTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
func colorProfile() Profile {
|
||||
term := os.Getenv("TERM")
|
||||
colorTerm := os.Getenv("COLORTERM")
|
||||
|
||||
switch strings.ToLower(colorTerm) {
|
||||
case "24bit":
|
||||
fallthrough
|
||||
case "truecolor":
|
||||
if strings.HasPrefix(term, "screen") {
|
||||
// tmux supports TrueColor, screen only ANSI256
|
||||
if os.Getenv("TERM_PROGRAM") != "tmux" {
|
||||
return ANSI256
|
||||
}
|
||||
}
|
||||
return TrueColor
|
||||
case "yes":
|
||||
fallthrough
|
||||
case "true":
|
||||
return ANSI256
|
||||
}
|
||||
|
||||
switch term {
|
||||
case "xterm-kitty":
|
||||
return TrueColor
|
||||
case "linux":
|
||||
return ANSI
|
||||
}
|
||||
|
||||
if strings.Contains(term, "256color") {
|
||||
return ANSI256
|
||||
}
|
||||
if strings.Contains(term, "color") {
|
||||
return ANSI
|
||||
}
|
||||
if strings.Contains(term, "ansi") {
|
||||
return ANSI
|
||||
}
|
||||
|
||||
return Ascii
|
||||
}
|
||||
|
||||
func foregroundColor() Color {
|
||||
s, err := termStatusReport(10)
|
||||
if err == nil {
|
||||
c, err := xTermColor(s)
|
||||
if err == nil {
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
colorFGBG := os.Getenv("COLORFGBG")
|
||||
if strings.Contains(colorFGBG, ";") {
|
||||
c := strings.Split(colorFGBG, ";")
|
||||
i, err := strconv.Atoi(c[0])
|
||||
if err == nil {
|
||||
return ANSIColor(i)
|
||||
}
|
||||
}
|
||||
|
||||
// default gray
|
||||
return ANSIColor(7)
|
||||
}
|
||||
|
||||
func backgroundColor() Color {
|
||||
s, err := termStatusReport(11)
|
||||
if err == nil {
|
||||
c, err := xTermColor(s)
|
||||
if err == nil {
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
colorFGBG := os.Getenv("COLORFGBG")
|
||||
if strings.Contains(colorFGBG, ";") {
|
||||
c := strings.Split(colorFGBG, ";")
|
||||
i, err := strconv.Atoi(c[len(c)-1])
|
||||
if err == nil {
|
||||
return ANSIColor(i)
|
||||
}
|
||||
}
|
||||
|
||||
// default black
|
||||
return ANSIColor(0)
|
||||
}
|
||||
|
||||
func waitForData(fd uintptr, timeout time.Duration) error {
|
||||
tv := unix.NsecToTimeval(int64(timeout))
|
||||
var readfds unix.FdSet
|
||||
readfds.Set(int(fd))
|
||||
|
||||
for {
|
||||
n, err := unix.Select(int(fd)+1, &readfds, nil, nil, &tv)
|
||||
if err == unix.EINTR {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n == 0 {
|
||||
return fmt.Errorf("timeout")
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func readNextByte(f *os.File) (byte, error) {
|
||||
if err := waitForData(f.Fd(), OSCTimeout); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var b [1]byte
|
||||
n, err := f.Read(b[:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if n == 0 {
|
||||
panic("read returned no data")
|
||||
}
|
||||
|
||||
return b[0], nil
|
||||
}
|
||||
|
||||
// readNextResponse reads either an OSC response or a cursor position response:
|
||||
// * OSC response: "\x1b]11;rgb:1111/1111/1111\x1b\\"
|
||||
// * cursor position response: "\x1b[42;1R"
|
||||
func readNextResponse(fd *os.File) (response string, isOSC bool, err error) {
|
||||
start, err := readNextByte(fd)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
// first byte must be ESC
|
||||
for start != '\033' {
|
||||
start, err = readNextByte(fd)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
}
|
||||
|
||||
response += string(start)
|
||||
|
||||
// next byte is either '[' (cursor position response) or ']' (OSC response)
|
||||
tpe, err := readNextByte(fd)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
response += string(tpe)
|
||||
|
||||
var oscResponse bool
|
||||
switch tpe {
|
||||
case '[':
|
||||
oscResponse = false
|
||||
case ']':
|
||||
oscResponse = true
|
||||
default:
|
||||
return "", false, ErrStatusReport
|
||||
}
|
||||
|
||||
for {
|
||||
b, err := readNextByte(os.Stdout)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
response += string(b)
|
||||
|
||||
if oscResponse {
|
||||
// OSC can be terminated by BEL (\a) or ST (ESC)
|
||||
if b == '\a' || strings.HasSuffix(response, "\033") {
|
||||
return response, true, nil
|
||||
}
|
||||
} else {
|
||||
// cursor position response is terminated by 'R'
|
||||
if b == 'R' {
|
||||
return response, false, nil
|
||||
}
|
||||
}
|
||||
|
||||
// both responses have less than 25 bytes, so if we read more, that's an error
|
||||
if len(response) > 25 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return "", false, ErrStatusReport
|
||||
}
|
||||
|
||||
func termStatusReport(sequence int) (string, error) {
|
||||
// screen/tmux can't support OSC, because they can be connected to multiple
|
||||
// terminals concurrently.
|
||||
term := os.Getenv("TERM")
|
||||
if strings.HasPrefix(term, "screen") {
|
||||
return "", ErrStatusReport
|
||||
}
|
||||
|
||||
// if in background, we can't control the terminal
|
||||
if !isForeground(unix.Stdout) {
|
||||
return "", ErrStatusReport
|
||||
}
|
||||
|
||||
t, err := unix.IoctlGetTermios(unix.Stdout, tcgetattr)
|
||||
if err != nil {
|
||||
return "", ErrStatusReport
|
||||
}
|
||||
defer unix.IoctlSetTermios(unix.Stdout, tcsetattr, t) //nolint:errcheck
|
||||
|
||||
noecho := *t
|
||||
noecho.Lflag = noecho.Lflag &^ unix.ECHO
|
||||
noecho.Lflag = noecho.Lflag &^ unix.ICANON
|
||||
if err := unix.IoctlSetTermios(unix.Stdout, tcsetattr, &noecho); err != nil {
|
||||
return "", ErrStatusReport
|
||||
}
|
||||
|
||||
// first, send OSC query, which is ignored by terminal which do not support it
|
||||
fmt.Printf("\033]%d;?\033\\", sequence)
|
||||
|
||||
// then, query cursor position, should be supported by all terminals
|
||||
fmt.Printf("\033[6n")
|
||||
|
||||
// read the next response
|
||||
res, isOSC, err := readNextResponse(os.Stdout)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// if this is not OSC response, then the terminal does not support it
|
||||
if !isOSC {
|
||||
return "", ErrStatusReport
|
||||
}
|
||||
|
||||
// read the cursor query response next and discard the result
|
||||
_, _, err = readNextResponse(os.Stdout)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// fmt.Println("Rcvd", res[1:])
|
||||
return res, nil
|
||||
}
|
89
vendor/github.com/muesli/termenv/termenv_windows.go
generated
vendored
Normal file
89
vendor/github.com/muesli/termenv/termenv_windows.go
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package termenv
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func colorProfile() Profile {
|
||||
if os.Getenv("ConEmuANSI") == "ON" {
|
||||
return TrueColor
|
||||
}
|
||||
|
||||
winVersion, _, buildNumber := windows.RtlGetNtVersionNumbers()
|
||||
if buildNumber < 10586 || winVersion < 10 {
|
||||
// No ANSI support before Windows 10 build 10586.
|
||||
if os.Getenv("ANSICON") != "" {
|
||||
conVersion := os.Getenv("ANSICON_VER")
|
||||
cv, err := strconv.ParseInt(conVersion, 10, 64)
|
||||
if err != nil || cv < 181 {
|
||||
// No 8 bit color support before v1.81 release.
|
||||
return ANSI
|
||||
}
|
||||
|
||||
return ANSI256
|
||||
}
|
||||
|
||||
return Ascii
|
||||
}
|
||||
if buildNumber < 14931 {
|
||||
// No true color support before build 14931.
|
||||
return ANSI256
|
||||
}
|
||||
|
||||
return TrueColor
|
||||
}
|
||||
|
||||
func foregroundColor() Color {
|
||||
// default gray
|
||||
return ANSIColor(7)
|
||||
}
|
||||
|
||||
func backgroundColor() Color {
|
||||
// default black
|
||||
return ANSIColor(0)
|
||||
}
|
||||
|
||||
// EnableWindowsANSIConsole enables virtual terminal processing on Windows
|
||||
// platforms. This allows the use of ANSI escape sequences in Windows console
|
||||
// applications. Ensure this gets called before anything gets rendered with
|
||||
// termenv.
|
||||
//
|
||||
// Returns the original console mode and an error if one occurred.
|
||||
func EnableWindowsANSIConsole() (uint32, error) {
|
||||
handle, err := windows.GetStdHandle(windows.STD_OUTPUT_HANDLE)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var mode uint32
|
||||
err = windows.GetConsoleMode(handle, &mode)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// See https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
|
||||
if mode&windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING != windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING {
|
||||
vtpmode := mode | windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
if err := windows.SetConsoleMode(handle, vtpmode); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
|
||||
return mode, nil
|
||||
}
|
||||
|
||||
// RestoreWindowsConsole restores the console mode to a previous state.
|
||||
func RestoreWindowsConsole(mode uint32) error {
|
||||
handle, err := windows.GetStdHandle(windows.STD_OUTPUT_HANDLE)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return windows.SetConsoleMode(handle, mode)
|
||||
}
|
13
vendor/golang.org/x/sys/windows/aliases.go
generated
vendored
Normal file
13
vendor/golang.org/x/sys/windows/aliases.go
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows && go1.9
|
||||
// +build windows,go1.9
|
||||
|
||||
package windows
|
||||
|
||||
import "syscall"
|
||||
|
||||
type Errno = syscall.Errno
|
||||
type SysProcAttr = syscall.SysProcAttr
|
416
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
Normal file
416
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
Normal file
@ -0,0 +1,416 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// We need to use LoadLibrary and GetProcAddress from the Go runtime, because
|
||||
// the these symbols are loaded by the system linker and are required to
|
||||
// dynamically load additional symbols. Note that in the Go runtime, these
|
||||
// return syscall.Handle and syscall.Errno, but these are the same, in fact,
|
||||
// as windows.Handle and windows.Errno, and we intend to keep these the same.
|
||||
|
||||
//go:linkname syscall_loadlibrary syscall.loadlibrary
|
||||
func syscall_loadlibrary(filename *uint16) (handle Handle, err Errno)
|
||||
|
||||
//go:linkname syscall_getprocaddress syscall.getprocaddress
|
||||
func syscall_getprocaddress(handle Handle, procname *uint8) (proc uintptr, err Errno)
|
||||
|
||||
// DLLError describes reasons for DLL load failures.
|
||||
type DLLError struct {
|
||||
Err error
|
||||
ObjName string
|
||||
Msg string
|
||||
}
|
||||
|
||||
func (e *DLLError) Error() string { return e.Msg }
|
||||
|
||||
func (e *DLLError) Unwrap() error { return e.Err }
|
||||
|
||||
// A DLL implements access to a single DLL.
|
||||
type DLL struct {
|
||||
Name string
|
||||
Handle Handle
|
||||
}
|
||||
|
||||
// LoadDLL loads DLL file into memory.
|
||||
//
|
||||
// Warning: using LoadDLL without an absolute path name is subject to
|
||||
// DLL preloading attacks. To safely load a system DLL, use LazyDLL
|
||||
// with System set to true, or use LoadLibraryEx directly.
|
||||
func LoadDLL(name string) (dll *DLL, err error) {
|
||||
namep, err := UTF16PtrFromString(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
h, e := syscall_loadlibrary(namep)
|
||||
if e != 0 {
|
||||
return nil, &DLLError{
|
||||
Err: e,
|
||||
ObjName: name,
|
||||
Msg: "Failed to load " + name + ": " + e.Error(),
|
||||
}
|
||||
}
|
||||
d := &DLL{
|
||||
Name: name,
|
||||
Handle: h,
|
||||
}
|
||||
return d, nil
|
||||
}
|
||||
|
||||
// MustLoadDLL is like LoadDLL but panics if load operation failes.
|
||||
func MustLoadDLL(name string) *DLL {
|
||||
d, e := LoadDLL(name)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// FindProc searches DLL d for procedure named name and returns *Proc
|
||||
// if found. It returns an error if search fails.
|
||||
func (d *DLL) FindProc(name string) (proc *Proc, err error) {
|
||||
namep, err := BytePtrFromString(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
a, e := syscall_getprocaddress(d.Handle, namep)
|
||||
if e != 0 {
|
||||
return nil, &DLLError{
|
||||
Err: e,
|
||||
ObjName: name,
|
||||
Msg: "Failed to find " + name + " procedure in " + d.Name + ": " + e.Error(),
|
||||
}
|
||||
}
|
||||
p := &Proc{
|
||||
Dll: d,
|
||||
Name: name,
|
||||
addr: a,
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// MustFindProc is like FindProc but panics if search fails.
|
||||
func (d *DLL) MustFindProc(name string) *Proc {
|
||||
p, e := d.FindProc(name)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// FindProcByOrdinal searches DLL d for procedure by ordinal and returns *Proc
|
||||
// if found. It returns an error if search fails.
|
||||
func (d *DLL) FindProcByOrdinal(ordinal uintptr) (proc *Proc, err error) {
|
||||
a, e := GetProcAddressByOrdinal(d.Handle, ordinal)
|
||||
name := "#" + itoa(int(ordinal))
|
||||
if e != nil {
|
||||
return nil, &DLLError{
|
||||
Err: e,
|
||||
ObjName: name,
|
||||
Msg: "Failed to find " + name + " procedure in " + d.Name + ": " + e.Error(),
|
||||
}
|
||||
}
|
||||
p := &Proc{
|
||||
Dll: d,
|
||||
Name: name,
|
||||
addr: a,
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// MustFindProcByOrdinal is like FindProcByOrdinal but panics if search fails.
|
||||
func (d *DLL) MustFindProcByOrdinal(ordinal uintptr) *Proc {
|
||||
p, e := d.FindProcByOrdinal(ordinal)
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
// Release unloads DLL d from memory.
|
||||
func (d *DLL) Release() (err error) {
|
||||
return FreeLibrary(d.Handle)
|
||||
}
|
||||
|
||||
// A Proc implements access to a procedure inside a DLL.
|
||||
type Proc struct {
|
||||
Dll *DLL
|
||||
Name string
|
||||
addr uintptr
|
||||
}
|
||||
|
||||
// Addr returns the address of the procedure represented by p.
|
||||
// The return value can be passed to Syscall to run the procedure.
|
||||
func (p *Proc) Addr() uintptr {
|
||||
return p.addr
|
||||
}
|
||||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more than 15 arguments
|
||||
// are supplied.
|
||||
//
|
||||
// The returned error is always non-nil, constructed from the result of GetLastError.
|
||||
// Callers must inspect the primary return value to decide whether an error occurred
|
||||
// (according to the semantics of the specific function being called) before consulting
|
||||
// the error. The error will be guaranteed to contain windows.Errno.
|
||||
func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
switch len(a) {
|
||||
case 0:
|
||||
return syscall.Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0)
|
||||
case 1:
|
||||
return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], 0, 0)
|
||||
case 2:
|
||||
return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], 0)
|
||||
case 3:
|
||||
return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], a[2])
|
||||
case 4:
|
||||
return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0)
|
||||
case 5:
|
||||
return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0)
|
||||
case 6:
|
||||
return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5])
|
||||
case 7:
|
||||
return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], 0, 0)
|
||||
case 8:
|
||||
return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], 0)
|
||||
case 9:
|
||||
return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8])
|
||||
case 10:
|
||||
return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], 0, 0)
|
||||
case 11:
|
||||
return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], 0)
|
||||
case 12:
|
||||
return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11])
|
||||
case 13:
|
||||
return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], 0, 0)
|
||||
case 14:
|
||||
return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], 0)
|
||||
case 15:
|
||||
return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14])
|
||||
default:
|
||||
panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".")
|
||||
}
|
||||
}
|
||||
|
||||
// A LazyDLL implements access to a single DLL.
|
||||
// It will delay the load of the DLL until the first
|
||||
// call to its Handle method or to one of its
|
||||
// LazyProc's Addr method.
|
||||
type LazyDLL struct {
|
||||
Name string
|
||||
|
||||
// System determines whether the DLL must be loaded from the
|
||||
// Windows System directory, bypassing the normal DLL search
|
||||
// path.
|
||||
System bool
|
||||
|
||||
mu sync.Mutex
|
||||
dll *DLL // non nil once DLL is loaded
|
||||
}
|
||||
|
||||
// Load loads DLL file d.Name into memory. It returns an error if fails.
|
||||
// Load will not try to load DLL, if it is already loaded into memory.
|
||||
func (d *LazyDLL) Load() error {
|
||||
// Non-racy version of:
|
||||
// if d.dll != nil {
|
||||
if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll))) != nil {
|
||||
return nil
|
||||
}
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if d.dll != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// kernel32.dll is special, since it's where LoadLibraryEx comes from.
|
||||
// The kernel already special-cases its name, so it's always
|
||||
// loaded from system32.
|
||||
var dll *DLL
|
||||
var err error
|
||||
if d.Name == "kernel32.dll" {
|
||||
dll, err = LoadDLL(d.Name)
|
||||
} else {
|
||||
dll, err = loadLibraryEx(d.Name, d.System)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Non-racy version of:
|
||||
// d.dll = dll
|
||||
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll)), unsafe.Pointer(dll))
|
||||
return nil
|
||||
}
|
||||
|
||||
// mustLoad is like Load but panics if search fails.
|
||||
func (d *LazyDLL) mustLoad() {
|
||||
e := d.Load()
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle returns d's module handle.
|
||||
func (d *LazyDLL) Handle() uintptr {
|
||||
d.mustLoad()
|
||||
return uintptr(d.dll.Handle)
|
||||
}
|
||||
|
||||
// NewProc returns a LazyProc for accessing the named procedure in the DLL d.
|
||||
func (d *LazyDLL) NewProc(name string) *LazyProc {
|
||||
return &LazyProc{l: d, Name: name}
|
||||
}
|
||||
|
||||
// NewLazyDLL creates new LazyDLL associated with DLL file.
|
||||
func NewLazyDLL(name string) *LazyDLL {
|
||||
return &LazyDLL{Name: name}
|
||||
}
|
||||
|
||||
// NewLazySystemDLL is like NewLazyDLL, but will only
|
||||
// search Windows System directory for the DLL if name is
|
||||
// a base name (like "advapi32.dll").
|
||||
func NewLazySystemDLL(name string) *LazyDLL {
|
||||
return &LazyDLL{Name: name, System: true}
|
||||
}
|
||||
|
||||
// A LazyProc implements access to a procedure inside a LazyDLL.
|
||||
// It delays the lookup until the Addr method is called.
|
||||
type LazyProc struct {
|
||||
Name string
|
||||
|
||||
mu sync.Mutex
|
||||
l *LazyDLL
|
||||
proc *Proc
|
||||
}
|
||||
|
||||
// Find searches DLL for procedure named p.Name. It returns
|
||||
// an error if search fails. Find will not search procedure,
|
||||
// if it is already found and loaded into memory.
|
||||
func (p *LazyProc) Find() error {
|
||||
// Non-racy version of:
|
||||
// if p.proc == nil {
|
||||
if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc))) == nil {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.proc == nil {
|
||||
e := p.l.Load()
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
proc, e := p.l.dll.FindProc(p.Name)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
// Non-racy version of:
|
||||
// p.proc = proc
|
||||
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc)), unsafe.Pointer(proc))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// mustFind is like Find but panics if search fails.
|
||||
func (p *LazyProc) mustFind() {
|
||||
e := p.Find()
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
|
||||
// Addr returns the address of the procedure represented by p.
|
||||
// The return value can be passed to Syscall to run the procedure.
|
||||
// It will panic if the procedure cannot be found.
|
||||
func (p *LazyProc) Addr() uintptr {
|
||||
p.mustFind()
|
||||
return p.proc.Addr()
|
||||
}
|
||||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more than 15 arguments
|
||||
// are supplied. It will also panic if the procedure cannot be found.
|
||||
//
|
||||
// The returned error is always non-nil, constructed from the result of GetLastError.
|
||||
// Callers must inspect the primary return value to decide whether an error occurred
|
||||
// (according to the semantics of the specific function being called) before consulting
|
||||
// the error. The error will be guaranteed to contain windows.Errno.
|
||||
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
p.mustFind()
|
||||
return p.proc.Call(a...)
|
||||
}
|
||||
|
||||
var canDoSearchSystem32Once struct {
|
||||
sync.Once
|
||||
v bool
|
||||
}
|
||||
|
||||
func initCanDoSearchSystem32() {
|
||||
// https://msdn.microsoft.com/en-us/library/ms684179(v=vs.85).aspx says:
|
||||
// "Windows 7, Windows Server 2008 R2, Windows Vista, and Windows
|
||||
// Server 2008: The LOAD_LIBRARY_SEARCH_* flags are available on
|
||||
// systems that have KB2533623 installed. To determine whether the
|
||||
// flags are available, use GetProcAddress to get the address of the
|
||||
// AddDllDirectory, RemoveDllDirectory, or SetDefaultDllDirectories
|
||||
// function. If GetProcAddress succeeds, the LOAD_LIBRARY_SEARCH_*
|
||||
// flags can be used with LoadLibraryEx."
|
||||
canDoSearchSystem32Once.v = (modkernel32.NewProc("AddDllDirectory").Find() == nil)
|
||||
}
|
||||
|
||||
func canDoSearchSystem32() bool {
|
||||
canDoSearchSystem32Once.Do(initCanDoSearchSystem32)
|
||||
return canDoSearchSystem32Once.v
|
||||
}
|
||||
|
||||
func isBaseName(name string) bool {
|
||||
for _, c := range name {
|
||||
if c == ':' || c == '/' || c == '\\' {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// loadLibraryEx wraps the Windows LoadLibraryEx function.
|
||||
//
|
||||
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
|
||||
//
|
||||
// If name is not an absolute path, LoadLibraryEx searches for the DLL
|
||||
// in a variety of automatic locations unless constrained by flags.
|
||||
// See: https://msdn.microsoft.com/en-us/library/ff919712%28VS.85%29.aspx
|
||||
func loadLibraryEx(name string, system bool) (*DLL, error) {
|
||||
loadDLL := name
|
||||
var flags uintptr
|
||||
if system {
|
||||
if canDoSearchSystem32() {
|
||||
flags = LOAD_LIBRARY_SEARCH_SYSTEM32
|
||||
} else if isBaseName(name) {
|
||||
// WindowsXP or unpatched Windows machine
|
||||
// trying to load "foo.dll" out of the system
|
||||
// folder, but LoadLibraryEx doesn't support
|
||||
// that yet on their system, so emulate it.
|
||||
systemdir, err := GetSystemDirectory()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
loadDLL = systemdir + "\\" + name
|
||||
}
|
||||
}
|
||||
h, err := LoadLibraryEx(loadDLL, 0, flags)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &DLL{Name: name, Handle: h}, nil
|
||||
}
|
||||
|
||||
type errString string
|
||||
|
||||
func (s errString) Error() string { return string(s) }
|
9
vendor/golang.org/x/sys/windows/empty.s
generated
vendored
Normal file
9
vendor/golang.org/x/sys/windows/empty.s
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !go1.12
|
||||
// +build !go1.12
|
||||
|
||||
// This file is here to allow bodyless functions with go:linkname for Go 1.11
|
||||
// and earlier (see https://golang.org/issue/23311).
|
54
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
Normal file
54
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Windows environment variables.
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func Getenv(key string) (value string, found bool) {
|
||||
return syscall.Getenv(key)
|
||||
}
|
||||
|
||||
func Setenv(key, value string) error {
|
||||
return syscall.Setenv(key, value)
|
||||
}
|
||||
|
||||
func Clearenv() {
|
||||
syscall.Clearenv()
|
||||
}
|
||||
|
||||
func Environ() []string {
|
||||
return syscall.Environ()
|
||||
}
|
||||
|
||||
// Returns a default environment associated with the token, rather than the current
|
||||
// process. If inheritExisting is true, then this environment also inherits the
|
||||
// environment of the current process.
|
||||
func (token Token) Environ(inheritExisting bool) (env []string, err error) {
|
||||
var block *uint16
|
||||
err = CreateEnvironmentBlock(&block, token, inheritExisting)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer DestroyEnvironmentBlock(block)
|
||||
blockp := uintptr(unsafe.Pointer(block))
|
||||
for {
|
||||
entry := UTF16PtrToString((*uint16)(unsafe.Pointer(blockp)))
|
||||
if len(entry) == 0 {
|
||||
break
|
||||
}
|
||||
env = append(env, entry)
|
||||
blockp += 2 * (uintptr(len(entry)) + 1)
|
||||
}
|
||||
return env, nil
|
||||
}
|
||||
|
||||
func Unsetenv(key string) error {
|
||||
return syscall.Unsetenv(key)
|
||||
}
|
21
vendor/golang.org/x/sys/windows/eventlog.go
generated
vendored
Normal file
21
vendor/golang.org/x/sys/windows/eventlog.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package windows
|
||||
|
||||
const (
|
||||
EVENTLOG_SUCCESS = 0
|
||||
EVENTLOG_ERROR_TYPE = 1
|
||||
EVENTLOG_WARNING_TYPE = 2
|
||||
EVENTLOG_INFORMATION_TYPE = 4
|
||||
EVENTLOG_AUDIT_SUCCESS = 8
|
||||
EVENTLOG_AUDIT_FAILURE = 16
|
||||
)
|
||||
|
||||
//sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW
|
||||
//sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource
|
||||
//sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW
|
178
vendor/golang.org/x/sys/windows/exec_windows.go
generated
vendored
Normal file
178
vendor/golang.org/x/sys/windows/exec_windows.go
generated
vendored
Normal file
@ -0,0 +1,178 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Fork, exec, wait, etc.
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
errorspkg "errors"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// EscapeArg rewrites command line argument s as prescribed
|
||||
// in http://msdn.microsoft.com/en-us/library/ms880421.
|
||||
// This function returns "" (2 double quotes) if s is empty.
|
||||
// Alternatively, these transformations are done:
|
||||
// - every back slash (\) is doubled, but only if immediately
|
||||
// followed by double quote (");
|
||||
// - every double quote (") is escaped by back slash (\);
|
||||
// - finally, s is wrapped with double quotes (arg -> "arg"),
|
||||
// but only if there is space or tab inside s.
|
||||
func EscapeArg(s string) string {
|
||||
if len(s) == 0 {
|
||||
return "\"\""
|
||||
}
|
||||
n := len(s)
|
||||
hasSpace := false
|
||||
for i := 0; i < len(s); i++ {
|
||||
switch s[i] {
|
||||
case '"', '\\':
|
||||
n++
|
||||
case ' ', '\t':
|
||||
hasSpace = true
|
||||
}
|
||||
}
|
||||
if hasSpace {
|
||||
n += 2
|
||||
}
|
||||
if n == len(s) {
|
||||
return s
|
||||
}
|
||||
|
||||
qs := make([]byte, n)
|
||||
j := 0
|
||||
if hasSpace {
|
||||
qs[j] = '"'
|
||||
j++
|
||||
}
|
||||
slashes := 0
|
||||
for i := 0; i < len(s); i++ {
|
||||
switch s[i] {
|
||||
default:
|
||||
slashes = 0
|
||||
qs[j] = s[i]
|
||||
case '\\':
|
||||
slashes++
|
||||
qs[j] = s[i]
|
||||
case '"':
|
||||
for ; slashes > 0; slashes-- {
|
||||
qs[j] = '\\'
|
||||
j++
|
||||
}
|
||||
qs[j] = '\\'
|
||||
j++
|
||||
qs[j] = s[i]
|
||||
}
|
||||
j++
|
||||
}
|
||||
if hasSpace {
|
||||
for ; slashes > 0; slashes-- {
|
||||
qs[j] = '\\'
|
||||
j++
|
||||
}
|
||||
qs[j] = '"'
|
||||
j++
|
||||
}
|
||||
return string(qs[:j])
|
||||
}
|
||||
|
||||
// ComposeCommandLine escapes and joins the given arguments suitable for use as a Windows command line,
|
||||
// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument,
|
||||
// or any program that uses CommandLineToArgv.
|
||||
func ComposeCommandLine(args []string) string {
|
||||
var commandLine string
|
||||
for i := range args {
|
||||
if i > 0 {
|
||||
commandLine += " "
|
||||
}
|
||||
commandLine += EscapeArg(args[i])
|
||||
}
|
||||
return commandLine
|
||||
}
|
||||
|
||||
// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv,
|
||||
// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that
|
||||
// command lines are passed around.
|
||||
func DecomposeCommandLine(commandLine string) ([]string, error) {
|
||||
if len(commandLine) == 0 {
|
||||
return []string{}, nil
|
||||
}
|
||||
var argc int32
|
||||
argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer LocalFree(Handle(unsafe.Pointer(argv)))
|
||||
var args []string
|
||||
for _, v := range (*argv)[:argc] {
|
||||
args = append(args, UTF16ToString((*v)[:]))
|
||||
}
|
||||
return args, nil
|
||||
}
|
||||
|
||||
func CloseOnExec(fd Handle) {
|
||||
SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0)
|
||||
}
|
||||
|
||||
// FullPath retrieves the full path of the specified file.
|
||||
func FullPath(name string) (path string, err error) {
|
||||
p, err := UTF16PtrFromString(name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
n := uint32(100)
|
||||
for {
|
||||
buf := make([]uint16, n)
|
||||
n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if n <= uint32(len(buf)) {
|
||||
return UTF16ToString(buf[:n]), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes.
|
||||
func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) {
|
||||
var size uintptr
|
||||
err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size)
|
||||
if err != ERROR_INSUFFICIENT_BUFFER {
|
||||
if err == nil {
|
||||
return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList")
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
alloc, err := LocalAlloc(LMEM_FIXED, uint32(size))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// size is guaranteed to be ≥1 by InitializeProcThreadAttributeList.
|
||||
al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(alloc))}
|
||||
err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return al, err
|
||||
}
|
||||
|
||||
// Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute.
|
||||
func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error {
|
||||
al.pointers = append(al.pointers, value)
|
||||
return updateProcThreadAttribute(al.data, 0, attribute, value, size, nil, nil)
|
||||
}
|
||||
|
||||
// Delete frees ProcThreadAttributeList's resources.
|
||||
func (al *ProcThreadAttributeListContainer) Delete() {
|
||||
deleteProcThreadAttributeList(al.data)
|
||||
LocalFree(Handle(unsafe.Pointer(al.data)))
|
||||
al.data = nil
|
||||
al.pointers = nil
|
||||
}
|
||||
|
||||
// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx.
|
||||
func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList {
|
||||
return al.data
|
||||
}
|
48
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
Normal file
48
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2017 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
const (
|
||||
MEM_COMMIT = 0x00001000
|
||||
MEM_RESERVE = 0x00002000
|
||||
MEM_DECOMMIT = 0x00004000
|
||||
MEM_RELEASE = 0x00008000
|
||||
MEM_RESET = 0x00080000
|
||||
MEM_TOP_DOWN = 0x00100000
|
||||
MEM_WRITE_WATCH = 0x00200000
|
||||
MEM_PHYSICAL = 0x00400000
|
||||
MEM_RESET_UNDO = 0x01000000
|
||||
MEM_LARGE_PAGES = 0x20000000
|
||||
|
||||
PAGE_NOACCESS = 0x00000001
|
||||
PAGE_READONLY = 0x00000002
|
||||
PAGE_READWRITE = 0x00000004
|
||||
PAGE_WRITECOPY = 0x00000008
|
||||
PAGE_EXECUTE = 0x00000010
|
||||
PAGE_EXECUTE_READ = 0x00000020
|
||||
PAGE_EXECUTE_READWRITE = 0x00000040
|
||||
PAGE_EXECUTE_WRITECOPY = 0x00000080
|
||||
PAGE_GUARD = 0x00000100
|
||||
PAGE_NOCACHE = 0x00000200
|
||||
PAGE_WRITECOMBINE = 0x00000400
|
||||
PAGE_TARGETS_INVALID = 0x40000000
|
||||
PAGE_TARGETS_NO_UPDATE = 0x40000000
|
||||
|
||||
QUOTA_LIMITS_HARDWS_MIN_DISABLE = 0x00000002
|
||||
QUOTA_LIMITS_HARDWS_MIN_ENABLE = 0x00000001
|
||||
QUOTA_LIMITS_HARDWS_MAX_DISABLE = 0x00000008
|
||||
QUOTA_LIMITS_HARDWS_MAX_ENABLE = 0x00000004
|
||||
)
|
||||
|
||||
type MemoryBasicInformation struct {
|
||||
BaseAddress uintptr
|
||||
AllocationBase uintptr
|
||||
AllocationProtect uint32
|
||||
PartitionId uint16
|
||||
RegionSize uintptr
|
||||
State uint32
|
||||
Protect uint32
|
||||
Type uint32
|
||||
}
|
70
vendor/golang.org/x/sys/windows/mkerrors.bash
generated
vendored
Normal file
70
vendor/golang.org/x/sys/windows/mkerrors.bash
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
shopt -s nullglob
|
||||
|
||||
winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)"
|
||||
[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; }
|
||||
ntstatus="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/ntstatus.h | sort -Vr | head -n 1)"
|
||||
[[ -n $ntstatus ]] || { echo "Unable to find ntstatus.h" >&2; exit 1; }
|
||||
|
||||
declare -A errors
|
||||
|
||||
{
|
||||
echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT."
|
||||
echo
|
||||
echo "package windows"
|
||||
echo "import \"syscall\""
|
||||
echo "const ("
|
||||
|
||||
while read -r line; do
|
||||
unset vtype
|
||||
if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
vtype="${BASH_REMATCH[2]}"
|
||||
elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
vtype="${BASH_REMATCH[2]}"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
[[ -n $key && -n $value ]] || continue
|
||||
[[ -z ${errors["$key"]} ]] || continue
|
||||
errors["$key"]="$value"
|
||||
if [[ -v vtype ]]; then
|
||||
if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then
|
||||
vtype=""
|
||||
elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then
|
||||
vtype="Handle"
|
||||
else
|
||||
vtype="syscall.Errno"
|
||||
fi
|
||||
last_vtype="$vtype"
|
||||
else
|
||||
vtype=""
|
||||
if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then
|
||||
value="S_OK"
|
||||
elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then
|
||||
value="ERROR_SUCCESS"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$key $vtype = $value"
|
||||
done < "$winerror"
|
||||
|
||||
while read -r line; do
|
||||
[[ $line =~ ^#define\ (STATUS_[^\s]+)\ +\(\(NTSTATUS\)((0x)?[0-9a-fA-F]+)L?\) ]] || continue
|
||||
echo "${BASH_REMATCH[1]} NTStatus = ${BASH_REMATCH[2]}"
|
||||
done < "$ntstatus"
|
||||
|
||||
echo ")"
|
||||
} | gofmt > "zerrors_windows.go"
|
27
vendor/golang.org/x/sys/windows/mkknownfolderids.bash
generated
vendored
Normal file
27
vendor/golang.org/x/sys/windows/mkknownfolderids.bash
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
shopt -s nullglob
|
||||
|
||||
knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)"
|
||||
[[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; }
|
||||
|
||||
{
|
||||
echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT."
|
||||
echo
|
||||
echo "package windows"
|
||||
echo "type KNOWNFOLDERID GUID"
|
||||
echo "var ("
|
||||
while read -r line; do
|
||||
[[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue
|
||||
printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \
|
||||
"${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \
|
||||
$(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \
|
||||
$(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" ))
|
||||
done < "$knownfolders"
|
||||
echo ")"
|
||||
} | gofmt > "zknownfolderids_windows.go"
|
10
vendor/golang.org/x/sys/windows/mksyscall.go
generated
vendored
Normal file
10
vendor/golang.org/x/sys/windows/mksyscall.go
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build generate
|
||||
// +build generate
|
||||
|
||||
package windows
|
||||
|
||||
//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go setupapi_windows.go
|
31
vendor/golang.org/x/sys/windows/race.go
generated
vendored
Normal file
31
vendor/golang.org/x/sys/windows/race.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows && race
|
||||
// +build windows,race
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const raceenabled = true
|
||||
|
||||
func raceAcquire(addr unsafe.Pointer) {
|
||||
runtime.RaceAcquire(addr)
|
||||
}
|
||||
|
||||
func raceReleaseMerge(addr unsafe.Pointer) {
|
||||
runtime.RaceReleaseMerge(addr)
|
||||
}
|
||||
|
||||
func raceReadRange(addr unsafe.Pointer, len int) {
|
||||
runtime.RaceReadRange(addr, len)
|
||||
}
|
||||
|
||||
func raceWriteRange(addr unsafe.Pointer, len int) {
|
||||
runtime.RaceWriteRange(addr, len)
|
||||
}
|
26
vendor/golang.org/x/sys/windows/race0.go
generated
vendored
Normal file
26
vendor/golang.org/x/sys/windows/race0.go
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows && !race
|
||||
// +build windows,!race
|
||||
|
||||
package windows
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const raceenabled = false
|
||||
|
||||
func raceAcquire(addr unsafe.Pointer) {
|
||||
}
|
||||
|
||||
func raceReleaseMerge(addr unsafe.Pointer) {
|
||||
}
|
||||
|
||||
func raceReadRange(addr unsafe.Pointer, len int) {
|
||||
}
|
||||
|
||||
func raceWriteRange(addr unsafe.Pointer, len int) {
|
||||
}
|
1444
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
Normal file
1444
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
247
vendor/golang.org/x/sys/windows/service.go
generated
vendored
Normal file
247
vendor/golang.org/x/sys/windows/service.go
generated
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package windows
|
||||
|
||||
const (
|
||||
SC_MANAGER_CONNECT = 1
|
||||
SC_MANAGER_CREATE_SERVICE = 2
|
||||
SC_MANAGER_ENUMERATE_SERVICE = 4
|
||||
SC_MANAGER_LOCK = 8
|
||||
SC_MANAGER_QUERY_LOCK_STATUS = 16
|
||||
SC_MANAGER_MODIFY_BOOT_CONFIG = 32
|
||||
SC_MANAGER_ALL_ACCESS = 0xf003f
|
||||
)
|
||||
|
||||
const (
|
||||
SERVICE_KERNEL_DRIVER = 1
|
||||
SERVICE_FILE_SYSTEM_DRIVER = 2
|
||||
SERVICE_ADAPTER = 4
|
||||
SERVICE_RECOGNIZER_DRIVER = 8
|
||||
SERVICE_WIN32_OWN_PROCESS = 16
|
||||
SERVICE_WIN32_SHARE_PROCESS = 32
|
||||
SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS
|
||||
SERVICE_INTERACTIVE_PROCESS = 256
|
||||
SERVICE_DRIVER = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER
|
||||
SERVICE_TYPE_ALL = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS
|
||||
|
||||
SERVICE_BOOT_START = 0
|
||||
SERVICE_SYSTEM_START = 1
|
||||
SERVICE_AUTO_START = 2
|
||||
SERVICE_DEMAND_START = 3
|
||||
SERVICE_DISABLED = 4
|
||||
|
||||
SERVICE_ERROR_IGNORE = 0
|
||||
SERVICE_ERROR_NORMAL = 1
|
||||
SERVICE_ERROR_SEVERE = 2
|
||||
SERVICE_ERROR_CRITICAL = 3
|
||||
|
||||
SC_STATUS_PROCESS_INFO = 0
|
||||
|
||||
SC_ACTION_NONE = 0
|
||||
SC_ACTION_RESTART = 1
|
||||
SC_ACTION_REBOOT = 2
|
||||
SC_ACTION_RUN_COMMAND = 3
|
||||
|
||||
SERVICE_STOPPED = 1
|
||||
SERVICE_START_PENDING = 2
|
||||
SERVICE_STOP_PENDING = 3
|
||||
SERVICE_RUNNING = 4
|
||||
SERVICE_CONTINUE_PENDING = 5
|
||||
SERVICE_PAUSE_PENDING = 6
|
||||
SERVICE_PAUSED = 7
|
||||
SERVICE_NO_CHANGE = 0xffffffff
|
||||
|
||||
SERVICE_ACCEPT_STOP = 1
|
||||
SERVICE_ACCEPT_PAUSE_CONTINUE = 2
|
||||
SERVICE_ACCEPT_SHUTDOWN = 4
|
||||
SERVICE_ACCEPT_PARAMCHANGE = 8
|
||||
SERVICE_ACCEPT_NETBINDCHANGE = 16
|
||||
SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32
|
||||
SERVICE_ACCEPT_POWEREVENT = 64
|
||||
SERVICE_ACCEPT_SESSIONCHANGE = 128
|
||||
SERVICE_ACCEPT_PRESHUTDOWN = 256
|
||||
|
||||
SERVICE_CONTROL_STOP = 1
|
||||
SERVICE_CONTROL_PAUSE = 2
|
||||
SERVICE_CONTROL_CONTINUE = 3
|
||||
SERVICE_CONTROL_INTERROGATE = 4
|
||||
SERVICE_CONTROL_SHUTDOWN = 5
|
||||
SERVICE_CONTROL_PARAMCHANGE = 6
|
||||
SERVICE_CONTROL_NETBINDADD = 7
|
||||
SERVICE_CONTROL_NETBINDREMOVE = 8
|
||||
SERVICE_CONTROL_NETBINDENABLE = 9
|
||||
SERVICE_CONTROL_NETBINDDISABLE = 10
|
||||
SERVICE_CONTROL_DEVICEEVENT = 11
|
||||
SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12
|
||||
SERVICE_CONTROL_POWEREVENT = 13
|
||||
SERVICE_CONTROL_SESSIONCHANGE = 14
|
||||
SERVICE_CONTROL_PRESHUTDOWN = 15
|
||||
|
||||
SERVICE_ACTIVE = 1
|
||||
SERVICE_INACTIVE = 2
|
||||
SERVICE_STATE_ALL = 3
|
||||
|
||||
SERVICE_QUERY_CONFIG = 1
|
||||
SERVICE_CHANGE_CONFIG = 2
|
||||
SERVICE_QUERY_STATUS = 4
|
||||
SERVICE_ENUMERATE_DEPENDENTS = 8
|
||||
SERVICE_START = 16
|
||||
SERVICE_STOP = 32
|
||||
SERVICE_PAUSE_CONTINUE = 64
|
||||
SERVICE_INTERROGATE = 128
|
||||
SERVICE_USER_DEFINED_CONTROL = 256
|
||||
SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL
|
||||
|
||||
SERVICE_RUNS_IN_SYSTEM_PROCESS = 1
|
||||
|
||||
SERVICE_CONFIG_DESCRIPTION = 1
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS = 2
|
||||
SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4
|
||||
SERVICE_CONFIG_SERVICE_SID_INFO = 5
|
||||
SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6
|
||||
SERVICE_CONFIG_PRESHUTDOWN_INFO = 7
|
||||
SERVICE_CONFIG_TRIGGER_INFO = 8
|
||||
SERVICE_CONFIG_PREFERRED_NODE = 9
|
||||
SERVICE_CONFIG_LAUNCH_PROTECTED = 12
|
||||
|
||||
SERVICE_SID_TYPE_NONE = 0
|
||||
SERVICE_SID_TYPE_UNRESTRICTED = 1
|
||||
SERVICE_SID_TYPE_RESTRICTED = 2 | SERVICE_SID_TYPE_UNRESTRICTED
|
||||
|
||||
SC_ENUM_PROCESS_INFO = 0
|
||||
|
||||
SERVICE_NOTIFY_STATUS_CHANGE = 2
|
||||
SERVICE_NOTIFY_STOPPED = 0x00000001
|
||||
SERVICE_NOTIFY_START_PENDING = 0x00000002
|
||||
SERVICE_NOTIFY_STOP_PENDING = 0x00000004
|
||||
SERVICE_NOTIFY_RUNNING = 0x00000008
|
||||
SERVICE_NOTIFY_CONTINUE_PENDING = 0x00000010
|
||||
SERVICE_NOTIFY_PAUSE_PENDING = 0x00000020
|
||||
SERVICE_NOTIFY_PAUSED = 0x00000040
|
||||
SERVICE_NOTIFY_CREATED = 0x00000080
|
||||
SERVICE_NOTIFY_DELETED = 0x00000100
|
||||
SERVICE_NOTIFY_DELETE_PENDING = 0x00000200
|
||||
|
||||
SC_EVENT_DATABASE_CHANGE = 0
|
||||
SC_EVENT_PROPERTY_CHANGE = 1
|
||||
SC_EVENT_STATUS_CHANGE = 2
|
||||
|
||||
SERVICE_START_REASON_DEMAND = 0x00000001
|
||||
SERVICE_START_REASON_AUTO = 0x00000002
|
||||
SERVICE_START_REASON_TRIGGER = 0x00000004
|
||||
SERVICE_START_REASON_RESTART_ON_FAILURE = 0x00000008
|
||||
SERVICE_START_REASON_DELAYEDAUTO = 0x00000010
|
||||
|
||||
SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = 1
|
||||
)
|
||||
|
||||
type SERVICE_STATUS struct {
|
||||
ServiceType uint32
|
||||
CurrentState uint32
|
||||
ControlsAccepted uint32
|
||||
Win32ExitCode uint32
|
||||
ServiceSpecificExitCode uint32
|
||||
CheckPoint uint32
|
||||
WaitHint uint32
|
||||
}
|
||||
|
||||
type SERVICE_TABLE_ENTRY struct {
|
||||
ServiceName *uint16
|
||||
ServiceProc uintptr
|
||||
}
|
||||
|
||||
type QUERY_SERVICE_CONFIG struct {
|
||||
ServiceType uint32
|
||||
StartType uint32
|
||||
ErrorControl uint32
|
||||
BinaryPathName *uint16
|
||||
LoadOrderGroup *uint16
|
||||
TagId uint32
|
||||
Dependencies *uint16
|
||||
ServiceStartName *uint16
|
||||
DisplayName *uint16
|
||||
}
|
||||
|
||||
type SERVICE_DESCRIPTION struct {
|
||||
Description *uint16
|
||||
}
|
||||
|
||||
type SERVICE_DELAYED_AUTO_START_INFO struct {
|
||||
IsDelayedAutoStartUp uint32
|
||||
}
|
||||
|
||||
type SERVICE_STATUS_PROCESS struct {
|
||||
ServiceType uint32
|
||||
CurrentState uint32
|
||||
ControlsAccepted uint32
|
||||
Win32ExitCode uint32
|
||||
ServiceSpecificExitCode uint32
|
||||
CheckPoint uint32
|
||||
WaitHint uint32
|
||||
ProcessId uint32
|
||||
ServiceFlags uint32
|
||||
}
|
||||
|
||||
type ENUM_SERVICE_STATUS_PROCESS struct {
|
||||
ServiceName *uint16
|
||||
DisplayName *uint16
|
||||
ServiceStatusProcess SERVICE_STATUS_PROCESS
|
||||
}
|
||||
|
||||
type SERVICE_NOTIFY struct {
|
||||
Version uint32
|
||||
NotifyCallback uintptr
|
||||
Context uintptr
|
||||
NotificationStatus uint32
|
||||
ServiceStatus SERVICE_STATUS_PROCESS
|
||||
NotificationTriggered uint32
|
||||
ServiceNames *uint16
|
||||
}
|
||||
|
||||
type SERVICE_FAILURE_ACTIONS struct {
|
||||
ResetPeriod uint32
|
||||
RebootMsg *uint16
|
||||
Command *uint16
|
||||
ActionsCount uint32
|
||||
Actions *SC_ACTION
|
||||
}
|
||||
|
||||
type SC_ACTION struct {
|
||||
Type uint32
|
||||
Delay uint32
|
||||
}
|
||||
|
||||
type QUERY_SERVICE_LOCK_STATUS struct {
|
||||
IsLocked uint32
|
||||
LockOwner *uint16
|
||||
LockDuration uint32
|
||||
}
|
||||
|
||||
//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW
|
||||
//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle
|
||||
//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW
|
||||
//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW
|
||||
//sys DeleteService(service Handle) (err error) = advapi32.DeleteService
|
||||
//sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW
|
||||
//sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus
|
||||
//sys QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceLockStatusW
|
||||
//sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService
|
||||
//sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW
|
||||
//sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus
|
||||
//sys ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) = advapi32.ChangeServiceConfigW
|
||||
//sys QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfigW
|
||||
//sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W
|
||||
//sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W
|
||||
//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW
|
||||
//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx
|
||||
//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW
|
||||
//sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications?
|
||||
//sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications?
|
||||
//sys RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) = advapi32.RegisterServiceCtrlHandlerExW
|
||||
//sys QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) = advapi32.QueryServiceDynamicInformation?
|
1425
vendor/golang.org/x/sys/windows/setupapi_windows.go
generated
vendored
Normal file
1425
vendor/golang.org/x/sys/windows/setupapi_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
vendor/golang.org/x/sys/windows/str.go
generated
vendored
Normal file
23
vendor/golang.org/x/sys/windows/str.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package windows
|
||||
|
||||
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
||||
if val < 0 {
|
||||
return "-" + itoa(-val)
|
||||
}
|
||||
var buf [32]byte // big enough for int64
|
||||
i := len(buf) - 1
|
||||
for val >= 10 {
|
||||
buf[i] = byte(val%10 + '0')
|
||||
i--
|
||||
val /= 10
|
||||
}
|
||||
buf[i] = byte(val + '0')
|
||||
return string(buf[i:])
|
||||
}
|
113
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
Normal file
113
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
// Package windows contains an interface to the low-level operating system
|
||||
// primitives. OS details vary depending on the underlying system, and
|
||||
// by default, godoc will display the OS-specific documentation for the current
|
||||
// system. If you want godoc to display syscall documentation for another
|
||||
// system, set $GOOS and $GOARCH to the desired system. For example, if
|
||||
// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
|
||||
// to freebsd and $GOARCH to arm.
|
||||
//
|
||||
// The primary use of this package is inside other packages that provide a more
|
||||
// portable interface to the system, such as "os", "time" and "net". Use
|
||||
// those packages rather than this one if you can.
|
||||
//
|
||||
// For details of the functions and data types in this package consult
|
||||
// the manuals for the appropriate operating system.
|
||||
//
|
||||
// These calls return err == nil to indicate success; otherwise
|
||||
// err represents an operating system error describing the failure and
|
||||
// holds a value of type syscall.Errno.
|
||||
package windows // import "golang.org/x/sys/windows"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/internal/unsafeheader"
|
||||
)
|
||||
|
||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||
// containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, syscall.EINVAL).
|
||||
func ByteSliceFromString(s string) ([]byte, error) {
|
||||
if strings.IndexByte(s, 0) != -1 {
|
||||
return nil, syscall.EINVAL
|
||||
}
|
||||
a := make([]byte, len(s)+1)
|
||||
copy(a, s)
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// BytePtrFromString returns a pointer to a NUL-terminated array of
|
||||
// bytes containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, syscall.EINVAL).
|
||||
func BytePtrFromString(s string) (*byte, error) {
|
||||
a, err := ByteSliceFromString(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &a[0], nil
|
||||
}
|
||||
|
||||
// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
|
||||
// bytes after the NUL removed.
|
||||
func ByteSliceToString(s []byte) string {
|
||||
if i := bytes.IndexByte(s, 0); i != -1 {
|
||||
s = s[:i]
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
|
||||
// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
|
||||
// at a zero byte; if the zero byte is not present, the program may crash.
|
||||
func BytePtrToString(p *byte) string {
|
||||
if p == nil {
|
||||
return ""
|
||||
}
|
||||
if *p == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Find NUL terminator.
|
||||
n := 0
|
||||
for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
|
||||
ptr = unsafe.Pointer(uintptr(ptr) + 1)
|
||||
}
|
||||
|
||||
var s []byte
|
||||
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
||||
h.Data = unsafe.Pointer(p)
|
||||
h.Len = n
|
||||
h.Cap = n
|
||||
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// Single-word zero for use when we need a valid pointer to 0 bytes.
|
||||
// See mksyscall.pl.
|
||||
var _zero uintptr
|
||||
|
||||
func (ts *Timespec) Unix() (sec int64, nsec int64) {
|
||||
return int64(ts.Sec), int64(ts.Nsec)
|
||||
}
|
||||
|
||||
func (tv *Timeval) Unix() (sec int64, nsec int64) {
|
||||
return int64(tv.Sec), int64(tv.Usec) * 1000
|
||||
}
|
||||
|
||||
func (ts *Timespec) Nano() int64 {
|
||||
return int64(ts.Sec)*1e9 + int64(ts.Nsec)
|
||||
}
|
||||
|
||||
func (tv *Timeval) Nano() int64 {
|
||||
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
|
||||
}
|
1700
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
Normal file
1700
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3176
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
Normal file
3176
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
vendor/golang.org/x/sys/windows/types_windows_386.go
generated
vendored
Normal file
35
vendor/golang.org/x/sys/windows/types_windows_386.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
type WSAData struct {
|
||||
Version uint16
|
||||
HighVersion uint16
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
MaxSockets uint16
|
||||
MaxUdpDg uint16
|
||||
VendorInfo *byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Port uint16
|
||||
Proto *byte
|
||||
}
|
||||
|
||||
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
|
||||
PerProcessUserTimeLimit int64
|
||||
PerJobUserTimeLimit int64
|
||||
LimitFlags uint32
|
||||
MinimumWorkingSetSize uintptr
|
||||
MaximumWorkingSetSize uintptr
|
||||
ActiveProcessLimit uint32
|
||||
Affinity uintptr
|
||||
PriorityClass uint32
|
||||
SchedulingClass uint32
|
||||
_ uint32 // pad to 8 byte boundary
|
||||
}
|
34
vendor/golang.org/x/sys/windows/types_windows_amd64.go
generated
vendored
Normal file
34
vendor/golang.org/x/sys/windows/types_windows_amd64.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
type WSAData struct {
|
||||
Version uint16
|
||||
HighVersion uint16
|
||||
MaxSockets uint16
|
||||
MaxUdpDg uint16
|
||||
VendorInfo *byte
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Proto *byte
|
||||
Port uint16
|
||||
}
|
||||
|
||||
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
|
||||
PerProcessUserTimeLimit int64
|
||||
PerJobUserTimeLimit int64
|
||||
LimitFlags uint32
|
||||
MinimumWorkingSetSize uintptr
|
||||
MaximumWorkingSetSize uintptr
|
||||
ActiveProcessLimit uint32
|
||||
Affinity uintptr
|
||||
PriorityClass uint32
|
||||
SchedulingClass uint32
|
||||
}
|
35
vendor/golang.org/x/sys/windows/types_windows_arm.go
generated
vendored
Normal file
35
vendor/golang.org/x/sys/windows/types_windows_arm.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
type WSAData struct {
|
||||
Version uint16
|
||||
HighVersion uint16
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
MaxSockets uint16
|
||||
MaxUdpDg uint16
|
||||
VendorInfo *byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Port uint16
|
||||
Proto *byte
|
||||
}
|
||||
|
||||
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
|
||||
PerProcessUserTimeLimit int64
|
||||
PerJobUserTimeLimit int64
|
||||
LimitFlags uint32
|
||||
MinimumWorkingSetSize uintptr
|
||||
MaximumWorkingSetSize uintptr
|
||||
ActiveProcessLimit uint32
|
||||
Affinity uintptr
|
||||
PriorityClass uint32
|
||||
SchedulingClass uint32
|
||||
_ uint32 // pad to 8 byte boundary
|
||||
}
|
34
vendor/golang.org/x/sys/windows/types_windows_arm64.go
generated
vendored
Normal file
34
vendor/golang.org/x/sys/windows/types_windows_arm64.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
type WSAData struct {
|
||||
Version uint16
|
||||
HighVersion uint16
|
||||
MaxSockets uint16
|
||||
MaxUdpDg uint16
|
||||
VendorInfo *byte
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Proto *byte
|
||||
Port uint16
|
||||
}
|
||||
|
||||
type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
|
||||
PerProcessUserTimeLimit int64
|
||||
PerJobUserTimeLimit int64
|
||||
LimitFlags uint32
|
||||
MinimumWorkingSetSize uintptr
|
||||
MaximumWorkingSetSize uintptr
|
||||
ActiveProcessLimit uint32
|
||||
Affinity uintptr
|
||||
PriorityClass uint32
|
||||
SchedulingClass uint32
|
||||
}
|
9468
vendor/golang.org/x/sys/windows/zerrors_windows.go
generated
vendored
Normal file
9468
vendor/golang.org/x/sys/windows/zerrors_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
149
vendor/golang.org/x/sys/windows/zknownfolderids_windows.go
generated
vendored
Normal file
149
vendor/golang.org/x/sys/windows/zknownfolderids_windows.go
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT.
|
||||
|
||||
package windows
|
||||
|
||||
type KNOWNFOLDERID GUID
|
||||
|
||||
var (
|
||||
FOLDERID_NetworkFolder = &KNOWNFOLDERID{0xd20beec4, 0x5ca8, 0x4905, [8]byte{0xae, 0x3b, 0xbf, 0x25, 0x1e, 0xa0, 0x9b, 0x53}}
|
||||
FOLDERID_ComputerFolder = &KNOWNFOLDERID{0x0ac0837c, 0xbbf8, 0x452a, [8]byte{0x85, 0x0d, 0x79, 0xd0, 0x8e, 0x66, 0x7c, 0xa7}}
|
||||
FOLDERID_InternetFolder = &KNOWNFOLDERID{0x4d9f7874, 0x4e0c, 0x4904, [8]byte{0x96, 0x7b, 0x40, 0xb0, 0xd2, 0x0c, 0x3e, 0x4b}}
|
||||
FOLDERID_ControlPanelFolder = &KNOWNFOLDERID{0x82a74aeb, 0xaeb4, 0x465c, [8]byte{0xa0, 0x14, 0xd0, 0x97, 0xee, 0x34, 0x6d, 0x63}}
|
||||
FOLDERID_PrintersFolder = &KNOWNFOLDERID{0x76fc4e2d, 0xd6ad, 0x4519, [8]byte{0xa6, 0x63, 0x37, 0xbd, 0x56, 0x06, 0x81, 0x85}}
|
||||
FOLDERID_SyncManagerFolder = &KNOWNFOLDERID{0x43668bf8, 0xc14e, 0x49b2, [8]byte{0x97, 0xc9, 0x74, 0x77, 0x84, 0xd7, 0x84, 0xb7}}
|
||||
FOLDERID_SyncSetupFolder = &KNOWNFOLDERID{0x0f214138, 0xb1d3, 0x4a90, [8]byte{0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a}}
|
||||
FOLDERID_ConflictFolder = &KNOWNFOLDERID{0x4bfefb45, 0x347d, 0x4006, [8]byte{0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92}}
|
||||
FOLDERID_SyncResultsFolder = &KNOWNFOLDERID{0x289a9a43, 0xbe44, 0x4057, [8]byte{0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9}}
|
||||
FOLDERID_RecycleBinFolder = &KNOWNFOLDERID{0xb7534046, 0x3ecb, 0x4c18, [8]byte{0xbe, 0x4e, 0x64, 0xcd, 0x4c, 0xb7, 0xd6, 0xac}}
|
||||
FOLDERID_ConnectionsFolder = &KNOWNFOLDERID{0x6f0cd92b, 0x2e97, 0x45d1, [8]byte{0x88, 0xff, 0xb0, 0xd1, 0x86, 0xb8, 0xde, 0xdd}}
|
||||
FOLDERID_Fonts = &KNOWNFOLDERID{0xfd228cb7, 0xae11, 0x4ae3, [8]byte{0x86, 0x4c, 0x16, 0xf3, 0x91, 0x0a, 0xb8, 0xfe}}
|
||||
FOLDERID_Desktop = &KNOWNFOLDERID{0xb4bfcc3a, 0xdb2c, 0x424c, [8]byte{0xb0, 0x29, 0x7f, 0xe9, 0x9a, 0x87, 0xc6, 0x41}}
|
||||
FOLDERID_Startup = &KNOWNFOLDERID{0xb97d20bb, 0xf46a, 0x4c97, [8]byte{0xba, 0x10, 0x5e, 0x36, 0x08, 0x43, 0x08, 0x54}}
|
||||
FOLDERID_Programs = &KNOWNFOLDERID{0xa77f5d77, 0x2e2b, 0x44c3, [8]byte{0xa6, 0xa2, 0xab, 0xa6, 0x01, 0x05, 0x4a, 0x51}}
|
||||
FOLDERID_StartMenu = &KNOWNFOLDERID{0x625b53c3, 0xab48, 0x4ec1, [8]byte{0xba, 0x1f, 0xa1, 0xef, 0x41, 0x46, 0xfc, 0x19}}
|
||||
FOLDERID_Recent = &KNOWNFOLDERID{0xae50c081, 0xebd2, 0x438a, [8]byte{0x86, 0x55, 0x8a, 0x09, 0x2e, 0x34, 0x98, 0x7a}}
|
||||
FOLDERID_SendTo = &KNOWNFOLDERID{0x8983036c, 0x27c0, 0x404b, [8]byte{0x8f, 0x08, 0x10, 0x2d, 0x10, 0xdc, 0xfd, 0x74}}
|
||||
FOLDERID_Documents = &KNOWNFOLDERID{0xfdd39ad0, 0x238f, 0x46af, [8]byte{0xad, 0xb4, 0x6c, 0x85, 0x48, 0x03, 0x69, 0xc7}}
|
||||
FOLDERID_Favorites = &KNOWNFOLDERID{0x1777f761, 0x68ad, 0x4d8a, [8]byte{0x87, 0xbd, 0x30, 0xb7, 0x59, 0xfa, 0x33, 0xdd}}
|
||||
FOLDERID_NetHood = &KNOWNFOLDERID{0xc5abbf53, 0xe17f, 0x4121, [8]byte{0x89, 0x00, 0x86, 0x62, 0x6f, 0xc2, 0xc9, 0x73}}
|
||||
FOLDERID_PrintHood = &KNOWNFOLDERID{0x9274bd8d, 0xcfd1, 0x41c3, [8]byte{0xb3, 0x5e, 0xb1, 0x3f, 0x55, 0xa7, 0x58, 0xf4}}
|
||||
FOLDERID_Templates = &KNOWNFOLDERID{0xa63293e8, 0x664e, 0x48db, [8]byte{0xa0, 0x79, 0xdf, 0x75, 0x9e, 0x05, 0x09, 0xf7}}
|
||||
FOLDERID_CommonStartup = &KNOWNFOLDERID{0x82a5ea35, 0xd9cd, 0x47c5, [8]byte{0x96, 0x29, 0xe1, 0x5d, 0x2f, 0x71, 0x4e, 0x6e}}
|
||||
FOLDERID_CommonPrograms = &KNOWNFOLDERID{0x0139d44e, 0x6afe, 0x49f2, [8]byte{0x86, 0x90, 0x3d, 0xaf, 0xca, 0xe6, 0xff, 0xb8}}
|
||||
FOLDERID_CommonStartMenu = &KNOWNFOLDERID{0xa4115719, 0xd62e, 0x491d, [8]byte{0xaa, 0x7c, 0xe7, 0x4b, 0x8b, 0xe3, 0xb0, 0x67}}
|
||||
FOLDERID_PublicDesktop = &KNOWNFOLDERID{0xc4aa340d, 0xf20f, 0x4863, [8]byte{0xaf, 0xef, 0xf8, 0x7e, 0xf2, 0xe6, 0xba, 0x25}}
|
||||
FOLDERID_ProgramData = &KNOWNFOLDERID{0x62ab5d82, 0xfdc1, 0x4dc3, [8]byte{0xa9, 0xdd, 0x07, 0x0d, 0x1d, 0x49, 0x5d, 0x97}}
|
||||
FOLDERID_CommonTemplates = &KNOWNFOLDERID{0xb94237e7, 0x57ac, 0x4347, [8]byte{0x91, 0x51, 0xb0, 0x8c, 0x6c, 0x32, 0xd1, 0xf7}}
|
||||
FOLDERID_PublicDocuments = &KNOWNFOLDERID{0xed4824af, 0xdce4, 0x45a8, [8]byte{0x81, 0xe2, 0xfc, 0x79, 0x65, 0x08, 0x36, 0x34}}
|
||||
FOLDERID_RoamingAppData = &KNOWNFOLDERID{0x3eb685db, 0x65f9, 0x4cf6, [8]byte{0xa0, 0x3a, 0xe3, 0xef, 0x65, 0x72, 0x9f, 0x3d}}
|
||||
FOLDERID_LocalAppData = &KNOWNFOLDERID{0xf1b32785, 0x6fba, 0x4fcf, [8]byte{0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91}}
|
||||
FOLDERID_LocalAppDataLow = &KNOWNFOLDERID{0xa520a1a4, 0x1780, 0x4ff6, [8]byte{0xbd, 0x18, 0x16, 0x73, 0x43, 0xc5, 0xaf, 0x16}}
|
||||
FOLDERID_InternetCache = &KNOWNFOLDERID{0x352481e8, 0x33be, 0x4251, [8]byte{0xba, 0x85, 0x60, 0x07, 0xca, 0xed, 0xcf, 0x9d}}
|
||||
FOLDERID_Cookies = &KNOWNFOLDERID{0x2b0f765d, 0xc0e9, 0x4171, [8]byte{0x90, 0x8e, 0x08, 0xa6, 0x11, 0xb8, 0x4f, 0xf6}}
|
||||
FOLDERID_History = &KNOWNFOLDERID{0xd9dc8a3b, 0xb784, 0x432e, [8]byte{0xa7, 0x81, 0x5a, 0x11, 0x30, 0xa7, 0x59, 0x63}}
|
||||
FOLDERID_System = &KNOWNFOLDERID{0x1ac14e77, 0x02e7, 0x4e5d, [8]byte{0xb7, 0x44, 0x2e, 0xb1, 0xae, 0x51, 0x98, 0xb7}}
|
||||
FOLDERID_SystemX86 = &KNOWNFOLDERID{0xd65231b0, 0xb2f1, 0x4857, [8]byte{0xa4, 0xce, 0xa8, 0xe7, 0xc6, 0xea, 0x7d, 0x27}}
|
||||
FOLDERID_Windows = &KNOWNFOLDERID{0xf38bf404, 0x1d43, 0x42f2, [8]byte{0x93, 0x05, 0x67, 0xde, 0x0b, 0x28, 0xfc, 0x23}}
|
||||
FOLDERID_Profile = &KNOWNFOLDERID{0x5e6c858f, 0x0e22, 0x4760, [8]byte{0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73}}
|
||||
FOLDERID_Pictures = &KNOWNFOLDERID{0x33e28130, 0x4e1e, 0x4676, [8]byte{0x83, 0x5a, 0x98, 0x39, 0x5c, 0x3b, 0xc3, 0xbb}}
|
||||
FOLDERID_ProgramFilesX86 = &KNOWNFOLDERID{0x7c5a40ef, 0xa0fb, 0x4bfc, [8]byte{0x87, 0x4a, 0xc0, 0xf2, 0xe0, 0xb9, 0xfa, 0x8e}}
|
||||
FOLDERID_ProgramFilesCommonX86 = &KNOWNFOLDERID{0xde974d24, 0xd9c6, 0x4d3e, [8]byte{0xbf, 0x91, 0xf4, 0x45, 0x51, 0x20, 0xb9, 0x17}}
|
||||
FOLDERID_ProgramFilesX64 = &KNOWNFOLDERID{0x6d809377, 0x6af0, 0x444b, [8]byte{0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e}}
|
||||
FOLDERID_ProgramFilesCommonX64 = &KNOWNFOLDERID{0x6365d5a7, 0x0f0d, 0x45e5, [8]byte{0x87, 0xf6, 0x0d, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d}}
|
||||
FOLDERID_ProgramFiles = &KNOWNFOLDERID{0x905e63b6, 0xc1bf, 0x494e, [8]byte{0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a}}
|
||||
FOLDERID_ProgramFilesCommon = &KNOWNFOLDERID{0xf7f1ed05, 0x9f6d, 0x47a2, [8]byte{0xaa, 0xae, 0x29, 0xd3, 0x17, 0xc6, 0xf0, 0x66}}
|
||||
FOLDERID_UserProgramFiles = &KNOWNFOLDERID{0x5cd7aee2, 0x2219, 0x4a67, [8]byte{0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb}}
|
||||
FOLDERID_UserProgramFilesCommon = &KNOWNFOLDERID{0xbcbd3057, 0xca5c, 0x4622, [8]byte{0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16}}
|
||||
FOLDERID_AdminTools = &KNOWNFOLDERID{0x724ef170, 0xa42d, 0x4fef, [8]byte{0x9f, 0x26, 0xb6, 0x0e, 0x84, 0x6f, 0xba, 0x4f}}
|
||||
FOLDERID_CommonAdminTools = &KNOWNFOLDERID{0xd0384e7d, 0xbac3, 0x4797, [8]byte{0x8f, 0x14, 0xcb, 0xa2, 0x29, 0xb3, 0x92, 0xb5}}
|
||||
FOLDERID_Music = &KNOWNFOLDERID{0x4bd8d571, 0x6d19, 0x48d3, [8]byte{0xbe, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0e, 0x43}}
|
||||
FOLDERID_Videos = &KNOWNFOLDERID{0x18989b1d, 0x99b5, 0x455b, [8]byte{0x84, 0x1c, 0xab, 0x7c, 0x74, 0xe4, 0xdd, 0xfc}}
|
||||
FOLDERID_Ringtones = &KNOWNFOLDERID{0xc870044b, 0xf49e, 0x4126, [8]byte{0xa9, 0xc3, 0xb5, 0x2a, 0x1f, 0xf4, 0x11, 0xe8}}
|
||||
FOLDERID_PublicPictures = &KNOWNFOLDERID{0xb6ebfb86, 0x6907, 0x413c, [8]byte{0x9a, 0xf7, 0x4f, 0xc2, 0xab, 0xf0, 0x7c, 0xc5}}
|
||||
FOLDERID_PublicMusic = &KNOWNFOLDERID{0x3214fab5, 0x9757, 0x4298, [8]byte{0xbb, 0x61, 0x92, 0xa9, 0xde, 0xaa, 0x44, 0xff}}
|
||||
FOLDERID_PublicVideos = &KNOWNFOLDERID{0x2400183a, 0x6185, 0x49fb, [8]byte{0xa2, 0xd8, 0x4a, 0x39, 0x2a, 0x60, 0x2b, 0xa3}}
|
||||
FOLDERID_PublicRingtones = &KNOWNFOLDERID{0xe555ab60, 0x153b, 0x4d17, [8]byte{0x9f, 0x04, 0xa5, 0xfe, 0x99, 0xfc, 0x15, 0xec}}
|
||||
FOLDERID_ResourceDir = &KNOWNFOLDERID{0x8ad10c31, 0x2adb, 0x4296, [8]byte{0xa8, 0xf7, 0xe4, 0x70, 0x12, 0x32, 0xc9, 0x72}}
|
||||
FOLDERID_LocalizedResourcesDir = &KNOWNFOLDERID{0x2a00375e, 0x224c, 0x49de, [8]byte{0xb8, 0xd1, 0x44, 0x0d, 0xf7, 0xef, 0x3d, 0xdc}}
|
||||
FOLDERID_CommonOEMLinks = &KNOWNFOLDERID{0xc1bae2d0, 0x10df, 0x4334, [8]byte{0xbe, 0xdd, 0x7a, 0xa2, 0x0b, 0x22, 0x7a, 0x9d}}
|
||||
FOLDERID_CDBurning = &KNOWNFOLDERID{0x9e52ab10, 0xf80d, 0x49df, [8]byte{0xac, 0xb8, 0x43, 0x30, 0xf5, 0x68, 0x78, 0x55}}
|
||||
FOLDERID_UserProfiles = &KNOWNFOLDERID{0x0762d272, 0xc50a, 0x4bb0, [8]byte{0xa3, 0x82, 0x69, 0x7d, 0xcd, 0x72, 0x9b, 0x80}}
|
||||
FOLDERID_Playlists = &KNOWNFOLDERID{0xde92c1c7, 0x837f, 0x4f69, [8]byte{0xa3, 0xbb, 0x86, 0xe6, 0x31, 0x20, 0x4a, 0x23}}
|
||||
FOLDERID_SamplePlaylists = &KNOWNFOLDERID{0x15ca69b3, 0x30ee, 0x49c1, [8]byte{0xac, 0xe1, 0x6b, 0x5e, 0xc3, 0x72, 0xaf, 0xb5}}
|
||||
FOLDERID_SampleMusic = &KNOWNFOLDERID{0xb250c668, 0xf57d, 0x4ee1, [8]byte{0xa6, 0x3c, 0x29, 0x0e, 0xe7, 0xd1, 0xaa, 0x1f}}
|
||||
FOLDERID_SamplePictures = &KNOWNFOLDERID{0xc4900540, 0x2379, 0x4c75, [8]byte{0x84, 0x4b, 0x64, 0xe6, 0xfa, 0xf8, 0x71, 0x6b}}
|
||||
FOLDERID_SampleVideos = &KNOWNFOLDERID{0x859ead94, 0x2e85, 0x48ad, [8]byte{0xa7, 0x1a, 0x09, 0x69, 0xcb, 0x56, 0xa6, 0xcd}}
|
||||
FOLDERID_PhotoAlbums = &KNOWNFOLDERID{0x69d2cf90, 0xfc33, 0x4fb7, [8]byte{0x9a, 0x0c, 0xeb, 0xb0, 0xf0, 0xfc, 0xb4, 0x3c}}
|
||||
FOLDERID_Public = &KNOWNFOLDERID{0xdfdf76a2, 0xc82a, 0x4d63, [8]byte{0x90, 0x6a, 0x56, 0x44, 0xac, 0x45, 0x73, 0x85}}
|
||||
FOLDERID_ChangeRemovePrograms = &KNOWNFOLDERID{0xdf7266ac, 0x9274, 0x4867, [8]byte{0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d}}
|
||||
FOLDERID_AppUpdates = &KNOWNFOLDERID{0xa305ce99, 0xf527, 0x492b, [8]byte{0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4}}
|
||||
FOLDERID_AddNewPrograms = &KNOWNFOLDERID{0xde61d971, 0x5ebc, 0x4f02, [8]byte{0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04}}
|
||||
FOLDERID_Downloads = &KNOWNFOLDERID{0x374de290, 0x123f, 0x4565, [8]byte{0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}}
|
||||
FOLDERID_PublicDownloads = &KNOWNFOLDERID{0x3d644c9b, 0x1fb8, 0x4f30, [8]byte{0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0}}
|
||||
FOLDERID_SavedSearches = &KNOWNFOLDERID{0x7d1d3a04, 0xdebb, 0x4115, [8]byte{0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda}}
|
||||
FOLDERID_QuickLaunch = &KNOWNFOLDERID{0x52a4f021, 0x7b75, 0x48a9, [8]byte{0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f}}
|
||||
FOLDERID_Contacts = &KNOWNFOLDERID{0x56784854, 0xc6cb, 0x462b, [8]byte{0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82}}
|
||||
FOLDERID_SidebarParts = &KNOWNFOLDERID{0xa75d362e, 0x50fc, 0x4fb7, [8]byte{0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93}}
|
||||
FOLDERID_SidebarDefaultParts = &KNOWNFOLDERID{0x7b396e54, 0x9ec5, 0x4300, [8]byte{0xbe, 0x0a, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26}}
|
||||
FOLDERID_PublicGameTasks = &KNOWNFOLDERID{0xdebf2536, 0xe1a8, 0x4c59, [8]byte{0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea}}
|
||||
FOLDERID_GameTasks = &KNOWNFOLDERID{0x054fae61, 0x4dd8, 0x4787, [8]byte{0x80, 0xb6, 0x09, 0x02, 0x20, 0xc4, 0xb7, 0x00}}
|
||||
FOLDERID_SavedGames = &KNOWNFOLDERID{0x4c5c32ff, 0xbb9d, 0x43b0, [8]byte{0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4}}
|
||||
FOLDERID_Games = &KNOWNFOLDERID{0xcac52c1a, 0xb53d, 0x4edc, [8]byte{0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34}}
|
||||
FOLDERID_SEARCH_MAPI = &KNOWNFOLDERID{0x98ec0e18, 0x2098, 0x4d44, [8]byte{0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81}}
|
||||
FOLDERID_SEARCH_CSC = &KNOWNFOLDERID{0xee32e446, 0x31ca, 0x4aba, [8]byte{0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e}}
|
||||
FOLDERID_Links = &KNOWNFOLDERID{0xbfb9d5e0, 0xc6a9, 0x404c, [8]byte{0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68}}
|
||||
FOLDERID_UsersFiles = &KNOWNFOLDERID{0xf3ce0f7c, 0x4901, 0x4acc, [8]byte{0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f}}
|
||||
FOLDERID_UsersLibraries = &KNOWNFOLDERID{0xa302545d, 0xdeff, 0x464b, [8]byte{0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b}}
|
||||
FOLDERID_SearchHome = &KNOWNFOLDERID{0x190337d1, 0xb8ca, 0x4121, [8]byte{0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a}}
|
||||
FOLDERID_OriginalImages = &KNOWNFOLDERID{0x2c36c0aa, 0x5812, 0x4b87, [8]byte{0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39}}
|
||||
FOLDERID_DocumentsLibrary = &KNOWNFOLDERID{0x7b0db17d, 0x9cd2, 0x4a93, [8]byte{0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c}}
|
||||
FOLDERID_MusicLibrary = &KNOWNFOLDERID{0x2112ab0a, 0xc86a, 0x4ffe, [8]byte{0xa3, 0x68, 0x0d, 0xe9, 0x6e, 0x47, 0x01, 0x2e}}
|
||||
FOLDERID_PicturesLibrary = &KNOWNFOLDERID{0xa990ae9f, 0xa03b, 0x4e80, [8]byte{0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x04}}
|
||||
FOLDERID_VideosLibrary = &KNOWNFOLDERID{0x491e922f, 0x5643, 0x4af4, [8]byte{0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74}}
|
||||
FOLDERID_RecordedTVLibrary = &KNOWNFOLDERID{0x1a6fdba2, 0xf42d, 0x4358, [8]byte{0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5}}
|
||||
FOLDERID_HomeGroup = &KNOWNFOLDERID{0x52528a6b, 0xb9e3, 0x4add, [8]byte{0xb6, 0x0d, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d}}
|
||||
FOLDERID_HomeGroupCurrentUser = &KNOWNFOLDERID{0x9b74b6a3, 0x0dfd, 0x4f11, [8]byte{0x9e, 0x78, 0x5f, 0x78, 0x00, 0xf2, 0xe7, 0x72}}
|
||||
FOLDERID_DeviceMetadataStore = &KNOWNFOLDERID{0x5ce4a5e9, 0xe4eb, 0x479d, [8]byte{0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55}}
|
||||
FOLDERID_Libraries = &KNOWNFOLDERID{0x1b3ea5dc, 0xb587, 0x4786, [8]byte{0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae}}
|
||||
FOLDERID_PublicLibraries = &KNOWNFOLDERID{0x48daf80b, 0xe6cf, 0x4f4e, [8]byte{0xb8, 0x00, 0x0e, 0x69, 0xd8, 0x4e, 0xe3, 0x84}}
|
||||
FOLDERID_UserPinned = &KNOWNFOLDERID{0x9e3995ab, 0x1f9c, 0x4f13, [8]byte{0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74}}
|
||||
FOLDERID_ImplicitAppShortcuts = &KNOWNFOLDERID{0xbcb5256f, 0x79f6, 0x4cee, [8]byte{0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x02, 0xfd, 0x46}}
|
||||
FOLDERID_AccountPictures = &KNOWNFOLDERID{0x008ca0b1, 0x55b4, 0x4c56, [8]byte{0xb8, 0xa8, 0x4d, 0xe4, 0xb2, 0x99, 0xd3, 0xbe}}
|
||||
FOLDERID_PublicUserTiles = &KNOWNFOLDERID{0x0482af6c, 0x08f1, 0x4c34, [8]byte{0x8c, 0x90, 0xe1, 0x7e, 0xc9, 0x8b, 0x1e, 0x17}}
|
||||
FOLDERID_AppsFolder = &KNOWNFOLDERID{0x1e87508d, 0x89c2, 0x42f0, [8]byte{0x8a, 0x7e, 0x64, 0x5a, 0x0f, 0x50, 0xca, 0x58}}
|
||||
FOLDERID_StartMenuAllPrograms = &KNOWNFOLDERID{0xf26305ef, 0x6948, 0x40b9, [8]byte{0xb2, 0x55, 0x81, 0x45, 0x3d, 0x09, 0xc7, 0x85}}
|
||||
FOLDERID_CommonStartMenuPlaces = &KNOWNFOLDERID{0xa440879f, 0x87a0, 0x4f7d, [8]byte{0xb7, 0x00, 0x02, 0x07, 0xb9, 0x66, 0x19, 0x4a}}
|
||||
FOLDERID_ApplicationShortcuts = &KNOWNFOLDERID{0xa3918781, 0xe5f2, 0x4890, [8]byte{0xb3, 0xd9, 0xa7, 0xe5, 0x43, 0x32, 0x32, 0x8c}}
|
||||
FOLDERID_RoamingTiles = &KNOWNFOLDERID{0x00bcfc5a, 0xed94, 0x4e48, [8]byte{0x96, 0xa1, 0x3f, 0x62, 0x17, 0xf2, 0x19, 0x90}}
|
||||
FOLDERID_RoamedTileImages = &KNOWNFOLDERID{0xaaa8d5a5, 0xf1d6, 0x4259, [8]byte{0xba, 0xa8, 0x78, 0xe7, 0xef, 0x60, 0x83, 0x5e}}
|
||||
FOLDERID_Screenshots = &KNOWNFOLDERID{0xb7bede81, 0xdf94, 0x4682, [8]byte{0xa7, 0xd8, 0x57, 0xa5, 0x26, 0x20, 0xb8, 0x6f}}
|
||||
FOLDERID_CameraRoll = &KNOWNFOLDERID{0xab5fb87b, 0x7ce2, 0x4f83, [8]byte{0x91, 0x5d, 0x55, 0x08, 0x46, 0xc9, 0x53, 0x7b}}
|
||||
FOLDERID_SkyDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}}
|
||||
FOLDERID_OneDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}}
|
||||
FOLDERID_SkyDriveDocuments = &KNOWNFOLDERID{0x24d89e24, 0x2f19, 0x4534, [8]byte{0x9d, 0xde, 0x6a, 0x66, 0x71, 0xfb, 0xb8, 0xfe}}
|
||||
FOLDERID_SkyDrivePictures = &KNOWNFOLDERID{0x339719b5, 0x8c47, 0x4894, [8]byte{0x94, 0xc2, 0xd8, 0xf7, 0x7a, 0xdd, 0x44, 0xa6}}
|
||||
FOLDERID_SkyDriveMusic = &KNOWNFOLDERID{0xc3f2459e, 0x80d6, 0x45dc, [8]byte{0xbf, 0xef, 0x1f, 0x76, 0x9f, 0x2b, 0xe7, 0x30}}
|
||||
FOLDERID_SkyDriveCameraRoll = &KNOWNFOLDERID{0x767e6811, 0x49cb, 0x4273, [8]byte{0x87, 0xc2, 0x20, 0xf3, 0x55, 0xe1, 0x08, 0x5b}}
|
||||
FOLDERID_SearchHistory = &KNOWNFOLDERID{0x0d4c3db6, 0x03a3, 0x462f, [8]byte{0xa0, 0xe6, 0x08, 0x92, 0x4c, 0x41, 0xb5, 0xd4}}
|
||||
FOLDERID_SearchTemplates = &KNOWNFOLDERID{0x7e636bfe, 0xdfa9, 0x4d5e, [8]byte{0xb4, 0x56, 0xd7, 0xb3, 0x98, 0x51, 0xd8, 0xa9}}
|
||||
FOLDERID_CameraRollLibrary = &KNOWNFOLDERID{0x2b20df75, 0x1eda, 0x4039, [8]byte{0x80, 0x97, 0x38, 0x79, 0x82, 0x27, 0xd5, 0xb7}}
|
||||
FOLDERID_SavedPictures = &KNOWNFOLDERID{0x3b193882, 0xd3ad, 0x4eab, [8]byte{0x96, 0x5a, 0x69, 0x82, 0x9d, 0x1f, 0xb5, 0x9f}}
|
||||
FOLDERID_SavedPicturesLibrary = &KNOWNFOLDERID{0xe25b5812, 0xbe88, 0x4bd9, [8]byte{0x94, 0xb0, 0x29, 0x23, 0x34, 0x77, 0xb6, 0xc3}}
|
||||
FOLDERID_RetailDemo = &KNOWNFOLDERID{0x12d4c69e, 0x24ad, 0x4923, [8]byte{0xbe, 0x19, 0x31, 0x32, 0x1c, 0x43, 0xa7, 0x67}}
|
||||
FOLDERID_Device = &KNOWNFOLDERID{0x1c2ac1dc, 0x4358, 0x4b6c, [8]byte{0x97, 0x33, 0xaf, 0x21, 0x15, 0x65, 0x76, 0xf0}}
|
||||
FOLDERID_DevelopmentFiles = &KNOWNFOLDERID{0xdbe8e08e, 0x3053, 0x4bbc, [8]byte{0xb1, 0x83, 0x2a, 0x7b, 0x2b, 0x19, 0x1e, 0x59}}
|
||||
FOLDERID_Objects3D = &KNOWNFOLDERID{0x31c0dd25, 0x9439, 0x4f12, [8]byte{0xbf, 0x41, 0x7f, 0xf4, 0xed, 0xa3, 0x87, 0x22}}
|
||||
FOLDERID_AppCaptures = &KNOWNFOLDERID{0xedc0fe71, 0x98d8, 0x4f4a, [8]byte{0xb9, 0x20, 0xc8, 0xdc, 0x13, 0x3c, 0xb1, 0x65}}
|
||||
FOLDERID_LocalDocuments = &KNOWNFOLDERID{0xf42ee2d3, 0x909f, 0x4907, [8]byte{0x88, 0x71, 0x4c, 0x22, 0xfc, 0x0b, 0xf7, 0x56}}
|
||||
FOLDERID_LocalPictures = &KNOWNFOLDERID{0x0ddd015d, 0xb06c, 0x45d5, [8]byte{0x8c, 0x4c, 0xf5, 0x97, 0x13, 0x85, 0x46, 0x39}}
|
||||
FOLDERID_LocalVideos = &KNOWNFOLDERID{0x35286a68, 0x3c57, 0x41a1, [8]byte{0xbb, 0xb1, 0x0e, 0xae, 0x73, 0xd7, 0x6c, 0x95}}
|
||||
FOLDERID_LocalMusic = &KNOWNFOLDERID{0xa0c69a99, 0x21c8, 0x4671, [8]byte{0x87, 0x03, 0x79, 0x34, 0x16, 0x2f, 0xcf, 0x1d}}
|
||||
FOLDERID_LocalDownloads = &KNOWNFOLDERID{0x7d83ee9b, 0x2244, 0x4e70, [8]byte{0xb1, 0xf5, 0x53, 0x93, 0x04, 0x2a, 0xf1, 0xe4}}
|
||||
FOLDERID_RecordedCalls = &KNOWNFOLDERID{0x2f8b40c2, 0x83ed, 0x48ee, [8]byte{0xb3, 0x83, 0xa1, 0xf1, 0x57, 0xec, 0x6f, 0x9a}}
|
||||
FOLDERID_AllAppMods = &KNOWNFOLDERID{0x7ad67899, 0x66af, 0x43ba, [8]byte{0x91, 0x56, 0x6a, 0xad, 0x42, 0xe6, 0xc5, 0x96}}
|
||||
FOLDERID_CurrentAppMods = &KNOWNFOLDERID{0x3db40b20, 0x2a30, 0x4dbe, [8]byte{0x91, 0x7e, 0x77, 0x1d, 0xd2, 0x1d, 0xd0, 0x99}}
|
||||
FOLDERID_AppDataDesktop = &KNOWNFOLDERID{0xb2c5e279, 0x7add, 0x439f, [8]byte{0xb2, 0x8c, 0xc4, 0x1f, 0xe1, 0xbb, 0xf6, 0x72}}
|
||||
FOLDERID_AppDataDocuments = &KNOWNFOLDERID{0x7be16610, 0x1f7f, 0x44ac, [8]byte{0xbf, 0xf0, 0x83, 0xe1, 0x5f, 0x2f, 0xfc, 0xa1}}
|
||||
FOLDERID_AppDataFavorites = &KNOWNFOLDERID{0x7cfbefbc, 0xde1f, 0x45aa, [8]byte{0xb8, 0x43, 0xa5, 0x42, 0xac, 0x53, 0x6c, 0xc9}}
|
||||
FOLDERID_AppDataProgramData = &KNOWNFOLDERID{0x559d40a3, 0xa036, 0x40fa, [8]byte{0xaf, 0x61, 0x84, 0xcb, 0x43, 0x0a, 0x4d, 0x34}}
|
||||
)
|
4196
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
Normal file
4196
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -100,6 +100,9 @@ github.com/mazznoer/csscolorparser
|
||||
# github.com/mitchellh/mapstructure v1.5.0
|
||||
## explicit; go 1.14
|
||||
github.com/mitchellh/mapstructure
|
||||
# github.com/muesli/termenv v0.12.0
|
||||
## explicit; go 1.13
|
||||
github.com/muesli/termenv
|
||||
# github.com/pelletier/go-toml v1.9.5
|
||||
## explicit; go 1.12
|
||||
github.com/pelletier/go-toml
|
||||
@ -171,6 +174,7 @@ golang.org/x/net/proxy
|
||||
## explicit; go 1.17
|
||||
golang.org/x/sys/internal/unsafeheader
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
# golang.org/x/text v0.3.7
|
||||
## explicit; go 1.17
|
||||
golang.org/x/text/transform
|
||||
|
Loading…
Reference in New Issue
Block a user