mirror of
https://github.com/beego/bee.git
synced 2025-07-07 06:20:19 +00:00
Update vendors
This commit is contained in:
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.
|
||||
|
||||
// +build windows
|
||||
// +build go1.9
|
||||
|
||||
package windows
|
||||
|
||||
import "syscall"
|
||||
|
||||
type Errno = syscall.Errno
|
||||
type SysProcAttr = syscall.SysProcAttr
|
8
vendor/golang.org/x/sys/windows/asm.s
generated
vendored
8
vendor/golang.org/x/sys/windows/asm.s
generated
vendored
@ -1,8 +0,0 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·use(SB),NOSPLIT,$0
|
||||
RET
|
4
vendor/golang.org/x/sys/windows/asm_windows_386.s
generated
vendored
4
vendor/golang.org/x/sys/windows/asm_windows_386.s
generated
vendored
@ -6,8 +6,8 @@
|
||||
// System calls for 386, Windows are implemented in runtime/syscall_windows.goc
|
||||
//
|
||||
|
||||
TEXT ·getprocaddress(SB), 7, $0-8
|
||||
TEXT ·getprocaddress(SB), 7, $0-16
|
||||
JMP syscall·getprocaddress(SB)
|
||||
|
||||
TEXT ·loadlibrary(SB), 7, $0-4
|
||||
TEXT ·loadlibrary(SB), 7, $0-12
|
||||
JMP syscall·loadlibrary(SB)
|
||||
|
2
vendor/golang.org/x/sys/windows/asm_windows_amd64.s
generated
vendored
2
vendor/golang.org/x/sys/windows/asm_windows_amd64.s
generated
vendored
@ -9,5 +9,5 @@
|
||||
TEXT ·getprocaddress(SB), 7, $0-32
|
||||
JMP syscall·getprocaddress(SB)
|
||||
|
||||
TEXT ·loadlibrary(SB), 7, $0-8
|
||||
TEXT ·loadlibrary(SB), 7, $0-24
|
||||
JMP syscall·loadlibrary(SB)
|
||||
|
11
vendor/golang.org/x/sys/windows/asm_windows_arm.s
generated
vendored
Normal file
11
vendor/golang.org/x/sys/windows/asm_windows_arm.s
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// 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.
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
TEXT ·getprocaddress(SB),NOSPLIT,$0
|
||||
B syscall·getprocaddress(SB)
|
||||
|
||||
TEXT ·loadlibrary(SB),NOSPLIT,$0
|
||||
B syscall·loadlibrary(SB)
|
145
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
145
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -31,6 +31,10 @@ type DLL struct {
|
||||
}
|
||||
|
||||
// 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 {
|
||||
@ -110,7 +114,9 @@ func (p *Proc) Addr() uintptr {
|
||||
return p.addr
|
||||
}
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
|
||||
//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.
|
||||
@ -154,7 +160,6 @@ func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
default:
|
||||
panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// A LazyDLL implements access to a single DLL.
|
||||
@ -162,29 +167,48 @@ func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||
// call to its Handle method or to one of its
|
||||
// LazyProc's Addr method.
|
||||
type LazyDLL struct {
|
||||
mu sync.Mutex
|
||||
dll *DLL // non nil once DLL is loaded
|
||||
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 {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
if d.dll == nil {
|
||||
dll, e := LoadDLL(d.Name)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
// Non-racy version of:
|
||||
// d.dll = dll
|
||||
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll)), unsafe.Pointer(dll))
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
@ -212,11 +236,19 @@ 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 {
|
||||
mu sync.Mutex
|
||||
Name string
|
||||
|
||||
mu sync.Mutex
|
||||
l *LazyDLL
|
||||
proc *Proc
|
||||
}
|
||||
@ -257,13 +289,16 @@ func (p *LazyProc) mustFind() {
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
|
||||
// are supplied.
|
||||
//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
|
||||
@ -273,3 +308,71 @@ 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() {
|
||||
const LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
|
||||
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.
|
||||
windir, _ := Getenv("WINDIR") // old var; apparently works on XP
|
||||
if windir == "" {
|
||||
return nil, errString("%WINDIR% not defined")
|
||||
}
|
||||
loadDLL = windir + "\\System32\\" + 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) }
|
||||
|
14
vendor/golang.org/x/sys/windows/env_unset.go
generated
vendored
14
vendor/golang.org/x/sys/windows/env_unset.go
generated
vendored
@ -1,14 +0,0 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
// +build go1.4
|
||||
|
||||
package windows
|
||||
|
||||
import "syscall"
|
||||
|
||||
func Unsetenv(key string) error {
|
||||
// This was added in Go 1.4.
|
||||
return syscall.Unsetenv(key)
|
||||
}
|
6
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
6
vendor/golang.org/x/sys/windows/env_windows.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2010 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -23,3 +23,7 @@ func Clearenv() {
|
||||
func Environ() []string {
|
||||
return syscall.Environ()
|
||||
}
|
||||
|
||||
func Unsetenv(key string) error {
|
||||
return syscall.Unsetenv(key)
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
Normal file
26
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 = 0x01
|
||||
PAGE_READONLY = 0x02
|
||||
PAGE_READWRITE = 0x04
|
||||
PAGE_WRITECOPY = 0x08
|
||||
PAGE_EXECUTE_READ = 0x20
|
||||
PAGE_EXECUTE_READWRITE = 0x40
|
||||
PAGE_EXECUTE_WRITECOPY = 0x80
|
||||
)
|
7
vendor/golang.org/x/sys/windows/mksyscall.go
generated
vendored
Normal file
7
vendor/golang.org/x/sys/windows/mksyscall.go
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
// 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.
|
||||
|
||||
package windows
|
||||
|
||||
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go
|
2
vendor/golang.org/x/sys/windows/race.go
generated
vendored
2
vendor/golang.org/x/sys/windows/race.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
|
2
vendor/golang.org/x/sys/windows/race0.go
generated
vendored
2
vendor/golang.org/x/sys/windows/race0.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
|
47
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
47
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -132,6 +132,36 @@ const (
|
||||
SECURITY_NT_NON_UNIQUE_RID = 0x15
|
||||
)
|
||||
|
||||
// Predefined domain-relative RIDs for local groups.
|
||||
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379649(v=vs.85).aspx
|
||||
const (
|
||||
DOMAIN_ALIAS_RID_ADMINS = 0x220
|
||||
DOMAIN_ALIAS_RID_USERS = 0x221
|
||||
DOMAIN_ALIAS_RID_GUESTS = 0x222
|
||||
DOMAIN_ALIAS_RID_POWER_USERS = 0x223
|
||||
DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224
|
||||
DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225
|
||||
DOMAIN_ALIAS_RID_PRINT_OPS = 0x226
|
||||
DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227
|
||||
DOMAIN_ALIAS_RID_REPLICATOR = 0x228
|
||||
DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229
|
||||
DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a
|
||||
DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b
|
||||
DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c
|
||||
DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d
|
||||
DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e
|
||||
DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f
|
||||
DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230
|
||||
DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231
|
||||
DOMAIN_ALIAS_RID_DCOM_USERS = 0x232
|
||||
DOMAIN_ALIAS_RID_IUSERS = 0x238
|
||||
DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = 0x239
|
||||
DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = 0x23b
|
||||
DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = 0x23c
|
||||
DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 0x23d
|
||||
DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP = 0x23e
|
||||
)
|
||||
|
||||
//sys LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountSidW
|
||||
//sys LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountNameW
|
||||
//sys ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) = advapi32.ConvertSidToStringSidW
|
||||
@ -266,6 +296,7 @@ const (
|
||||
TOKEN_ADJUST_PRIVILEGES
|
||||
TOKEN_ADJUST_GROUPS
|
||||
TOKEN_ADJUST_DEFAULT
|
||||
TOKEN_ADJUST_SESSIONID
|
||||
|
||||
TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |
|
||||
TOKEN_ASSIGN_PRIMARY |
|
||||
@ -275,7 +306,8 @@ const (
|
||||
TOKEN_QUERY_SOURCE |
|
||||
TOKEN_ADJUST_PRIVILEGES |
|
||||
TOKEN_ADJUST_GROUPS |
|
||||
TOKEN_ADJUST_DEFAULT
|
||||
TOKEN_ADJUST_DEFAULT |
|
||||
TOKEN_ADJUST_SESSIONID
|
||||
TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY
|
||||
TOKEN_WRITE = STANDARD_RIGHTS_WRITE |
|
||||
TOKEN_ADJUST_PRIVILEGES |
|
||||
@ -335,6 +367,8 @@ type Tokengroups struct {
|
||||
Groups [1]SIDAndAttributes
|
||||
}
|
||||
|
||||
// Authorization Functions
|
||||
//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership
|
||||
//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken
|
||||
//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation
|
||||
//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW
|
||||
@ -433,3 +467,12 @@ func (t Token) GetUserProfileDirectory() (string, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IsMember reports whether the access token t is a member of the provided SID.
|
||||
func (t Token) IsMember(sid *SID) (bool, error) {
|
||||
var b int32
|
||||
if e := checkTokenMembership(t, sid, &b); e != nil {
|
||||
return false, e
|
||||
}
|
||||
return b != 0, nil
|
||||
}
|
||||
|
40
vendor/golang.org/x/sys/windows/service.go
generated
vendored
40
vendor/golang.org/x/sys/windows/service.go
generated
vendored
@ -43,6 +43,11 @@ const (
|
||||
|
||||
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
|
||||
@ -95,6 +100,8 @@ const (
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS = 2
|
||||
|
||||
NO_ERROR = 0
|
||||
|
||||
SC_ENUM_PROCESS_INFO = 0
|
||||
)
|
||||
|
||||
type SERVICE_STATUS struct {
|
||||
@ -128,6 +135,37 @@ type SERVICE_DESCRIPTION struct {
|
||||
Description *uint16
|
||||
}
|
||||
|
||||
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_FAILURE_ACTIONS struct {
|
||||
ResetPeriod uint32
|
||||
RebootMsg *uint16
|
||||
Command *uint16
|
||||
ActionsCount uint32
|
||||
Actions *SC_ACTION
|
||||
}
|
||||
|
||||
type SC_ACTION struct {
|
||||
Type uint32
|
||||
Delay uint32
|
||||
}
|
||||
|
||||
//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
|
||||
@ -141,3 +179,5 @@ type SERVICE_DESCRIPTION struct {
|
||||
//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
|
||||
|
17
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
17
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
@ -5,25 +5,27 @@
|
||||
// +build windows
|
||||
|
||||
// Package windows contains an interface to the low-level operating system
|
||||
// primitives. OS details vary depending on the underlying system, and
|
||||
// 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
|
||||
// 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
|
||||
package windows // import "golang.org/x/sys/windows"
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||
@ -70,8 +72,3 @@ func (ts *Timespec) Nano() int64 {
|
||||
func (tv *Timeval) Nano() int64 {
|
||||
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
|
||||
}
|
||||
|
||||
// use is a no-op, but the compiler cannot see that it is.
|
||||
// Calling use(p) ensures that p is kept live until that point.
|
||||
//go:noescape
|
||||
func use(p unsafe.Pointer)
|
||||
|
251
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
251
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -14,11 +14,48 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go
|
||||
|
||||
type Handle uintptr
|
||||
|
||||
const InvalidHandle = ^Handle(0)
|
||||
const (
|
||||
InvalidHandle = ^Handle(0)
|
||||
|
||||
// Flags for DefineDosDevice.
|
||||
DDD_EXACT_MATCH_ON_REMOVE = 0x00000004
|
||||
DDD_NO_BROADCAST_SYSTEM = 0x00000008
|
||||
DDD_RAW_TARGET_PATH = 0x00000001
|
||||
DDD_REMOVE_DEFINITION = 0x00000002
|
||||
|
||||
// Return values for GetDriveType.
|
||||
DRIVE_UNKNOWN = 0
|
||||
DRIVE_NO_ROOT_DIR = 1
|
||||
DRIVE_REMOVABLE = 2
|
||||
DRIVE_FIXED = 3
|
||||
DRIVE_REMOTE = 4
|
||||
DRIVE_CDROM = 5
|
||||
DRIVE_RAMDISK = 6
|
||||
|
||||
// File system flags from GetVolumeInformation and GetVolumeInformationByHandle.
|
||||
FILE_CASE_SENSITIVE_SEARCH = 0x00000001
|
||||
FILE_CASE_PRESERVED_NAMES = 0x00000002
|
||||
FILE_FILE_COMPRESSION = 0x00000010
|
||||
FILE_DAX_VOLUME = 0x20000000
|
||||
FILE_NAMED_STREAMS = 0x00040000
|
||||
FILE_PERSISTENT_ACLS = 0x00000008
|
||||
FILE_READ_ONLY_VOLUME = 0x00080000
|
||||
FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000
|
||||
FILE_SUPPORTS_ENCRYPTION = 0x00020000
|
||||
FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000
|
||||
FILE_SUPPORTS_HARD_LINKS = 0x00400000
|
||||
FILE_SUPPORTS_OBJECT_IDS = 0x00010000
|
||||
FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000
|
||||
FILE_SUPPORTS_REPARSE_POINTS = 0x00000080
|
||||
FILE_SUPPORTS_SPARSE_FILES = 0x00000040
|
||||
FILE_SUPPORTS_TRANSACTIONS = 0x00200000
|
||||
FILE_SUPPORTS_USN_JOURNAL = 0x02000000
|
||||
FILE_UNICODE_ON_DISK = 0x00000004
|
||||
FILE_VOLUME_IS_COMPRESSED = 0x00008000
|
||||
FILE_VOLUME_QUOTAS = 0x00000020
|
||||
)
|
||||
|
||||
// StringToUTF16 is deprecated. Use UTF16FromString instead.
|
||||
// If s contains a NUL byte this function panics instead of
|
||||
@ -73,17 +110,25 @@ func UTF16PtrFromString(s string) (*uint16, error) {
|
||||
|
||||
func Getpagesize() int { return 4096 }
|
||||
|
||||
// Converts a Go function to a function pointer conforming
|
||||
// to the stdcall or cdecl calling convention. This is useful when
|
||||
// interoperating with Windows code requiring callbacks.
|
||||
// Implemented in runtime/syscall_windows.goc
|
||||
func NewCallback(fn interface{}) uintptr
|
||||
func NewCallbackCDecl(fn interface{}) uintptr
|
||||
// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention.
|
||||
// This is useful when interoperating with Windows code requiring callbacks.
|
||||
// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr.
|
||||
func NewCallback(fn interface{}) uintptr {
|
||||
return syscall.NewCallback(fn)
|
||||
}
|
||||
|
||||
// NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention.
|
||||
// This is useful when interoperating with Windows code requiring callbacks.
|
||||
// The argument is expected to be a function with with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr.
|
||||
func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
return syscall.NewCallbackCDecl(fn)
|
||||
}
|
||||
|
||||
// windows api calls
|
||||
|
||||
//sys GetLastError() (lasterr error)
|
||||
//sys LoadLibrary(libname string) (handle Handle, err error) = LoadLibraryW
|
||||
//sys LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) = LoadLibraryExW
|
||||
//sys FreeLibrary(handle Handle) (err error)
|
||||
//sys GetProcAddress(module Handle, procname string) (proc uintptr, err error)
|
||||
//sys GetVersion() (ver uint32, err error)
|
||||
@ -94,7 +139,8 @@ func NewCallbackCDecl(fn interface{}) uintptr
|
||||
//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
||||
//sys SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) [failretval==0xffffffff]
|
||||
//sys CloseHandle(handle Handle) (err error)
|
||||
//sys GetStdHandle(stdhandle int) (handle Handle, err error) [failretval==InvalidHandle]
|
||||
//sys GetStdHandle(stdhandle uint32) (handle Handle, err error) [failretval==InvalidHandle]
|
||||
//sys SetStdHandle(stdhandle uint32, handle Handle) (err error)
|
||||
//sys findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstFileW
|
||||
//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW
|
||||
//sys FindClose(handle Handle) (err error)
|
||||
@ -110,6 +156,7 @@ func NewCallbackCDecl(fn interface{}) uintptr
|
||||
//sys GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW
|
||||
//sys SetEndOfFile(handle Handle) (err error)
|
||||
//sys GetSystemTimeAsFileTime(time *Filetime)
|
||||
//sys GetSystemTimePreciseAsFileTime(time *Filetime)
|
||||
//sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff]
|
||||
//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error)
|
||||
//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error)
|
||||
@ -153,6 +200,9 @@ func NewCallbackCDecl(fn interface{}) uintptr
|
||||
//sys FlushViewOfFile(addr uintptr, length uintptr) (err error)
|
||||
//sys VirtualLock(addr uintptr, length uintptr) (err error)
|
||||
//sys VirtualUnlock(addr uintptr, length uintptr) (err error)
|
||||
//sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc
|
||||
//sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree
|
||||
//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect
|
||||
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
|
||||
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
|
||||
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW
|
||||
@ -172,6 +222,8 @@ func NewCallbackCDecl(fn interface{}) uintptr
|
||||
//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
|
||||
//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
|
||||
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
|
||||
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
|
||||
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
|
||||
//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW
|
||||
//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW
|
||||
//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot
|
||||
@ -182,11 +234,51 @@ func NewCallbackCDecl(fn interface{}) uintptr
|
||||
//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW
|
||||
//sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW
|
||||
//sys GetCurrentThreadId() (id uint32)
|
||||
//sys CreateEvent(eventAttrs *syscall.SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW
|
||||
//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW
|
||||
//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateEventExW
|
||||
//sys OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW
|
||||
//sys SetEvent(event Handle) (err error) = kernel32.SetEvent
|
||||
//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent
|
||||
//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent
|
||||
|
||||
// Volume Management Functions
|
||||
//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW
|
||||
//sys DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) = DeleteVolumeMountPointW
|
||||
//sys FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeW
|
||||
//sys FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeMountPointW
|
||||
//sys FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) = FindNextVolumeW
|
||||
//sys FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) = FindNextVolumeMountPointW
|
||||
//sys FindVolumeClose(findVolume Handle) (err error)
|
||||
//sys FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error)
|
||||
//sys GetDriveType(rootPathName *uint16) (driveType uint32) = GetDriveTypeW
|
||||
//sys GetLogicalDrives() (drivesBitMask uint32, err error) [failretval==0]
|
||||
//sys GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) [failretval==0] = GetLogicalDriveStringsW
|
||||
//sys GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationW
|
||||
//sys GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationByHandleW
|
||||
//sys GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) = GetVolumeNameForVolumeMountPointW
|
||||
//sys GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) = GetVolumePathNameW
|
||||
//sys GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) = GetVolumePathNamesForVolumeNameW
|
||||
//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW
|
||||
//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW
|
||||
//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW
|
||||
|
||||
// syscall interface implementation for other packages
|
||||
|
||||
// GetProcAddressByOrdinal retrieves the address of the exported
|
||||
// function from module by ordinal.
|
||||
func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0)
|
||||
proc = uintptr(r0)
|
||||
if proc == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Exit(code int) { ExitProcess(uint32(code)) }
|
||||
|
||||
func makeInheritSa() *SecurityAttributes {
|
||||
@ -312,8 +404,8 @@ var (
|
||||
Stderr = getStdHandle(STD_ERROR_HANDLE)
|
||||
)
|
||||
|
||||
func getStdHandle(h int) (fd Handle) {
|
||||
r, _ := GetStdHandle(h)
|
||||
func getStdHandle(stdhandle uint32) (fd Handle) {
|
||||
r, _ := GetStdHandle(stdhandle)
|
||||
CloseOnExec(r)
|
||||
return r
|
||||
}
|
||||
@ -485,6 +577,10 @@ func Chmod(path string, mode uint32) (err error) {
|
||||
return SetFileAttributes(p, attrs)
|
||||
}
|
||||
|
||||
func LoadGetSystemTimePreciseAsFileTime() error {
|
||||
return procGetSystemTimePreciseAsFileTime.Find()
|
||||
}
|
||||
|
||||
func LoadCancelIoEx() error {
|
||||
return procCancelIoEx.Find()
|
||||
}
|
||||
@ -559,7 +655,7 @@ type RawSockaddr struct {
|
||||
|
||||
type RawSockaddrAny struct {
|
||||
Addr RawSockaddr
|
||||
Pad [96]int8
|
||||
Pad [100]int8
|
||||
}
|
||||
|
||||
type Sockaddr interface {
|
||||
@ -608,19 +704,69 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil
|
||||
}
|
||||
|
||||
type RawSockaddrUnix struct {
|
||||
Family uint16
|
||||
Path [UNIX_PATH_MAX]int8
|
||||
}
|
||||
|
||||
type SockaddrUnix struct {
|
||||
Name string
|
||||
raw RawSockaddrUnix
|
||||
}
|
||||
|
||||
func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
// TODO(brainman): implement SockaddrUnix.sockaddr()
|
||||
return nil, 0, syscall.EWINDOWS
|
||||
name := sa.Name
|
||||
n := len(name)
|
||||
if n > len(sa.raw.Path) {
|
||||
return nil, 0, syscall.EINVAL
|
||||
}
|
||||
if n == len(sa.raw.Path) && name[0] != '@' {
|
||||
return nil, 0, syscall.EINVAL
|
||||
}
|
||||
sa.raw.Family = AF_UNIX
|
||||
for i := 0; i < n; i++ {
|
||||
sa.raw.Path[i] = int8(name[i])
|
||||
}
|
||||
// length is family (uint16), name, NUL.
|
||||
sl := int32(2)
|
||||
if n > 0 {
|
||||
sl += int32(n) + 1
|
||||
}
|
||||
if sa.raw.Path[0] == '@' {
|
||||
sa.raw.Path[0] = 0
|
||||
// Don't count trailing NUL for abstract address.
|
||||
sl--
|
||||
}
|
||||
|
||||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
return nil, syscall.EWINDOWS
|
||||
pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa))
|
||||
sa := new(SockaddrUnix)
|
||||
if pp.Path[0] == 0 {
|
||||
// "Abstract" Unix domain socket.
|
||||
// Rewrite leading NUL as @ for textual display.
|
||||
// (This is the standard convention.)
|
||||
// Not friendly to overwrite in place,
|
||||
// but the callers below don't care.
|
||||
pp.Path[0] = '@'
|
||||
}
|
||||
|
||||
// Assume path ends at NUL.
|
||||
// This is not technically the Linux semantics for
|
||||
// abstract Unix domain sockets--they are supposed
|
||||
// to be uninterpreted fixed-size binary blobs--but
|
||||
// everyone uses this convention.
|
||||
n := 0
|
||||
for n < len(pp.Path) && pp.Path[n] != 0 {
|
||||
n++
|
||||
}
|
||||
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
||||
sa.Name = string(bytes)
|
||||
return sa, nil
|
||||
|
||||
case AF_INET:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||
@ -762,6 +908,75 @@ func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesS
|
||||
return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped)
|
||||
}
|
||||
|
||||
var sendRecvMsgFunc struct {
|
||||
once sync.Once
|
||||
sendAddr uintptr
|
||||
recvAddr uintptr
|
||||
err error
|
||||
}
|
||||
|
||||
func loadWSASendRecvMsg() error {
|
||||
sendRecvMsgFunc.once.Do(func() {
|
||||
var s Handle
|
||||
s, sendRecvMsgFunc.err = Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
|
||||
if sendRecvMsgFunc.err != nil {
|
||||
return
|
||||
}
|
||||
defer CloseHandle(s)
|
||||
var n uint32
|
||||
sendRecvMsgFunc.err = WSAIoctl(s,
|
||||
SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
(*byte)(unsafe.Pointer(&WSAID_WSARECVMSG)),
|
||||
uint32(unsafe.Sizeof(WSAID_WSARECVMSG)),
|
||||
(*byte)(unsafe.Pointer(&sendRecvMsgFunc.recvAddr)),
|
||||
uint32(unsafe.Sizeof(sendRecvMsgFunc.recvAddr)),
|
||||
&n, nil, 0)
|
||||
if sendRecvMsgFunc.err != nil {
|
||||
return
|
||||
}
|
||||
sendRecvMsgFunc.err = WSAIoctl(s,
|
||||
SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
(*byte)(unsafe.Pointer(&WSAID_WSASENDMSG)),
|
||||
uint32(unsafe.Sizeof(WSAID_WSASENDMSG)),
|
||||
(*byte)(unsafe.Pointer(&sendRecvMsgFunc.sendAddr)),
|
||||
uint32(unsafe.Sizeof(sendRecvMsgFunc.sendAddr)),
|
||||
&n, nil, 0)
|
||||
})
|
||||
return sendRecvMsgFunc.err
|
||||
}
|
||||
|
||||
func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error {
|
||||
err := loadWSASendRecvMsg()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
|
||||
if r1 == socket_error {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error {
|
||||
err := loadWSASendRecvMsg()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0)
|
||||
if r1 == socket_error {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// Invented structures to support what package os expects.
|
||||
type Rusage struct {
|
||||
CreationTime Filetime
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -29,6 +29,7 @@ const (
|
||||
ERROR_NOT_FOUND syscall.Errno = 1168
|
||||
ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314
|
||||
WSAEACCES syscall.Errno = 10013
|
||||
WSAEMSGSIZE syscall.Errno = 10040
|
||||
WSAECONNRESET syscall.Errno = 10054
|
||||
)
|
||||
|
||||
@ -93,16 +94,29 @@ const (
|
||||
FILE_APPEND_DATA = 0x00000004
|
||||
FILE_WRITE_ATTRIBUTES = 0x00000100
|
||||
|
||||
FILE_SHARE_READ = 0x00000001
|
||||
FILE_SHARE_WRITE = 0x00000002
|
||||
FILE_SHARE_DELETE = 0x00000004
|
||||
FILE_ATTRIBUTE_READONLY = 0x00000001
|
||||
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
||||
FILE_ATTRIBUTE_SYSTEM = 0x00000004
|
||||
FILE_ATTRIBUTE_DIRECTORY = 0x00000010
|
||||
FILE_ATTRIBUTE_ARCHIVE = 0x00000020
|
||||
FILE_ATTRIBUTE_NORMAL = 0x00000080
|
||||
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
|
||||
FILE_SHARE_READ = 0x00000001
|
||||
FILE_SHARE_WRITE = 0x00000002
|
||||
FILE_SHARE_DELETE = 0x00000004
|
||||
|
||||
FILE_ATTRIBUTE_READONLY = 0x00000001
|
||||
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
||||
FILE_ATTRIBUTE_SYSTEM = 0x00000004
|
||||
FILE_ATTRIBUTE_DIRECTORY = 0x00000010
|
||||
FILE_ATTRIBUTE_ARCHIVE = 0x00000020
|
||||
FILE_ATTRIBUTE_DEVICE = 0x00000040
|
||||
FILE_ATTRIBUTE_NORMAL = 0x00000080
|
||||
FILE_ATTRIBUTE_TEMPORARY = 0x00000100
|
||||
FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200
|
||||
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
|
||||
FILE_ATTRIBUTE_COMPRESSED = 0x00000800
|
||||
FILE_ATTRIBUTE_OFFLINE = 0x00001000
|
||||
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
|
||||
FILE_ATTRIBUTE_ENCRYPTED = 0x00004000
|
||||
FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x00008000
|
||||
FILE_ATTRIBUTE_VIRTUAL = 0x00010000
|
||||
FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x00020000
|
||||
FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x00040000
|
||||
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x00400000
|
||||
|
||||
INVALID_FILE_ATTRIBUTES = 0xffffffff
|
||||
|
||||
@ -122,9 +136,9 @@ const (
|
||||
DUPLICATE_CLOSE_SOURCE = 0x00000001
|
||||
DUPLICATE_SAME_ACCESS = 0x00000002
|
||||
|
||||
STD_INPUT_HANDLE = -10
|
||||
STD_OUTPUT_HANDLE = -11
|
||||
STD_ERROR_HANDLE = -12
|
||||
STD_INPUT_HANDLE = -10 & (1<<32 - 1)
|
||||
STD_OUTPUT_HANDLE = -11 & (1<<32 - 1)
|
||||
STD_ERROR_HANDLE = -12 & (1<<32 - 1)
|
||||
|
||||
FILE_BEGIN = 0
|
||||
FILE_CURRENT = 1
|
||||
@ -158,20 +172,10 @@ const (
|
||||
WAIT_OBJECT_0 = 0x00000000
|
||||
WAIT_FAILED = 0xFFFFFFFF
|
||||
|
||||
CREATE_NEW_PROCESS_GROUP = 0x00000200
|
||||
CREATE_UNICODE_ENVIRONMENT = 0x00000400
|
||||
|
||||
PROCESS_TERMINATE = 1
|
||||
PROCESS_QUERY_INFORMATION = 0x00000400
|
||||
SYNCHRONIZE = 0x00100000
|
||||
|
||||
PAGE_READONLY = 0x02
|
||||
PAGE_READWRITE = 0x04
|
||||
PAGE_WRITECOPY = 0x08
|
||||
PAGE_EXECUTE_READ = 0x20
|
||||
PAGE_EXECUTE_READWRITE = 0x40
|
||||
PAGE_EXECUTE_WRITECOPY = 0x80
|
||||
|
||||
FILE_MAP_COPY = 0x01
|
||||
FILE_MAP_WRITE = 0x02
|
||||
FILE_MAP_READ = 0x04
|
||||
@ -184,6 +188,26 @@ const (
|
||||
APPLICATION_ERROR = 1 << 29
|
||||
)
|
||||
|
||||
const (
|
||||
// Process creation flags.
|
||||
CREATE_BREAKAWAY_FROM_JOB = 0x01000000
|
||||
CREATE_DEFAULT_ERROR_MODE = 0x04000000
|
||||
CREATE_NEW_CONSOLE = 0x00000010
|
||||
CREATE_NEW_PROCESS_GROUP = 0x00000200
|
||||
CREATE_NO_WINDOW = 0x08000000
|
||||
CREATE_PROTECTED_PROCESS = 0x00040000
|
||||
CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000
|
||||
CREATE_SEPARATE_WOW_VDM = 0x00000800
|
||||
CREATE_SHARED_WOW_VDM = 0x00001000
|
||||
CREATE_SUSPENDED = 0x00000004
|
||||
CREATE_UNICODE_ENVIRONMENT = 0x00000400
|
||||
DEBUG_ONLY_THIS_PROCESS = 0x00000002
|
||||
DEBUG_PROCESS = 0x00000001
|
||||
DETACHED_PROCESS = 0x00000008
|
||||
EXTENDED_STARTUPINFO_PRESENT = 0x00080000
|
||||
INHERIT_PARENT_AFFINITY = 0x00010000
|
||||
)
|
||||
|
||||
const (
|
||||
// flags for CreateToolhelp32Snapshot
|
||||
TH32CS_SNAPHEAPLIST = 0x01
|
||||
@ -246,15 +270,87 @@ const (
|
||||
USAGE_MATCH_TYPE_AND = 0
|
||||
USAGE_MATCH_TYPE_OR = 1
|
||||
|
||||
/* msgAndCertEncodingType values for CertOpenStore function */
|
||||
X509_ASN_ENCODING = 0x00000001
|
||||
PKCS_7_ASN_ENCODING = 0x00010000
|
||||
|
||||
CERT_STORE_PROV_MEMORY = 2
|
||||
|
||||
CERT_STORE_ADD_ALWAYS = 4
|
||||
/* storeProvider values for CertOpenStore function */
|
||||
CERT_STORE_PROV_MSG = 1
|
||||
CERT_STORE_PROV_MEMORY = 2
|
||||
CERT_STORE_PROV_FILE = 3
|
||||
CERT_STORE_PROV_REG = 4
|
||||
CERT_STORE_PROV_PKCS7 = 5
|
||||
CERT_STORE_PROV_SERIALIZED = 6
|
||||
CERT_STORE_PROV_FILENAME_A = 7
|
||||
CERT_STORE_PROV_FILENAME_W = 8
|
||||
CERT_STORE_PROV_FILENAME = CERT_STORE_PROV_FILENAME_W
|
||||
CERT_STORE_PROV_SYSTEM_A = 9
|
||||
CERT_STORE_PROV_SYSTEM_W = 10
|
||||
CERT_STORE_PROV_SYSTEM = CERT_STORE_PROV_SYSTEM_W
|
||||
CERT_STORE_PROV_COLLECTION = 11
|
||||
CERT_STORE_PROV_SYSTEM_REGISTRY_A = 12
|
||||
CERT_STORE_PROV_SYSTEM_REGISTRY_W = 13
|
||||
CERT_STORE_PROV_SYSTEM_REGISTRY = CERT_STORE_PROV_SYSTEM_REGISTRY_W
|
||||
CERT_STORE_PROV_PHYSICAL_W = 14
|
||||
CERT_STORE_PROV_PHYSICAL = CERT_STORE_PROV_PHYSICAL_W
|
||||
CERT_STORE_PROV_SMART_CARD_W = 15
|
||||
CERT_STORE_PROV_SMART_CARD = CERT_STORE_PROV_SMART_CARD_W
|
||||
CERT_STORE_PROV_LDAP_W = 16
|
||||
CERT_STORE_PROV_LDAP = CERT_STORE_PROV_LDAP_W
|
||||
CERT_STORE_PROV_PKCS12 = 17
|
||||
|
||||
/* store characteristics (low WORD of flag) for CertOpenStore function */
|
||||
CERT_STORE_NO_CRYPT_RELEASE_FLAG = 0x00000001
|
||||
CERT_STORE_SET_LOCALIZED_NAME_FLAG = 0x00000002
|
||||
CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004
|
||||
CERT_STORE_DELETE_FLAG = 0x00000010
|
||||
CERT_STORE_UNSAFE_PHYSICAL_FLAG = 0x00000020
|
||||
CERT_STORE_SHARE_STORE_FLAG = 0x00000040
|
||||
CERT_STORE_SHARE_CONTEXT_FLAG = 0x00000080
|
||||
CERT_STORE_MANIFOLD_FLAG = 0x00000100
|
||||
CERT_STORE_ENUM_ARCHIVED_FLAG = 0x00000200
|
||||
CERT_STORE_UPDATE_KEYID_FLAG = 0x00000400
|
||||
CERT_STORE_BACKUP_RESTORE_FLAG = 0x00000800
|
||||
CERT_STORE_MAXIMUM_ALLOWED_FLAG = 0x00001000
|
||||
CERT_STORE_CREATE_NEW_FLAG = 0x00002000
|
||||
CERT_STORE_OPEN_EXISTING_FLAG = 0x00004000
|
||||
CERT_STORE_READONLY_FLAG = 0x00008000
|
||||
|
||||
/* store locations (high WORD of flag) for CertOpenStore function */
|
||||
CERT_SYSTEM_STORE_CURRENT_USER = 0x00010000
|
||||
CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x00020000
|
||||
CERT_SYSTEM_STORE_CURRENT_SERVICE = 0x00040000
|
||||
CERT_SYSTEM_STORE_SERVICES = 0x00050000
|
||||
CERT_SYSTEM_STORE_USERS = 0x00060000
|
||||
CERT_SYSTEM_STORE_CURRENT_USER_GROUP_POLICY = 0x00070000
|
||||
CERT_SYSTEM_STORE_LOCAL_MACHINE_GROUP_POLICY = 0x00080000
|
||||
CERT_SYSTEM_STORE_LOCAL_MACHINE_ENTERPRISE = 0x00090000
|
||||
CERT_SYSTEM_STORE_UNPROTECTED_FLAG = 0x40000000
|
||||
CERT_SYSTEM_STORE_RELOCATE_FLAG = 0x80000000
|
||||
|
||||
/* Miscellaneous high-WORD flags for CertOpenStore function */
|
||||
CERT_REGISTRY_STORE_REMOTE_FLAG = 0x00010000
|
||||
CERT_REGISTRY_STORE_SERIALIZED_FLAG = 0x00020000
|
||||
CERT_REGISTRY_STORE_ROAMING_FLAG = 0x00040000
|
||||
CERT_REGISTRY_STORE_MY_IE_DIRTY_FLAG = 0x00080000
|
||||
CERT_REGISTRY_STORE_LM_GPT_FLAG = 0x01000000
|
||||
CERT_REGISTRY_STORE_CLIENT_GPT_FLAG = 0x80000000
|
||||
CERT_FILE_STORE_COMMIT_ENABLE_FLAG = 0x00010000
|
||||
CERT_LDAP_STORE_SIGN_FLAG = 0x00010000
|
||||
CERT_LDAP_STORE_AREC_EXCLUSIVE_FLAG = 0x00020000
|
||||
CERT_LDAP_STORE_OPENED_FLAG = 0x00040000
|
||||
CERT_LDAP_STORE_UNBIND_FLAG = 0x00080000
|
||||
|
||||
/* addDisposition values for CertAddCertificateContextToStore function */
|
||||
CERT_STORE_ADD_NEW = 1
|
||||
CERT_STORE_ADD_USE_EXISTING = 2
|
||||
CERT_STORE_ADD_REPLACE_EXISTING = 3
|
||||
CERT_STORE_ADD_ALWAYS = 4
|
||||
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES = 5
|
||||
CERT_STORE_ADD_NEWER = 6
|
||||
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES = 7
|
||||
|
||||
/* ErrorStatus values for CertTrustStatus struct */
|
||||
CERT_TRUST_NO_ERROR = 0x00000000
|
||||
CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001
|
||||
CERT_TRUST_IS_REVOKED = 0x00000004
|
||||
@ -271,11 +367,31 @@ const (
|
||||
CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000
|
||||
CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000
|
||||
CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000
|
||||
CERT_TRUST_IS_PARTIAL_CHAIN = 0x00010000
|
||||
CERT_TRUST_CTL_IS_NOT_TIME_VALID = 0x00020000
|
||||
CERT_TRUST_CTL_IS_NOT_SIGNATURE_VALID = 0x00040000
|
||||
CERT_TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 0x00080000
|
||||
CERT_TRUST_HAS_WEAK_SIGNATURE = 0x00100000
|
||||
CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000
|
||||
CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000
|
||||
CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000
|
||||
CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000
|
||||
|
||||
/* InfoStatus values for CertTrustStatus struct */
|
||||
CERT_TRUST_HAS_EXACT_MATCH_ISSUER = 0x00000001
|
||||
CERT_TRUST_HAS_KEY_MATCH_ISSUER = 0x00000002
|
||||
CERT_TRUST_HAS_NAME_MATCH_ISSUER = 0x00000004
|
||||
CERT_TRUST_IS_SELF_SIGNED = 0x00000008
|
||||
CERT_TRUST_HAS_PREFERRED_ISSUER = 0x00000100
|
||||
CERT_TRUST_HAS_ISSUANCE_CHAIN_POLICY = 0x00000400
|
||||
CERT_TRUST_HAS_VALID_NAME_CONSTRAINTS = 0x00000400
|
||||
CERT_TRUST_IS_PEER_TRUSTED = 0x00000800
|
||||
CERT_TRUST_HAS_CRL_VALIDITY_EXTENDED = 0x00001000
|
||||
CERT_TRUST_IS_FROM_EXCLUSIVE_TRUST_STORE = 0x00002000
|
||||
CERT_TRUST_IS_CA_TRUSTED = 0x00004000
|
||||
CERT_TRUST_IS_COMPLEX_CHAIN = 0x00010000
|
||||
|
||||
/* policyOID values for CertVerifyCertificateChainPolicy function */
|
||||
CERT_CHAIN_POLICY_BASE = 1
|
||||
CERT_CHAIN_POLICY_AUTHENTICODE = 2
|
||||
CERT_CHAIN_POLICY_AUTHENTICODE_TS = 3
|
||||
@ -284,6 +400,7 @@ const (
|
||||
CERT_CHAIN_POLICY_NT_AUTH = 6
|
||||
CERT_CHAIN_POLICY_MICROSOFT_ROOT = 7
|
||||
CERT_CHAIN_POLICY_EV = 8
|
||||
CERT_CHAIN_POLICY_SSL_F12 = 9
|
||||
|
||||
CERT_E_EXPIRED = 0x800B0101
|
||||
CERT_E_ROLE = 0x800B0103
|
||||
@ -291,8 +408,16 @@ const (
|
||||
CERT_E_UNTRUSTEDROOT = 0x800B0109
|
||||
CERT_E_CN_NO_MATCH = 0x800B010F
|
||||
|
||||
/* AuthType values for SSLExtraCertChainPolicyPara struct */
|
||||
AUTHTYPE_CLIENT = 1
|
||||
AUTHTYPE_SERVER = 2
|
||||
|
||||
/* Checks values for SSLExtraCertChainPolicyPara struct */
|
||||
SECURITY_FLAG_IGNORE_REVOCATION = 0x00000080
|
||||
SECURITY_FLAG_IGNORE_UNKNOWN_CA = 0x00000100
|
||||
SECURITY_FLAG_IGNORE_WRONG_USAGE = 0x00000200
|
||||
SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000
|
||||
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000
|
||||
)
|
||||
|
||||
var (
|
||||
@ -301,6 +426,14 @@ var (
|
||||
OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
|
||||
)
|
||||
|
||||
// Pointer represents a pointer to an arbitrary Windows type.
|
||||
//
|
||||
// Pointer-typed fields may point to one of many different types. It's
|
||||
// up to the caller to provide a pointer to the appropriate type, cast
|
||||
// to Pointer. The caller must obey the unsafe.Pointer rules while
|
||||
// doing so.
|
||||
type Pointer *struct{}
|
||||
|
||||
// Invented values to support what package os expects.
|
||||
type Timeval struct {
|
||||
Sec int32
|
||||
@ -574,6 +707,16 @@ const (
|
||||
IPV6_JOIN_GROUP = 0xc
|
||||
IPV6_LEAVE_GROUP = 0xd
|
||||
|
||||
MSG_OOB = 0x1
|
||||
MSG_PEEK = 0x2
|
||||
MSG_DONTROUTE = 0x4
|
||||
MSG_WAITALL = 0x8
|
||||
|
||||
MSG_TRUNC = 0x0100
|
||||
MSG_CTRUNC = 0x0200
|
||||
MSG_BCAST = 0x0400
|
||||
MSG_MCAST = 0x0800
|
||||
|
||||
SOMAXCONN = 0x7fffffff
|
||||
|
||||
TCP_NODELAY = 1
|
||||
@ -591,6 +734,15 @@ type WSABuf struct {
|
||||
Buf *byte
|
||||
}
|
||||
|
||||
type WSAMsg struct {
|
||||
Name *syscall.RawSockaddrAny
|
||||
Namelen int32
|
||||
Buffers *WSABuf
|
||||
BufferCount uint32
|
||||
Control WSABuf
|
||||
Flags uint32
|
||||
}
|
||||
|
||||
// Invented values to support what package os expects.
|
||||
const (
|
||||
S_IFMT = 0x1f000
|
||||
@ -850,11 +1002,15 @@ type MibIfRow struct {
|
||||
Descr [MAXLEN_IFDESCR]byte
|
||||
}
|
||||
|
||||
type CertInfo struct {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
type CertContext struct {
|
||||
EncodingType uint32
|
||||
EncodedCert *byte
|
||||
Length uint32
|
||||
CertInfo uintptr
|
||||
CertInfo *CertInfo
|
||||
Store Handle
|
||||
}
|
||||
|
||||
@ -869,12 +1025,16 @@ type CertChainContext struct {
|
||||
RevocationFreshnessTime uint32
|
||||
}
|
||||
|
||||
type CertTrustListInfo struct {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
type CertSimpleChain struct {
|
||||
Size uint32
|
||||
TrustStatus CertTrustStatus
|
||||
NumElements uint32
|
||||
Elements **CertChainElement
|
||||
TrustListInfo uintptr
|
||||
TrustListInfo *CertTrustListInfo
|
||||
HasRevocationFreshnessTime uint32
|
||||
RevocationFreshnessTime uint32
|
||||
}
|
||||
@ -889,14 +1049,18 @@ type CertChainElement struct {
|
||||
ExtendedErrorInfo *uint16
|
||||
}
|
||||
|
||||
type CertRevocationCrlInfo struct {
|
||||
// Not implemented
|
||||
}
|
||||
|
||||
type CertRevocationInfo struct {
|
||||
Size uint32
|
||||
RevocationResult uint32
|
||||
RevocationOid *byte
|
||||
OidSpecificInfo uintptr
|
||||
OidSpecificInfo Pointer
|
||||
HasFreshnessTime uint32
|
||||
FreshnessTime uint32
|
||||
CrlInfo uintptr // *CertRevocationCrlInfo
|
||||
CrlInfo *CertRevocationCrlInfo
|
||||
}
|
||||
|
||||
type CertTrustStatus struct {
|
||||
@ -927,7 +1091,7 @@ type CertChainPara struct {
|
||||
type CertChainPolicyPara struct {
|
||||
Size uint32
|
||||
Flags uint32
|
||||
ExtraPolicyPara uintptr
|
||||
ExtraPolicyPara Pointer
|
||||
}
|
||||
|
||||
type SSLExtraCertChainPolicyPara struct {
|
||||
@ -942,7 +1106,7 @@ type CertChainPolicyStatus struct {
|
||||
Error uint32
|
||||
ChainIndex uint32
|
||||
ElementIndex uint32
|
||||
ExtraPolicyStatus uintptr
|
||||
ExtraPolicyStatus Pointer
|
||||
}
|
||||
|
||||
const (
|
||||
@ -1018,6 +1182,20 @@ var WSAID_CONNECTEX = GUID{
|
||||
[8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e},
|
||||
}
|
||||
|
||||
var WSAID_WSASENDMSG = GUID{
|
||||
0xa441e712,
|
||||
0x754f,
|
||||
0x43ca,
|
||||
[8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d},
|
||||
}
|
||||
|
||||
var WSAID_WSARECVMSG = GUID{
|
||||
0xf689d7c8,
|
||||
0x6f1f,
|
||||
0x436b,
|
||||
[8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22},
|
||||
}
|
||||
|
||||
const (
|
||||
FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1
|
||||
FILE_SKIP_SET_EVENT_ON_HANDLE = 2
|
||||
@ -1240,3 +1418,52 @@ const (
|
||||
IfOperStatusNotPresent = 6
|
||||
IfOperStatusLowerLayerDown = 7
|
||||
)
|
||||
|
||||
// Console related constants used for the mode parameter to SetConsoleMode. See
|
||||
// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
|
||||
|
||||
const (
|
||||
ENABLE_PROCESSED_INPUT = 0x1
|
||||
ENABLE_LINE_INPUT = 0x2
|
||||
ENABLE_ECHO_INPUT = 0x4
|
||||
ENABLE_WINDOW_INPUT = 0x8
|
||||
ENABLE_MOUSE_INPUT = 0x10
|
||||
ENABLE_INSERT_MODE = 0x20
|
||||
ENABLE_QUICK_EDIT_MODE = 0x40
|
||||
ENABLE_EXTENDED_FLAGS = 0x80
|
||||
ENABLE_AUTO_POSITION = 0x100
|
||||
ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200
|
||||
|
||||
ENABLE_PROCESSED_OUTPUT = 0x1
|
||||
ENABLE_WRAP_AT_EOL_OUTPUT = 0x2
|
||||
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
|
||||
DISABLE_NEWLINE_AUTO_RETURN = 0x8
|
||||
ENABLE_LVB_GRID_WORLDWIDE = 0x10
|
||||
)
|
||||
|
||||
type Coord struct {
|
||||
X int16
|
||||
Y int16
|
||||
}
|
||||
|
||||
type SmallRect struct {
|
||||
Left int16
|
||||
Top int16
|
||||
Right int16
|
||||
Bottom int16
|
||||
}
|
||||
|
||||
// Used with GetConsoleScreenBuffer to retrieve information about a console
|
||||
// screen buffer. See
|
||||
// https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str
|
||||
// for details.
|
||||
|
||||
type ConsoleScreenBufferInfo struct {
|
||||
Size Coord
|
||||
CursorPosition Coord
|
||||
Attributes uint16
|
||||
Window SmallRect
|
||||
MaximumWindowSize Coord
|
||||
}
|
||||
|
||||
const UNIX_PATH_MAX = 108 // defined in afunix.h
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -7,16 +7,16 @@ 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
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Proto *byte
|
||||
Port uint16
|
||||
Proto *byte
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -7,16 +7,16 @@ 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
|
||||
Description [WSADESCRIPTION_LEN + 1]byte
|
||||
SystemStatus [WSASYS_STATUS_LEN + 1]byte
|
||||
}
|
||||
|
||||
type Servent struct {
|
||||
Name *byte
|
||||
Aliases **byte
|
||||
Port uint16
|
||||
Proto *byte
|
||||
Port uint16
|
||||
}
|
22
vendor/golang.org/x/sys/windows/types_windows_arm.go
generated
vendored
Normal file
22
vendor/golang.org/x/sys/windows/types_windows_arm.go
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
// 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
|
||||
}
|
794
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
794
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user