mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-07 11:06:36 +00:00
Switch to go modules
This commit is contained in:
committed by
Calle Pettersson
parent
de285e1043
commit
0d4f747f8f
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)
|
||||
8
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
8
vendor/golang.org/x/sys/windows/dll_windows.go
generated
vendored
@@ -359,11 +359,11 @@ func loadLibraryEx(name string, system bool) (*DLL, error) {
|
||||
// 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")
|
||||
systemdir, err := GetSystemDirectory()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
loadDLL = windir + "\\System32\\" + name
|
||||
loadDLL = systemdir + "\\" + name
|
||||
}
|
||||
}
|
||||
h, err := LoadLibraryEx(loadDLL, 0, flags)
|
||||
|
||||
64
vendor/golang.org/x/sys/windows/mkerrors.bash
generated
vendored
Normal file
64
vendor/golang.org/x/sys/windows/mkerrors.bash
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
set -e
|
||||
shopt -s nullglob
|
||||
|
||||
[[ $# -eq 1 ]] || { echo "Usage: $0 OUTPUT_FILE.go" >&2; exit 1; }
|
||||
winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)"
|
||||
[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; }
|
||||
|
||||
declare -A errors
|
||||
|
||||
{
|
||||
echo "// Code generated by 'go generate'; DO NOT EDIT."
|
||||
echo
|
||||
echo "package windows"
|
||||
echo "import \"syscall\""
|
||||
echo "const ("
|
||||
|
||||
while read -r line; do
|
||||
unset vtype
|
||||
if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
vtype="${BASH_REMATCH[2]}"
|
||||
elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then
|
||||
key="${BASH_REMATCH[1]}"
|
||||
value="${BASH_REMATCH[3]}"
|
||||
vtype="${BASH_REMATCH[2]}"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
[[ -n $key && -n $value ]] || continue
|
||||
[[ -z ${errors["$key"]} ]] || continue
|
||||
errors["$key"]="$value"
|
||||
if [[ -v vtype ]]; then
|
||||
if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then
|
||||
vtype=""
|
||||
elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then
|
||||
vtype="Handle"
|
||||
else
|
||||
vtype="syscall.Errno"
|
||||
fi
|
||||
last_vtype="$vtype"
|
||||
else
|
||||
vtype=""
|
||||
if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then
|
||||
value="S_OK"
|
||||
elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then
|
||||
value="ERROR_SUCCESS"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$key $vtype = $value"
|
||||
done < "$winerror"
|
||||
|
||||
echo ")"
|
||||
} | gofmt > "$1"
|
||||
7
vendor/golang.org/x/sys/windows/mkerrors.go
generated
vendored
Normal file
7
vendor/golang.org/x/sys/windows/mkerrors.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package windows
|
||||
|
||||
//go:generate ./mkerrors.bash zerrors_windows.go
|
||||
2
vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go
generated
vendored
2
vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
|
||||
// Code generated by 'go generate'; DO NOT EDIT.
|
||||
|
||||
package registry
|
||||
|
||||
|
||||
177
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
177
vendor/golang.org/x/sys/windows/security_windows.go
generated
vendored
@@ -149,7 +149,7 @@ const (
|
||||
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_MONITORING_USERS = 0x22e
|
||||
DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f
|
||||
DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230
|
||||
DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231
|
||||
@@ -169,6 +169,7 @@ const (
|
||||
//sys GetLengthSid(sid *SID) (len uint32) = advapi32.GetLengthSid
|
||||
//sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid
|
||||
//sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid
|
||||
//sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid
|
||||
//sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid
|
||||
//sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid
|
||||
|
||||
@@ -286,6 +287,158 @@ func (sid *SID) LookupAccount(system string) (account, domain string, accType ui
|
||||
}
|
||||
}
|
||||
|
||||
// Various types of pre-specified sids that can be synthesized at runtime.
|
||||
type WELL_KNOWN_SID_TYPE uint32
|
||||
|
||||
const (
|
||||
WinNullSid = 0
|
||||
WinWorldSid = 1
|
||||
WinLocalSid = 2
|
||||
WinCreatorOwnerSid = 3
|
||||
WinCreatorGroupSid = 4
|
||||
WinCreatorOwnerServerSid = 5
|
||||
WinCreatorGroupServerSid = 6
|
||||
WinNtAuthoritySid = 7
|
||||
WinDialupSid = 8
|
||||
WinNetworkSid = 9
|
||||
WinBatchSid = 10
|
||||
WinInteractiveSid = 11
|
||||
WinServiceSid = 12
|
||||
WinAnonymousSid = 13
|
||||
WinProxySid = 14
|
||||
WinEnterpriseControllersSid = 15
|
||||
WinSelfSid = 16
|
||||
WinAuthenticatedUserSid = 17
|
||||
WinRestrictedCodeSid = 18
|
||||
WinTerminalServerSid = 19
|
||||
WinRemoteLogonIdSid = 20
|
||||
WinLogonIdsSid = 21
|
||||
WinLocalSystemSid = 22
|
||||
WinLocalServiceSid = 23
|
||||
WinNetworkServiceSid = 24
|
||||
WinBuiltinDomainSid = 25
|
||||
WinBuiltinAdministratorsSid = 26
|
||||
WinBuiltinUsersSid = 27
|
||||
WinBuiltinGuestsSid = 28
|
||||
WinBuiltinPowerUsersSid = 29
|
||||
WinBuiltinAccountOperatorsSid = 30
|
||||
WinBuiltinSystemOperatorsSid = 31
|
||||
WinBuiltinPrintOperatorsSid = 32
|
||||
WinBuiltinBackupOperatorsSid = 33
|
||||
WinBuiltinReplicatorSid = 34
|
||||
WinBuiltinPreWindows2000CompatibleAccessSid = 35
|
||||
WinBuiltinRemoteDesktopUsersSid = 36
|
||||
WinBuiltinNetworkConfigurationOperatorsSid = 37
|
||||
WinAccountAdministratorSid = 38
|
||||
WinAccountGuestSid = 39
|
||||
WinAccountKrbtgtSid = 40
|
||||
WinAccountDomainAdminsSid = 41
|
||||
WinAccountDomainUsersSid = 42
|
||||
WinAccountDomainGuestsSid = 43
|
||||
WinAccountComputersSid = 44
|
||||
WinAccountControllersSid = 45
|
||||
WinAccountCertAdminsSid = 46
|
||||
WinAccountSchemaAdminsSid = 47
|
||||
WinAccountEnterpriseAdminsSid = 48
|
||||
WinAccountPolicyAdminsSid = 49
|
||||
WinAccountRasAndIasServersSid = 50
|
||||
WinNTLMAuthenticationSid = 51
|
||||
WinDigestAuthenticationSid = 52
|
||||
WinSChannelAuthenticationSid = 53
|
||||
WinThisOrganizationSid = 54
|
||||
WinOtherOrganizationSid = 55
|
||||
WinBuiltinIncomingForestTrustBuildersSid = 56
|
||||
WinBuiltinPerfMonitoringUsersSid = 57
|
||||
WinBuiltinPerfLoggingUsersSid = 58
|
||||
WinBuiltinAuthorizationAccessSid = 59
|
||||
WinBuiltinTerminalServerLicenseServersSid = 60
|
||||
WinBuiltinDCOMUsersSid = 61
|
||||
WinBuiltinIUsersSid = 62
|
||||
WinIUserSid = 63
|
||||
WinBuiltinCryptoOperatorsSid = 64
|
||||
WinUntrustedLabelSid = 65
|
||||
WinLowLabelSid = 66
|
||||
WinMediumLabelSid = 67
|
||||
WinHighLabelSid = 68
|
||||
WinSystemLabelSid = 69
|
||||
WinWriteRestrictedCodeSid = 70
|
||||
WinCreatorOwnerRightsSid = 71
|
||||
WinCacheablePrincipalsGroupSid = 72
|
||||
WinNonCacheablePrincipalsGroupSid = 73
|
||||
WinEnterpriseReadonlyControllersSid = 74
|
||||
WinAccountReadonlyControllersSid = 75
|
||||
WinBuiltinEventLogReadersGroup = 76
|
||||
WinNewEnterpriseReadonlyControllersSid = 77
|
||||
WinBuiltinCertSvcDComAccessGroup = 78
|
||||
WinMediumPlusLabelSid = 79
|
||||
WinLocalLogonSid = 80
|
||||
WinConsoleLogonSid = 81
|
||||
WinThisOrganizationCertificateSid = 82
|
||||
WinApplicationPackageAuthoritySid = 83
|
||||
WinBuiltinAnyPackageSid = 84
|
||||
WinCapabilityInternetClientSid = 85
|
||||
WinCapabilityInternetClientServerSid = 86
|
||||
WinCapabilityPrivateNetworkClientServerSid = 87
|
||||
WinCapabilityPicturesLibrarySid = 88
|
||||
WinCapabilityVideosLibrarySid = 89
|
||||
WinCapabilityMusicLibrarySid = 90
|
||||
WinCapabilityDocumentsLibrarySid = 91
|
||||
WinCapabilitySharedUserCertificatesSid = 92
|
||||
WinCapabilityEnterpriseAuthenticationSid = 93
|
||||
WinCapabilityRemovableStorageSid = 94
|
||||
WinBuiltinRDSRemoteAccessServersSid = 95
|
||||
WinBuiltinRDSEndpointServersSid = 96
|
||||
WinBuiltinRDSManagementServersSid = 97
|
||||
WinUserModeDriversSid = 98
|
||||
WinBuiltinHyperVAdminsSid = 99
|
||||
WinAccountCloneableControllersSid = 100
|
||||
WinBuiltinAccessControlAssistanceOperatorsSid = 101
|
||||
WinBuiltinRemoteManagementUsersSid = 102
|
||||
WinAuthenticationAuthorityAssertedSid = 103
|
||||
WinAuthenticationServiceAssertedSid = 104
|
||||
WinLocalAccountSid = 105
|
||||
WinLocalAccountAndAdministratorSid = 106
|
||||
WinAccountProtectedUsersSid = 107
|
||||
WinCapabilityAppointmentsSid = 108
|
||||
WinCapabilityContactsSid = 109
|
||||
WinAccountDefaultSystemManagedSid = 110
|
||||
WinBuiltinDefaultSystemManagedGroupSid = 111
|
||||
WinBuiltinStorageReplicaAdminsSid = 112
|
||||
WinAccountKeyAdminsSid = 113
|
||||
WinAccountEnterpriseKeyAdminsSid = 114
|
||||
WinAuthenticationKeyTrustSid = 115
|
||||
WinAuthenticationKeyPropertyMFASid = 116
|
||||
WinAuthenticationKeyPropertyAttestationSid = 117
|
||||
WinAuthenticationFreshKeyAuthSid = 118
|
||||
WinBuiltinDeviceOwnersSid = 119
|
||||
)
|
||||
|
||||
// Creates a sid for a well-known predefined alias, generally using the constants of the form
|
||||
// Win*Sid, for the local machine.
|
||||
func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) {
|
||||
return CreateWellKnownDomainSid(sidType, nil)
|
||||
}
|
||||
|
||||
// Creates a sid for a well-known predefined alias, generally using the constants of the form
|
||||
// Win*Sid, for the domain specified by the domainSid parameter.
|
||||
func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) {
|
||||
n := uint32(50)
|
||||
for {
|
||||
b := make([]byte, n)
|
||||
sid := (*SID)(unsafe.Pointer(&b[0]))
|
||||
err := createWellKnownSid(sidType, domainSid, sid, &n)
|
||||
if err == nil {
|
||||
return sid, nil
|
||||
}
|
||||
if err != ERROR_INSUFFICIENT_BUFFER {
|
||||
return nil, err
|
||||
}
|
||||
if n <= uint32(len(b)) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
// do not reorder
|
||||
TOKEN_ASSIGN_PRIMARY = 1 << iota
|
||||
@@ -296,6 +449,7 @@ const (
|
||||
TOKEN_ADJUST_PRIVILEGES
|
||||
TOKEN_ADJUST_GROUPS
|
||||
TOKEN_ADJUST_DEFAULT
|
||||
TOKEN_ADJUST_SESSIONID
|
||||
|
||||
TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |
|
||||
TOKEN_ASSIGN_PRIMARY |
|
||||
@@ -305,7 +459,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 |
|
||||
@@ -370,6 +525,7 @@ type Tokengroups struct {
|
||||
//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
|
||||
//sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW
|
||||
|
||||
// An access token contains the security information for a logon session.
|
||||
// The system creates an access token when a user logs on, and every
|
||||
@@ -466,6 +622,23 @@ func (t Token) GetUserProfileDirectory() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetSystemDirectory retrieves path to current location of the system
|
||||
// directory, which is typically, though not always, C:\Windows\System32.
|
||||
func GetSystemDirectory() (string, error) {
|
||||
n := uint32(MAX_PATH)
|
||||
for {
|
||||
b := make([]uint16, n)
|
||||
l, e := getSystemDirectory(&b[0], n)
|
||||
if e != nil {
|
||||
return "", e
|
||||
}
|
||||
if l <= n {
|
||||
return UTF16ToString(b[:l]), nil
|
||||
}
|
||||
n = l
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
21
vendor/golang.org/x/sys/windows/service.go
generated
vendored
21
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
|
||||
@@ -94,8 +99,6 @@ const (
|
||||
SERVICE_CONFIG_DESCRIPTION = 1
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS = 2
|
||||
|
||||
NO_ERROR = 0
|
||||
|
||||
SC_ENUM_PROCESS_INFO = 0
|
||||
)
|
||||
|
||||
@@ -148,6 +151,19 @@ type ENUM_SERVICE_STATUS_PROCESS struct {
|
||||
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
|
||||
@@ -162,3 +178,4 @@ type ENUM_SERVICE_STATUS_PROCESS struct {
|
||||
//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
|
||||
|
||||
43
vendor/golang.org/x/sys/windows/svc/service.go
generated
vendored
43
vendor/golang.org/x/sys/windows/svc/service.go
generated
vendored
@@ -72,6 +72,7 @@ type Status struct {
|
||||
Accepts Accepted
|
||||
CheckPoint uint32 // used to report progress during a lengthy operation
|
||||
WaitHint uint32 // estimated time required for a pending operation, in milliseconds
|
||||
ProcessId uint32 // if the service is running, the process identifier of it, and otherwise zero
|
||||
}
|
||||
|
||||
// ChangeRequest is sent to the service Handler to request service status change.
|
||||
@@ -80,6 +81,7 @@ type ChangeRequest struct {
|
||||
EventType uint32
|
||||
EventData uintptr
|
||||
CurrentStatus Status
|
||||
Context uintptr
|
||||
}
|
||||
|
||||
// Handler is the interface that must be implemented to build Windows service.
|
||||
@@ -114,19 +116,18 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
k := syscall.MustLoadDLL("kernel32.dll")
|
||||
cSetEvent = k.MustFindProc("SetEvent").Addr()
|
||||
cWaitForSingleObject = k.MustFindProc("WaitForSingleObject").Addr()
|
||||
a := syscall.MustLoadDLL("advapi32.dll")
|
||||
cRegisterServiceCtrlHandlerExW = a.MustFindProc("RegisterServiceCtrlHandlerExW").Addr()
|
||||
k := windows.NewLazySystemDLL("kernel32.dll")
|
||||
cSetEvent = k.NewProc("SetEvent").Addr()
|
||||
cWaitForSingleObject = k.NewProc("WaitForSingleObject").Addr()
|
||||
a := windows.NewLazySystemDLL("advapi32.dll")
|
||||
cRegisterServiceCtrlHandlerExW = a.NewProc("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
|
||||
eventType uint32
|
||||
eventData uintptr
|
||||
context uintptr
|
||||
errno uint32
|
||||
}
|
||||
|
||||
@@ -238,13 +239,12 @@ func (s *service) run() {
|
||||
exitFromHandler <- exitCode{ss, errno}
|
||||
}()
|
||||
|
||||
status := Status{State: Stopped}
|
||||
ec := exitCode{isSvcSpecific: true, errno: 0}
|
||||
outcr := ChangeRequest{
|
||||
CurrentStatus: Status{State: Stopped},
|
||||
}
|
||||
var outch chan ChangeRequest
|
||||
inch := s.c
|
||||
var cmd Cmd
|
||||
var evtype uint32
|
||||
var evdata uintptr
|
||||
loop:
|
||||
for {
|
||||
select {
|
||||
@@ -255,10 +255,11 @@ loop:
|
||||
}
|
||||
inch = nil
|
||||
outch = cmdsToHandler
|
||||
cmd = r.cmd
|
||||
evtype = r.eventType
|
||||
evdata = r.eventData
|
||||
case outch <- ChangeRequest{cmd, evtype, evdata, status}:
|
||||
outcr.Cmd = r.cmd
|
||||
outcr.EventType = r.eventType
|
||||
outcr.EventData = r.eventData
|
||||
outcr.Context = r.context
|
||||
case outch <- outcr:
|
||||
inch = s.c
|
||||
outch = nil
|
||||
case c := <-changesFromHandler:
|
||||
@@ -271,7 +272,7 @@ loop:
|
||||
}
|
||||
break loop
|
||||
}
|
||||
status = c
|
||||
outcr.CurrentStatus = c
|
||||
case ec = <-exitFromHandler:
|
||||
break loop
|
||||
}
|
||||
@@ -315,8 +316,8 @@ func Run(name string, handler Handler) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ctlHandler := func(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl), eventType: evtype, eventData: evdata}
|
||||
ctlHandler := func(ctl, evtype, evdata, context uintptr) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl), eventType: uint32(evtype), eventData: evdata, context: context}
|
||||
// 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
|
||||
@@ -328,14 +329,14 @@ func Run(name string, handler Handler) error {
|
||||
}
|
||||
s.c <- e
|
||||
// Always return NO_ERROR (0) for now.
|
||||
return 0
|
||||
return windows.NO_ERROR
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
3
vendor/golang.org/x/sys/windows/svc/sys_386.s
generated
vendored
3
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 $0, 8(SP)
|
||||
// Set context to 123456 to test issue #25660.
|
||||
MOVL $123456, 8(SP)
|
||||
MOVL ·cRegisterServiceCtrlHandlerExW(SB), AX
|
||||
MOVL SP, BP
|
||||
CALL AX
|
||||
|
||||
4
vendor/golang.org/x/sys/windows/svc/sys_amd64.s
generated
vendored
4
vendor/golang.org/x/sys/windows/svc/sys_amd64.s
generated
vendored
@@ -7,13 +7,15 @@
|
||||
// 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
|
||||
// BUG(pastarmovj): Figure out a way to pass in context in R8.
|
||||
// Set context to 123456 to test issue #25660.
|
||||
MOVQ $123456, R8
|
||||
MOVQ ·cRegisterServiceCtrlHandlerExW(SB), AX
|
||||
CALL AX
|
||||
CMPQ AX, $0
|
||||
|
||||
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}
|
||||
3
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
3
vendor/golang.org/x/sys/windows/syscall.go
generated
vendored
@@ -11,11 +11,14 @@
|
||||
// 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.
|
||||
|
||||
80
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
80
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@@ -112,12 +112,14 @@ func Getpagesize() int { return 4096 }
|
||||
|
||||
// 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)
|
||||
}
|
||||
@@ -132,9 +134,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys GetVersion() (ver uint32, err error)
|
||||
//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW
|
||||
//sys ExitProcess(exitcode uint32)
|
||||
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
|
||||
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
|
||||
//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
||||
//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
|
||||
//sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (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 uint32) (handle Handle, err error) [failretval==InvalidHandle]
|
||||
@@ -143,6 +146,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW
|
||||
//sys FindClose(handle Handle) (err error)
|
||||
//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)
|
||||
//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error)
|
||||
//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW
|
||||
//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW
|
||||
//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW
|
||||
@@ -170,6 +174,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
|
||||
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
|
||||
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
|
||||
//sys waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] = WaitForMultipleObjects
|
||||
//sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW
|
||||
//sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error)
|
||||
//sys GetFileType(filehandle Handle) (n uint32, err error)
|
||||
@@ -556,9 +561,6 @@ func Fsync(fd Handle) (err error) {
|
||||
}
|
||||
|
||||
func Chmod(path string, mode uint32) (err error) {
|
||||
if mode == 0 {
|
||||
return syscall.EINVAL
|
||||
}
|
||||
p, e := UTF16PtrFromString(path)
|
||||
if e != nil {
|
||||
return e
|
||||
@@ -587,6 +589,18 @@ func LoadSetFileCompletionNotificationModes() error {
|
||||
return procSetFileCompletionNotificationModes.Find()
|
||||
}
|
||||
|
||||
func WaitForMultipleObjects(handles []Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
|
||||
// Every other win32 array API takes arguments as "pointer, count", except for this function. So we
|
||||
// can't declare it as a usual [] type, because mksyscall will use the opposite order. We therefore
|
||||
// trivially stub this ourselves.
|
||||
|
||||
var handlePtr *Handle
|
||||
if len(handles) > 0 {
|
||||
handlePtr = &handles[0]
|
||||
}
|
||||
return waitForMultipleObjects(uint32(len(handles)), uintptr(unsafe.Pointer(handlePtr)), waitAll, waitMilliseconds)
|
||||
}
|
||||
|
||||
// net api calls
|
||||
|
||||
const socket_error = uintptr(^uint32(0))
|
||||
@@ -653,7 +667,7 @@ type RawSockaddr struct {
|
||||
|
||||
type RawSockaddrAny struct {
|
||||
Addr RawSockaddr
|
||||
Pad [96]int8
|
||||
Pad [100]int8
|
||||
}
|
||||
|
||||
type Sockaddr interface {
|
||||
@@ -702,19 +716,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))
|
||||
|
||||
230
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
230
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
@@ -6,33 +6,6 @@ package windows
|
||||
|
||||
import "syscall"
|
||||
|
||||
const (
|
||||
// Windows errors.
|
||||
ERROR_FILE_NOT_FOUND syscall.Errno = 2
|
||||
ERROR_PATH_NOT_FOUND syscall.Errno = 3
|
||||
ERROR_ACCESS_DENIED syscall.Errno = 5
|
||||
ERROR_NO_MORE_FILES syscall.Errno = 18
|
||||
ERROR_HANDLE_EOF syscall.Errno = 38
|
||||
ERROR_NETNAME_DELETED syscall.Errno = 64
|
||||
ERROR_FILE_EXISTS syscall.Errno = 80
|
||||
ERROR_BROKEN_PIPE syscall.Errno = 109
|
||||
ERROR_BUFFER_OVERFLOW syscall.Errno = 111
|
||||
ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122
|
||||
ERROR_MOD_NOT_FOUND syscall.Errno = 126
|
||||
ERROR_PROC_NOT_FOUND syscall.Errno = 127
|
||||
ERROR_ALREADY_EXISTS syscall.Errno = 183
|
||||
ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203
|
||||
ERROR_MORE_DATA syscall.Errno = 234
|
||||
ERROR_OPERATION_ABORTED syscall.Errno = 995
|
||||
ERROR_IO_PENDING syscall.Errno = 997
|
||||
ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066
|
||||
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
|
||||
)
|
||||
|
||||
const (
|
||||
// Invented values to support what package os expects.
|
||||
O_RDONLY = 0x00000
|
||||
@@ -94,16 +67,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
|
||||
|
||||
@@ -113,9 +99,19 @@ const (
|
||||
OPEN_ALWAYS = 4
|
||||
TRUNCATE_EXISTING = 5
|
||||
|
||||
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
|
||||
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
|
||||
FILE_FLAG_OVERLAPPED = 0x40000000
|
||||
FILE_FLAG_OPEN_REQUIRING_OPLOCK = 0x00040000
|
||||
FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000
|
||||
FILE_FLAG_OPEN_NO_RECALL = 0x00100000
|
||||
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
|
||||
FILE_FLAG_SESSION_AWARE = 0x00800000
|
||||
FILE_FLAG_POSIX_SEMANTICS = 0x01000000
|
||||
FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
|
||||
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
|
||||
FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000
|
||||
FILE_FLAG_RANDOM_ACCESS = 0x10000000
|
||||
FILE_FLAG_NO_BUFFERING = 0x20000000
|
||||
FILE_FLAG_OVERLAPPED = 0x40000000
|
||||
FILE_FLAG_WRITE_THROUGH = 0x80000000
|
||||
|
||||
HANDLE_FLAG_INHERIT = 0x00000001
|
||||
STARTF_USESTDHANDLES = 0x00000100
|
||||
@@ -154,7 +150,6 @@ const (
|
||||
IGNORE = 0
|
||||
INFINITE = 0xffffffff
|
||||
|
||||
WAIT_TIMEOUT = 258
|
||||
WAIT_ABANDONED = 0x00000080
|
||||
WAIT_OBJECT_0 = 0x00000000
|
||||
WAIT_FAILED = 0xFFFFFFFF
|
||||
@@ -257,15 +252,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
|
||||
@@ -282,11 +349,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
|
||||
@@ -295,15 +382,18 @@ 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
|
||||
CERT_E_PURPOSE = 0x800B0106
|
||||
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 (
|
||||
@@ -312,6 +402,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
|
||||
@@ -727,10 +825,6 @@ const (
|
||||
DNS_TYPE_NBSTAT = 0xff01
|
||||
)
|
||||
|
||||
const (
|
||||
DNS_INFO_NO_RECORDS = 0x251D
|
||||
)
|
||||
|
||||
const (
|
||||
// flags inside DNSRecord.Dw
|
||||
DnsSectionQuestion = 0x0000
|
||||
@@ -880,11 +974,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
|
||||
}
|
||||
|
||||
@@ -899,12 +997,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
|
||||
}
|
||||
@@ -919,14 +1021,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 {
|
||||
@@ -957,7 +1063,7 @@ type CertChainPara struct {
|
||||
type CertChainPolicyPara struct {
|
||||
Size uint32
|
||||
Flags uint32
|
||||
ExtraPolicyPara uintptr
|
||||
ExtraPolicyPara Pointer
|
||||
}
|
||||
|
||||
type SSLExtraCertChainPolicyPara struct {
|
||||
@@ -972,7 +1078,7 @@ type CertChainPolicyStatus struct {
|
||||
Error uint32
|
||||
ChainIndex uint32
|
||||
ElementIndex uint32
|
||||
ExtraPolicyStatus uintptr
|
||||
ExtraPolicyStatus Pointer
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -1319,7 +1425,7 @@ type SmallRect struct {
|
||||
Bottom int16
|
||||
}
|
||||
|
||||
// Used with GetConsoleScreenBuffer to retreive information about a console
|
||||
// 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.
|
||||
@@ -1331,3 +1437,5 @@ type ConsoleScreenBufferInfo struct {
|
||||
Window SmallRect
|
||||
MaximumWindowSize Coord
|
||||
}
|
||||
|
||||
const UNIX_PATH_MAX = 108 // defined in afunix.h
|
||||
|
||||
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
|
||||
}
|
||||
6853
vendor/golang.org/x/sys/windows/zerrors_windows.go
generated
vendored
Normal file
6853
vendor/golang.org/x/sys/windows/zerrors_windows.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
96
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
96
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
|
||||
// Code generated by 'go generate'; DO NOT EDIT.
|
||||
|
||||
package windows
|
||||
|
||||
@@ -65,6 +65,7 @@ var (
|
||||
procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W")
|
||||
procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
|
||||
procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
|
||||
procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
|
||||
procGetLastError = modkernel32.NewProc("GetLastError")
|
||||
procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
|
||||
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
|
||||
@@ -76,6 +77,7 @@ var (
|
||||
procCreateFileW = modkernel32.NewProc("CreateFileW")
|
||||
procReadFile = modkernel32.NewProc("ReadFile")
|
||||
procWriteFile = modkernel32.NewProc("WriteFile")
|
||||
procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
|
||||
procSetFilePointer = modkernel32.NewProc("SetFilePointer")
|
||||
procCloseHandle = modkernel32.NewProc("CloseHandle")
|
||||
procGetStdHandle = modkernel32.NewProc("GetStdHandle")
|
||||
@@ -84,6 +86,7 @@ var (
|
||||
procFindNextFileW = modkernel32.NewProc("FindNextFileW")
|
||||
procFindClose = modkernel32.NewProc("FindClose")
|
||||
procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
|
||||
procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
|
||||
procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
|
||||
procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
|
||||
procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
|
||||
@@ -111,6 +114,7 @@ var (
|
||||
procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
|
||||
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
|
||||
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
|
||||
procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
|
||||
procGetTempPathW = modkernel32.NewProc("GetTempPathW")
|
||||
procCreatePipe = modkernel32.NewProc("CreatePipe")
|
||||
procGetFileType = modkernel32.NewProc("GetFileType")
|
||||
@@ -244,12 +248,14 @@ var (
|
||||
procGetLengthSid = modadvapi32.NewProc("GetLengthSid")
|
||||
procCopySid = modadvapi32.NewProc("CopySid")
|
||||
procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
|
||||
procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
|
||||
procFreeSid = modadvapi32.NewProc("FreeSid")
|
||||
procEqualSid = modadvapi32.NewProc("EqualSid")
|
||||
procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership")
|
||||
procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
|
||||
procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
|
||||
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
|
||||
procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
|
||||
)
|
||||
|
||||
func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
|
||||
@@ -472,6 +478,18 @@ func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serv
|
||||
return
|
||||
}
|
||||
|
||||
func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
|
||||
if r1 == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetLastError() (lasterr error) {
|
||||
r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
|
||||
if r0 != 0 {
|
||||
@@ -593,7 +611,7 @@ func ExitProcess(exitcode uint32) {
|
||||
return
|
||||
}
|
||||
|
||||
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) {
|
||||
func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
|
||||
r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
|
||||
handle = Handle(r0)
|
||||
if handle == InvalidHandle {
|
||||
@@ -638,6 +656,24 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped)
|
||||
return
|
||||
}
|
||||
|
||||
func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
|
||||
var _p0 uint32
|
||||
if wait {
|
||||
_p0 = 1
|
||||
} else {
|
||||
_p0 = 0
|
||||
}
|
||||
r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
|
||||
if r1 == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
|
||||
newlowoffset = uint32(r0)
|
||||
@@ -737,6 +773,18 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e
|
||||
return
|
||||
}
|
||||
|
||||
func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
|
||||
if r1 == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
|
||||
n = uint32(r0)
|
||||
@@ -1071,6 +1119,25 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32,
|
||||
return
|
||||
}
|
||||
|
||||
func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
|
||||
var _p0 uint32
|
||||
if waitAll {
|
||||
_p0 = 1
|
||||
} else {
|
||||
_p0 = 0
|
||||
}
|
||||
r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
|
||||
event = uint32(r0)
|
||||
if event == 0xffffffff {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
|
||||
n = uint32(r0)
|
||||
@@ -2620,6 +2687,18 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s
|
||||
return
|
||||
}
|
||||
|
||||
func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
|
||||
if r1 == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func FreeSid(sid *SID) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
||||
if r1 != 0 {
|
||||
@@ -2685,3 +2764,16 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
|
||||
r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
|
||||
len = uint32(r0)
|
||||
if len == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user