mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-22 00:08:30 -04:00
Update vendor/golang.org/x/sys (#5059)
This commit is contained in:
parent
2af57c7820
commit
99c09dfbfa
258 changed files with 107543 additions and 29180 deletions
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
|
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)
|
10
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
10
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.
|
||||
|
||||
|
@ -116,7 +116,7 @@ func (p *Proc) Addr() uintptr {
|
|||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
|
||||
// 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.
|
||||
|
@ -160,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.
|
||||
|
@ -290,6 +289,7 @@ 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()
|
||||
|
@ -297,8 +297,8 @@ func (p *LazyProc) Addr() uintptr {
|
|||
|
||||
//go:uintptrescapes
|
||||
|
||||
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
|
||||
// are supplied.
|
||||
// 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
|
||||
|
|
15
vendor/golang.org/x/sys/windows/env_unset.go
generated
vendored
15
vendor/golang.org/x/sys/windows/env_unset.go
generated
vendored
|
@ -1,15 +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 windows
|
||||
// +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
|
||||
)
|
2
vendor/golang.org/x/sys/windows/mksyscall.go
generated
vendored
2
vendor/golang.org/x/sys/windows/mksyscall.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.
|
||||
|
||||
|
|
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
|
||||
|
|
2
vendor/golang.org/x/sys/windows/svc/go12.go
generated
vendored
2
vendor/golang.org/x/sys/windows/svc/go12.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
|
|
2
vendor/golang.org/x/sys/windows/svc/go13.go
generated
vendored
2
vendor/golang.org/x/sys/windows/svc/go13.go
generated
vendored
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2014 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
|
|
101
vendor/golang.org/x/sys/windows/svc/service.go
generated
vendored
101
vendor/golang.org/x/sys/windows/svc/service.go
generated
vendored
|
@ -35,11 +35,20 @@ const (
|
|||
type Cmd uint32
|
||||
|
||||
const (
|
||||
Stop = Cmd(windows.SERVICE_CONTROL_STOP)
|
||||
Pause = Cmd(windows.SERVICE_CONTROL_PAUSE)
|
||||
Continue = Cmd(windows.SERVICE_CONTROL_CONTINUE)
|
||||
Interrogate = Cmd(windows.SERVICE_CONTROL_INTERROGATE)
|
||||
Shutdown = Cmd(windows.SERVICE_CONTROL_SHUTDOWN)
|
||||
Stop = Cmd(windows.SERVICE_CONTROL_STOP)
|
||||
Pause = Cmd(windows.SERVICE_CONTROL_PAUSE)
|
||||
Continue = Cmd(windows.SERVICE_CONTROL_CONTINUE)
|
||||
Interrogate = Cmd(windows.SERVICE_CONTROL_INTERROGATE)
|
||||
Shutdown = Cmd(windows.SERVICE_CONTROL_SHUTDOWN)
|
||||
ParamChange = Cmd(windows.SERVICE_CONTROL_PARAMCHANGE)
|
||||
NetBindAdd = Cmd(windows.SERVICE_CONTROL_NETBINDADD)
|
||||
NetBindRemove = Cmd(windows.SERVICE_CONTROL_NETBINDREMOVE)
|
||||
NetBindEnable = Cmd(windows.SERVICE_CONTROL_NETBINDENABLE)
|
||||
NetBindDisable = Cmd(windows.SERVICE_CONTROL_NETBINDDISABLE)
|
||||
DeviceEvent = Cmd(windows.SERVICE_CONTROL_DEVICEEVENT)
|
||||
HardwareProfileChange = Cmd(windows.SERVICE_CONTROL_HARDWAREPROFILECHANGE)
|
||||
PowerEvent = Cmd(windows.SERVICE_CONTROL_POWEREVENT)
|
||||
SessionChange = Cmd(windows.SERVICE_CONTROL_SESSIONCHANGE)
|
||||
)
|
||||
|
||||
// Accepted is used to describe commands accepted by the service.
|
||||
|
@ -47,9 +56,14 @@ const (
|
|||
type Accepted uint32
|
||||
|
||||
const (
|
||||
AcceptStop = Accepted(windows.SERVICE_ACCEPT_STOP)
|
||||
AcceptShutdown = Accepted(windows.SERVICE_ACCEPT_SHUTDOWN)
|
||||
AcceptPauseAndContinue = Accepted(windows.SERVICE_ACCEPT_PAUSE_CONTINUE)
|
||||
AcceptStop = Accepted(windows.SERVICE_ACCEPT_STOP)
|
||||
AcceptShutdown = Accepted(windows.SERVICE_ACCEPT_SHUTDOWN)
|
||||
AcceptPauseAndContinue = Accepted(windows.SERVICE_ACCEPT_PAUSE_CONTINUE)
|
||||
AcceptParamChange = Accepted(windows.SERVICE_ACCEPT_PARAMCHANGE)
|
||||
AcceptNetBindChange = Accepted(windows.SERVICE_ACCEPT_NETBINDCHANGE)
|
||||
AcceptHardwareProfileChange = Accepted(windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE)
|
||||
AcceptPowerEvent = Accepted(windows.SERVICE_ACCEPT_POWEREVENT)
|
||||
AcceptSessionChange = Accepted(windows.SERVICE_ACCEPT_SESSIONCHANGE)
|
||||
)
|
||||
|
||||
// Status combines State and Accepted commands to fully describe running service.
|
||||
|
@ -63,6 +77,8 @@ type Status struct {
|
|||
// ChangeRequest is sent to the service Handler to request service status change.
|
||||
type ChangeRequest struct {
|
||||
Cmd Cmd
|
||||
EventType uint32
|
||||
EventData uintptr
|
||||
CurrentStatus Status
|
||||
}
|
||||
|
||||
|
@ -85,16 +101,16 @@ type Handler interface {
|
|||
|
||||
var (
|
||||
// These are used by asm code.
|
||||
goWaitsH uintptr
|
||||
cWaitsH uintptr
|
||||
ssHandle uintptr
|
||||
sName *uint16
|
||||
sArgc uintptr
|
||||
sArgv **uint16
|
||||
ctlHandlerProc uintptr
|
||||
cSetEvent uintptr
|
||||
cWaitForSingleObject uintptr
|
||||
cRegisterServiceCtrlHandlerW uintptr
|
||||
goWaitsH uintptr
|
||||
cWaitsH uintptr
|
||||
ssHandle uintptr
|
||||
sName *uint16
|
||||
sArgc uintptr
|
||||
sArgv **uint16
|
||||
ctlHandlerExProc uintptr
|
||||
cSetEvent uintptr
|
||||
cWaitForSingleObject uintptr
|
||||
cRegisterServiceCtrlHandlerExW uintptr
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -102,12 +118,16 @@ func init() {
|
|||
cSetEvent = k.MustFindProc("SetEvent").Addr()
|
||||
cWaitForSingleObject = k.MustFindProc("WaitForSingleObject").Addr()
|
||||
a := syscall.MustLoadDLL("advapi32.dll")
|
||||
cRegisterServiceCtrlHandlerW = a.MustFindProc("RegisterServiceCtrlHandlerW").Addr()
|
||||
cRegisterServiceCtrlHandlerExW = a.MustFindProc("RegisterServiceCtrlHandlerExW").Addr()
|
||||
}
|
||||
|
||||
// The HandlerEx prototype also has a context pointer but since we don't use
|
||||
// it at start-up time we don't have to pass it over either.
|
||||
type ctlEvent struct {
|
||||
cmd Cmd
|
||||
errno uint32
|
||||
cmd Cmd
|
||||
eventType uint32
|
||||
eventData uintptr
|
||||
errno uint32
|
||||
}
|
||||
|
||||
// service provides access to windows service api.
|
||||
|
@ -165,6 +185,21 @@ func (s *service) updateStatus(status *Status, ec *exitCode) error {
|
|||
if status.Accepts&AcceptPauseAndContinue != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_PAUSE_CONTINUE
|
||||
}
|
||||
if status.Accepts&AcceptParamChange != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_PARAMCHANGE
|
||||
}
|
||||
if status.Accepts&AcceptNetBindChange != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_NETBINDCHANGE
|
||||
}
|
||||
if status.Accepts&AcceptHardwareProfileChange != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_HARDWAREPROFILECHANGE
|
||||
}
|
||||
if status.Accepts&AcceptPowerEvent != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_POWEREVENT
|
||||
}
|
||||
if status.Accepts&AcceptSessionChange != 0 {
|
||||
t.ControlsAccepted |= windows.SERVICE_ACCEPT_SESSIONCHANGE
|
||||
}
|
||||
if ec.errno == 0 {
|
||||
t.Win32ExitCode = windows.NO_ERROR
|
||||
t.ServiceSpecificExitCode = windows.NO_ERROR
|
||||
|
@ -208,6 +243,8 @@ func (s *service) run() {
|
|||
var outch chan ChangeRequest
|
||||
inch := s.c
|
||||
var cmd Cmd
|
||||
var evtype uint32
|
||||
var evdata uintptr
|
||||
loop:
|
||||
for {
|
||||
select {
|
||||
|
@ -219,7 +256,9 @@ loop:
|
|||
inch = nil
|
||||
outch = cmdsToHandler
|
||||
cmd = r.cmd
|
||||
case outch <- ChangeRequest{cmd, status}:
|
||||
evtype = r.eventType
|
||||
evdata = r.eventData
|
||||
case outch <- ChangeRequest{cmd, evtype, evdata, status}:
|
||||
inch = s.c
|
||||
outch = nil
|
||||
case c := <-changesFromHandler:
|
||||
|
@ -276,8 +315,8 @@ func Run(name string, handler Handler) error {
|
|||
return err
|
||||
}
|
||||
|
||||
ctlHandler := func(ctl uint32) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl)}
|
||||
ctlHandler := func(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl), eventType: evtype, eventData: evdata}
|
||||
// We assume that this callback function is running on
|
||||
// the same thread as Run. Nowhere in MS documentation
|
||||
// I could find statement to guarantee that. So putting
|
||||
|
@ -288,20 +327,21 @@ func Run(name string, handler Handler) error {
|
|||
e.errno = sysErrNewThreadInCallback
|
||||
}
|
||||
s.c <- e
|
||||
// Always return NO_ERROR (0) for now.
|
||||
return 0
|
||||
}
|
||||
|
||||
var svcmain uintptr
|
||||
getServiceMain(&svcmain)
|
||||
t := []windows.SERVICE_TABLE_ENTRY{
|
||||
{syscall.StringToUTF16Ptr(s.name), svcmain},
|
||||
{nil, 0},
|
||||
{ServiceName: syscall.StringToUTF16Ptr(s.name), ServiceProc: svcmain},
|
||||
{ServiceName: nil, ServiceProc: 0},
|
||||
}
|
||||
|
||||
goWaitsH = uintptr(s.goWaits.h)
|
||||
cWaitsH = uintptr(s.cWaits.h)
|
||||
sName = t[0].ServiceName
|
||||
ctlHandlerProc, err = newCallback(ctlHandler)
|
||||
ctlHandlerExProc, err = newCallback(ctlHandler)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -314,3 +354,10 @@ func Run(name string, handler Handler) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// StatusHandle returns service status handle. It is safe to call this function
|
||||
// from inside the Handler.Execute because then it is guaranteed to be set.
|
||||
// This code will have to change once multiple services are possible per process.
|
||||
func StatusHandle() windows.Handle {
|
||||
return windows.Handle(ssHandle)
|
||||
}
|
||||
|
|
7
vendor/golang.org/x/sys/windows/svc/sys_386.s
generated
vendored
7
vendor/golang.org/x/sys/windows/svc/sys_386.s
generated
vendored
|
@ -22,7 +22,8 @@ TEXT ·servicemain(SB),7,$0
|
|||
MOVL AX, (SP)
|
||||
MOVL $·servicectlhandler(SB), AX
|
||||
MOVL AX, 4(SP)
|
||||
MOVL ·cRegisterServiceCtrlHandlerW(SB), AX
|
||||
MOVL $0, 8(SP)
|
||||
MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX
|
||||
MOVL SP, BP
|
||||
CALL AX
|
||||
MOVL BP, SP
|
||||
|
@ -61,7 +62,7 @@ exit:
|
|||
// I do not know why, but this seems to be the only way to call
|
||||
// ctlHandlerProc on Windows 7.
|
||||
|
||||
// func servicectlhandler(ctl uint32) uintptr
|
||||
// func servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
||||
TEXT ·servicectlhandler(SB),7,$0
|
||||
MOVL ·ctlHandlerProc(SB), CX
|
||||
MOVL ·ctlHandlerExProc(SB), CX
|
||||
JMP CX
|
||||
|
|
9
vendor/golang.org/x/sys/windows/svc/sys_amd64.s
generated
vendored
9
vendor/golang.org/x/sys/windows/svc/sys_amd64.s
generated
vendored
|
@ -7,13 +7,14 @@
|
|||
// func servicemain(argc uint32, argv **uint16)
|
||||
TEXT ·servicemain(SB),7,$0
|
||||
MOVL CX, ·sArgc(SB)
|
||||
MOVL DX, ·sArgv(SB)
|
||||
MOVQ DX, ·sArgv(SB)
|
||||
|
||||
SUBQ $32, SP // stack for the first 4 syscall params
|
||||
|
||||
MOVQ ·sName(SB), CX
|
||||
MOVQ $·servicectlhandler(SB), DX
|
||||
MOVQ ·cRegisterServiceCtrlHandlerW(SB), AX
|
||||
// BUG(pastarmovj): Figure out a way to pass in context in R8.
|
||||
MOVQ ·cRegisterServiceCtrlHandlerExW(SB), AX
|
||||
CALL AX
|
||||
CMPQ AX, $0
|
||||
JE exit
|
||||
|
@ -35,7 +36,7 @@ exit:
|
|||
// I do not know why, but this seems to be the only way to call
|
||||
// ctlHandlerProc on Windows 7.
|
||||
|
||||
// func servicectlhandler(ctl uint32) uintptr
|
||||
// func ·servicectlhandler(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
||||
TEXT ·servicectlhandler(SB),7,$0
|
||||
MOVQ ·ctlHandlerProc(SB), AX
|
||||
MOVQ ·ctlHandlerExProc(SB), AX
|
||||
JMP AX
|
||||
|
|
38
vendor/golang.org/x/sys/windows/svc/sys_arm.s
generated
vendored
Normal file
38
vendor/golang.org/x/sys/windows/svc/sys_arm.s
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
// 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
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// func servicemain(argc uint32, argv **uint16)
|
||||
TEXT ·servicemain(SB),NOSPLIT|NOFRAME,$0
|
||||
MOVM.DB.W [R4, R14], (R13) // push {r4, lr}
|
||||
MOVW R13, R4
|
||||
BIC $0x7, R13 // alignment for ABI
|
||||
|
||||
MOVW R0, ·sArgc(SB)
|
||||
MOVW R1, ·sArgv(SB)
|
||||
|
||||
MOVW ·sName(SB), R0
|
||||
MOVW ·ctlHandlerExProc(SB), R1
|
||||
MOVW $0, R2
|
||||
MOVW ·cRegisterServiceCtrlHandlerExW(SB), R3
|
||||
BL (R3)
|
||||
CMP $0, R0
|
||||
BEQ exit
|
||||
MOVW R0, ·ssHandle(SB)
|
||||
|
||||
MOVW ·goWaitsH(SB), R0
|
||||
MOVW ·cSetEvent(SB), R1
|
||||
BL (R1)
|
||||
|
||||
MOVW ·cWaitsH(SB), R0
|
||||
MOVW $-1, R1
|
||||
MOVW ·cWaitForSingleObject(SB), R2
|
||||
BL (R2)
|
||||
|
||||
exit:
|
||||
MOVW R4, R13 // free extra stack space
|
||||
MOVM.IA.W (R13), [R4, R15] // pop {r4, pc}
|
9
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
9
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
|
@ -5,17 +5,20 @@
|
|||
// +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.
|
||||
|
|
248
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
248
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.
|
||||
|
||||
|
@ -16,7 +16,46 @@ import (
|
|||
|
||||
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
|
||||
|
@ -71,12 +110,19 @@ 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
|
||||
|
||||
|
@ -93,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)
|
||||
|
@ -109,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)
|
||||
|
@ -152,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
|
||||
|
@ -171,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
|
||||
|
@ -181,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 {
|
||||
|
@ -311,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
|
||||
}
|
||||
|
@ -484,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()
|
||||
}
|
||||
|
@ -558,7 +655,7 @@ type RawSockaddr struct {
|
|||
|
||||
type RawSockaddrAny struct {
|
||||
Addr RawSockaddr
|
||||
Pad [96]int8
|
||||
Pad [100]int8
|
||||
}
|
||||
|
||||
type Sockaddr interface {
|
||||
|
@ -607,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))
|
||||
|
@ -761,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.
|
||||
|
|
@ -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.
|
||||
|
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
|
||||
}
|
745
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
745
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue