windows

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT, BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package windows contains an interface to the low-level operating system primitives. OS details vary depending on the underlying system, and by default, godoc will display the OS-specific documentation for the current system. If you want godoc to display syscall documentation for another system, set $GOOS and $GOARCH to the desired system. For example, if you want to view documentation for freebsd/arm on linux/amd64, set $GOOS to freebsd and $GOARCH to arm.

The primary use of this package is inside other packages that provide a more portable interface to the system, such as "os", "time" and "net". Use those packages rather than this one if you can.

For details of the functions and data types in this package consult the manuals for the appropriate operating system.

These calls return err == nil to indicate success; otherwise err represents an operating system error describing the failure and holds a value of type syscall.Errno.

Index

Examples

Constants

View Source
const (
	EVENTLOG_SUCCESS          = 0
	EVENTLOG_ERROR_TYPE       = 1
	EVENTLOG_WARNING_TYPE     = 2
	EVENTLOG_INFORMATION_TYPE = 4
	EVENTLOG_AUDIT_SUCCESS    = 8
	EVENTLOG_AUDIT_FAILURE    = 16
)
View Source
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
)
View Source
const (
	STANDARD_RIGHTS_REQUIRED = 0xf0000
	STANDARD_RIGHTS_READ     = 0x20000
	STANDARD_RIGHTS_WRITE    = 0x20000
	STANDARD_RIGHTS_EXECUTE  = 0x20000
	STANDARD_RIGHTS_ALL      = 0x1F0000
)
View Source
const (
	NameUnknown          = 0
	NameFullyQualifiedDN = 1
	NameSamCompatible    = 2
	NameDisplay          = 3
	NameUniqueId         = 6
	NameCanonical        = 7
	NameUserPrincipal    = 8
	NameCanonicalEx      = 9
	NameServicePrincipal = 10
	NameDnsDomain        = 12
)
View Source
const (
	// do not reorder
	NetSetupUnknownStatus = iota
	NetSetupUnjoined
	NetSetupWorkgroupName
	NetSetupDomainName
)
View Source
const (
	// do not reorder
	SidTypeUser = 1 + iota
	SidTypeGroup
	SidTypeDomain
	SidTypeAlias
	SidTypeWellKnownGroup
	SidTypeDeletedAccount
	SidTypeInvalid
	SidTypeUnknown
	SidTypeComputer
	SidTypeLabel
)
View Source
const (
	SECURITY_NULL_RID                   = 0
	SECURITY_WORLD_RID                  = 0
	SECURITY_LOCAL_RID                  = 0
	SECURITY_CREATOR_OWNER_RID          = 0
	SECURITY_CREATOR_GROUP_RID          = 1
	SECURITY_DIALUP_RID                 = 1
	SECURITY_NETWORK_RID                = 2
	SECURITY_BATCH_RID                  = 3
	SECURITY_INTERACTIVE_RID            = 4
	SECURITY_LOGON_IDS_RID              = 5
	SECURITY_SERVICE_RID                = 6
	SECURITY_LOCAL_SYSTEM_RID           = 18
	SECURITY_BUILTIN_DOMAIN_RID         = 32
	SECURITY_PRINCIPAL_SELF_RID         = 10
	SECURITY_CREATOR_OWNER_SERVER_RID   = 0x2
	SECURITY_CREATOR_GROUP_SERVER_RID   = 0x3
	SECURITY_LOGON_IDS_RID_COUNT        = 0x3
	SECURITY_ANONYMOUS_LOGON_RID        = 0x7
	SECURITY_PROXY_RID                  = 0x8
	SECURITY_ENTERPRISE_CONTROLLERS_RID = 0x9
	SECURITY_SERVER_LOGON_RID           = SECURITY_ENTERPRISE_CONTROLLERS_RID
	SECURITY_AUTHENTICATED_USER_RID     = 0xb
	SECURITY_RESTRICTED_CODE_RID        = 0xc
	SECURITY_NT_NON_UNIQUE_RID          = 0x15
)
View Source
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
)

Predefined domain-relative RIDs for local groups. See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379649(v=vs.85).aspx

View Source
const (
	// do not reorder
	TOKEN_ASSIGN_PRIMARY = 1 << iota
	TOKEN_DUPLICATE
	TOKEN_IMPERSONATE
	TOKEN_QUERY
	TOKEN_QUERY_SOURCE
	TOKEN_ADJUST_PRIVILEGES
	TOKEN_ADJUST_GROUPS
	TOKEN_ADJUST_DEFAULT
	TOKEN_ADJUST_SESSIONID

	TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED |
		TOKEN_ASSIGN_PRIMARY |
		TOKEN_DUPLICATE |
		TOKEN_IMPERSONATE |
		TOKEN_QUERY |
		TOKEN_QUERY_SOURCE |
		TOKEN_ADJUST_PRIVILEGES |
		TOKEN_ADJUST_GROUPS |
		TOKEN_ADJUST_DEFAULT |
		TOKEN_ADJUST_SESSIONID
	TOKEN_READ  = STANDARD_RIGHTS_READ | TOKEN_QUERY
	TOKEN_WRITE = STANDARD_RIGHTS_WRITE |
		TOKEN_ADJUST_PRIVILEGES |
		TOKEN_ADJUST_GROUPS |
		TOKEN_ADJUST_DEFAULT
	TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE
)
View Source
const (
	// do not reorder
	TokenUser = 1 + iota
	TokenGroups
	TokenPrivileges
	TokenOwner
	TokenPrimaryGroup
	TokenDefaultDacl
	TokenSource
	TokenType
	TokenImpersonationLevel
	TokenStatistics
	TokenRestrictedSids
	TokenSessionId
	TokenGroupsAndPrivileges
	TokenSessionReference
	TokenSandBoxInert
	TokenAuditPolicy
	TokenOrigin
	TokenElevationType
	TokenLinkedToken
	TokenElevation
	TokenHasRestrictions
	TokenAccessInformation
	TokenVirtualizationAllowed
	TokenVirtualizationEnabled
	TokenIntegrityLevel
	TokenUIAccess
	TokenMandatoryPolicy
	TokenLogonSid
	MaxTokenInfoClass
)
View Source
const (
	SC_MANAGER_CONNECT            = 1
	SC_MANAGER_CREATE_SERVICE     = 2
	SC_MANAGER_ENUMERATE_SERVICE  = 4
	SC_MANAGER_LOCK               = 8
	SC_MANAGER_QUERY_LOCK_STATUS  = 16
	SC_MANAGER_MODIFY_BOOT_CONFIG = 32
	SC_MANAGER_ALL_ACCESS         = 0xf003f
)
View Source
const (
	SERVICE_KERNEL_DRIVER       = 1
	SERVICE_FILE_SYSTEM_DRIVER  = 2
	SERVICE_ADAPTER             = 4
	SERVICE_RECOGNIZER_DRIVER   = 8
	SERVICE_WIN32_OWN_PROCESS   = 16
	SERVICE_WIN32_SHARE_PROCESS = 32
	SERVICE_WIN32               = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS
	SERVICE_INTERACTIVE_PROCESS = 256
	SERVICE_DRIVER              = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER
	SERVICE_TYPE_ALL            = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS

	SERVICE_BOOT_START   = 0
	SERVICE_SYSTEM_START = 1
	SERVICE_AUTO_START   = 2
	SERVICE_DEMAND_START = 3
	SERVICE_DISABLED     = 4

	SERVICE_ERROR_IGNORE   = 0
	SERVICE_ERROR_NORMAL   = 1
	SERVICE_ERROR_SEVERE   = 2
	SERVICE_ERROR_CRITICAL = 3

	SC_STATUS_PROCESS_INFO = 0

	SC_ACTION_NONE        = 0
	SC_ACTION_RESTART     = 1
	SC_ACTION_REBOOT      = 2
	SC_ACTION_RUN_COMMAND = 3

	SERVICE_STOPPED          = 1
	SERVICE_START_PENDING    = 2
	SERVICE_STOP_PENDING     = 3
	SERVICE_RUNNING          = 4
	SERVICE_CONTINUE_PENDING = 5
	SERVICE_PAUSE_PENDING    = 6
	SERVICE_PAUSED           = 7
	SERVICE_NO_CHANGE        = 0xffffffff

	SERVICE_ACCEPT_STOP                  = 1
	SERVICE_ACCEPT_PAUSE_CONTINUE        = 2
	SERVICE_ACCEPT_SHUTDOWN              = 4
	SERVICE_ACCEPT_PARAMCHANGE           = 8
	SERVICE_ACCEPT_NETBINDCHANGE         = 16
	SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32
	SERVICE_ACCEPT_POWEREVENT            = 64
	SERVICE_ACCEPT_SESSIONCHANGE         = 128

	SERVICE_CONTROL_STOP                  = 1
	SERVICE_CONTROL_PAUSE                 = 2
	SERVICE_CONTROL_CONTINUE              = 3
	SERVICE_CONTROL_INTERROGATE           = 4
	SERVICE_CONTROL_SHUTDOWN              = 5
	SERVICE_CONTROL_PARAMCHANGE           = 6
	SERVICE_CONTROL_NETBINDADD            = 7
	SERVICE_CONTROL_NETBINDREMOVE         = 8
	SERVICE_CONTROL_NETBINDENABLE         = 9
	SERVICE_CONTROL_NETBINDDISABLE        = 10
	SERVICE_CONTROL_DEVICEEVENT           = 11
	SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12
	SERVICE_CONTROL_POWEREVENT            = 13
	SERVICE_CONTROL_SESSIONCHANGE         = 14

	SERVICE_ACTIVE    = 1
	SERVICE_INACTIVE  = 2
	SERVICE_STATE_ALL = 3

	SERVICE_QUERY_CONFIG           = 1
	SERVICE_CHANGE_CONFIG          = 2
	SERVICE_QUERY_STATUS           = 4
	SERVICE_ENUMERATE_DEPENDENTS   = 8
	SERVICE_START                  = 16
	SERVICE_STOP                   = 32
	SERVICE_PAUSE_CONTINUE         = 64
	SERVICE_INTERROGATE            = 128
	SERVICE_USER_DEFINED_CONTROL   = 256
	SERVICE_ALL_ACCESS             = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL
	SERVICE_RUNS_IN_SYSTEM_PROCESS = 1
	SERVICE_CONFIG_DESCRIPTION     = 1
	SERVICE_CONFIG_FAILURE_ACTIONS = 2

	NO_ERROR = 0

	SC_ENUM_PROCESS_INFO = 0
)
View Source
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
)
View Source
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
)
View Source
const (
	// Invented values to support what package os expects.
	O_RDONLY   = 0x00000
	O_WRONLY   = 0x00001
	O_RDWR     = 0x00002
	O_CREAT    = 0x00040
	O_EXCL     = 0x00080
	O_NOCTTY   = 0x00100
	O_TRUNC    = 0x00200
	O_NONBLOCK = 0x00800
	O_APPEND   = 0x00400
	O_SYNC     = 0x01000
	O_ASYNC    = 0x02000
	O_CLOEXEC  = 0x80000
)
View Source
const (
	// More invented values for signals
	SIGHUP  = Signal(0x1)
	SIGINT  = Signal(0x2)
	SIGQUIT = Signal(0x3)
	SIGILL  = Signal(0x4)
	SIGTRAP = Signal(0x5)
	SIGABRT = Signal(0x6)
	SIGBUS  = Signal(0x7)
	SIGFPE  = Signal(0x8)
	SIGKILL = Signal(0x9)
	SIGSEGV = Signal(0xb)
	SIGPIPE = Signal(0xd)
	SIGALRM = Signal(0xe)
	SIGTERM = Signal(0xf)
)
View Source
const (
	GENERIC_READ    = 0x80000000
	GENERIC_WRITE   = 0x40000000
	GENERIC_EXECUTE = 0x20000000
	GENERIC_ALL     = 0x10000000

	FILE_LIST_DIRECTORY   = 0x00000001
	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_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

	CREATE_NEW        = 1
	CREATE_ALWAYS     = 2
	OPEN_EXISTING     = 3
	OPEN_ALWAYS       = 4
	TRUNCATE_EXISTING = 5

	FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
	FILE_FLAG_BACKUP_SEMANTICS   = 0x02000000
	FILE_FLAG_OVERLAPPED         = 0x40000000

	HANDLE_FLAG_INHERIT    = 0x00000001
	STARTF_USESTDHANDLES   = 0x00000100
	STARTF_USESHOWWINDOW   = 0x00000001
	DUPLICATE_CLOSE_SOURCE = 0x00000001
	DUPLICATE_SAME_ACCESS  = 0x00000002

	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
	FILE_END     = 2

	LANG_ENGLISH       = 0x09
	SUBLANG_ENGLISH_US = 0x01

	FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
	FORMAT_MESSAGE_IGNORE_INSERTS  = 512
	FORMAT_MESSAGE_FROM_STRING     = 1024
	FORMAT_MESSAGE_FROM_HMODULE    = 2048
	FORMAT_MESSAGE_FROM_SYSTEM     = 4096
	FORMAT_MESSAGE_ARGUMENT_ARRAY  = 8192
	FORMAT_MESSAGE_MAX_WIDTH_MASK  = 255

	MAX_PATH      = 260
	MAX_LONG_PATH = 32768

	MAX_COMPUTERNAME_LENGTH = 15

	TIME_ZONE_ID_UNKNOWN  = 0
	TIME_ZONE_ID_STANDARD = 1

	TIME_ZONE_ID_DAYLIGHT = 2
	IGNORE                = 0
	INFINITE              = 0xffffffff

	WAIT_TIMEOUT   = 258
	WAIT_ABANDONED = 0x00000080
	WAIT_OBJECT_0  = 0x00000000
	WAIT_FAILED    = 0xFFFFFFFF

	PROCESS_TERMINATE         = 1
	PROCESS_QUERY_INFORMATION = 0x00000400
	SYNCHRONIZE               = 0x00100000

	FILE_MAP_COPY    = 0x01
	FILE_MAP_WRITE   = 0x02
	FILE_MAP_READ    = 0x04
	FILE_MAP_EXECUTE = 0x20

	CTRL_C_EVENT     = 0
	CTRL_BREAK_EVENT = 1

	// Windows reserves errors >= 1<<29 for application use.
	APPLICATION_ERROR = 1 << 29
)
View Source
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
)
View Source
const (
	// flags for CreateToolhelp32Snapshot
	TH32CS_SNAPHEAPLIST = 0x01
	TH32CS_SNAPPROCESS  = 0x02
	TH32CS_SNAPTHREAD   = 0x04
	TH32CS_SNAPMODULE   = 0x08
	TH32CS_SNAPMODULE32 = 0x10
	TH32CS_SNAPALL      = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
	TH32CS_INHERIT      = 0x80000000
)
View Source
const (
	// filters for ReadDirectoryChangesW
	FILE_NOTIFY_CHANGE_FILE_NAME   = 0x001
	FILE_NOTIFY_CHANGE_DIR_NAME    = 0x002
	FILE_NOTIFY_CHANGE_ATTRIBUTES  = 0x004
	FILE_NOTIFY_CHANGE_SIZE        = 0x008
	FILE_NOTIFY_CHANGE_LAST_WRITE  = 0x010
	FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x020
	FILE_NOTIFY_CHANGE_CREATION    = 0x040
	FILE_NOTIFY_CHANGE_SECURITY    = 0x100
)
View Source
const (
	// do not reorder
	FILE_ACTION_ADDED = iota + 1
	FILE_ACTION_REMOVED
	FILE_ACTION_MODIFIED
	FILE_ACTION_RENAMED_OLD_NAME
	FILE_ACTION_RENAMED_NEW_NAME
)
View Source
const (
	// wincrypt.h
	PROV_RSA_FULL                    = 1
	PROV_RSA_SIG                     = 2
	PROV_DSS                         = 3
	PROV_FORTEZZA                    = 4
	PROV_MS_EXCHANGE                 = 5
	PROV_SSL                         = 6
	PROV_RSA_SCHANNEL                = 12
	PROV_DSS_DH                      = 13
	PROV_EC_ECDSA_SIG                = 14
	PROV_EC_ECNRA_SIG                = 15
	PROV_EC_ECDSA_FULL               = 16
	PROV_EC_ECNRA_FULL               = 17
	PROV_DH_SCHANNEL                 = 18
	PROV_SPYRUS_LYNKS                = 20
	PROV_RNG                         = 21
	PROV_INTEL_SEC                   = 22
	PROV_REPLACE_OWF                 = 23
	PROV_RSA_AES                     = 24
	CRYPT_VERIFYCONTEXT              = 0xF0000000
	CRYPT_NEWKEYSET                  = 0x00000008
	CRYPT_DELETEKEYSET               = 0x00000010
	CRYPT_MACHINE_KEYSET             = 0x00000020
	CRYPT_SILENT                     = 0x00000040
	CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080

	USAGE_MATCH_TYPE_AND = 0
	USAGE_MATCH_TYPE_OR  = 1

	/* msgAndCertEncodingType values for CertOpenStore function */
	X509_ASN_ENCODING   = 0x00000001
	PKCS_7_ASN_ENCODING = 0x00010000

	/* 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
	CERT_TRUST_IS_NOT_SIGNATURE_VALID            = 0x00000008
	CERT_TRUST_IS_NOT_VALID_FOR_USAGE            = 0x00000010
	CERT_TRUST_IS_UNTRUSTED_ROOT                 = 0x00000020
	CERT_TRUST_REVOCATION_STATUS_UNKNOWN         = 0x00000040
	CERT_TRUST_IS_CYCLIC                         = 0x00000080
	CERT_TRUST_INVALID_EXTENSION                 = 0x00000100
	CERT_TRUST_INVALID_POLICY_CONSTRAINTS        = 0x00000200
	CERT_TRUST_INVALID_BASIC_CONSTRAINTS         = 0x00000400
	CERT_TRUST_INVALID_NAME_CONSTRAINTS          = 0x00000800
	CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000
	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
	CERT_CHAIN_POLICY_SSL               = 4
	CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = 5
	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
)
View Source
const (
	GetFileExInfoStandard = 0
	GetFileExMaxInfoLevel = 1
)
View Source
const (
	// winuser.h
	SW_HIDE            = 0
	SW_NORMAL          = 1
	SW_SHOWNORMAL      = 1
	SW_SHOWMINIMIZED   = 2
	SW_SHOWMAXIMIZED   = 3
	SW_MAXIMIZE        = 3
	SW_SHOWNOACTIVATE  = 4
	SW_SHOW            = 5
	SW_MINIMIZE        = 6
	SW_SHOWMINNOACTIVE = 7
	SW_SHOWNA          = 8
	SW_RESTORE         = 9
	SW_SHOWDEFAULT     = 10
	SW_FORCEMINIMIZE   = 11
)

ShowWindow constants

View Source
const (
	AF_UNSPEC  = 0
	AF_UNIX    = 1
	AF_INET    = 2
	AF_INET6   = 23
	AF_NETBIOS = 17

	SOCK_STREAM    = 1
	SOCK_DGRAM     = 2
	SOCK_RAW       = 3
	SOCK_SEQPACKET = 5

	IPPROTO_IP   = 0
	IPPROTO_IPV6 = 0x29
	IPPROTO_TCP  = 6
	IPPROTO_UDP  = 17

	SOL_SOCKET                = 0xffff
	SO_REUSEADDR              = 4
	SO_KEEPALIVE              = 8
	SO_DONTROUTE              = 16
	SO_BROADCAST              = 32
	SO_LINGER                 = 128
	SO_RCVBUF                 = 0x1002
	SO_SNDBUF                 = 0x1001
	SO_UPDATE_ACCEPT_CONTEXT  = 0x700b
	SO_UPDATE_CONNECT_CONTEXT = 0x7010

	IOC_OUT                            = 0x40000000
	IOC_IN                             = 0x80000000
	IOC_VENDOR                         = 0x18000000
	IOC_INOUT                          = IOC_IN | IOC_OUT
	IOC_WS2                            = 0x08000000
	SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
	SIO_KEEPALIVE_VALS                 = IOC_IN | IOC_VENDOR | 4
	SIO_UDP_CONNRESET                  = IOC_IN | IOC_VENDOR | 12

	IP_TOS             = 0x3
	IP_TTL             = 0x4
	IP_MULTICAST_IF    = 0x9
	IP_MULTICAST_TTL   = 0xa
	IP_MULTICAST_LOOP  = 0xb
	IP_ADD_MEMBERSHIP  = 0xc
	IP_DROP_MEMBERSHIP = 0xd

	IPV6_V6ONLY         = 0x1b
	IPV6_UNICAST_HOPS   = 0x4
	IPV6_MULTICAST_IF   = 0x9
	IPV6_MULTICAST_HOPS = 0xa
	IPV6_MULTICAST_LOOP = 0xb
	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

	SHUT_RD   = 0
	SHUT_WR   = 1
	SHUT_RDWR = 2

	WSADESCRIPTION_LEN = 256
	WSASYS_STATUS_LEN  = 128
)
View Source
const (
	S_IFMT   = 0x1f000
	S_IFIFO  = 0x1000
	S_IFCHR  = 0x2000
	S_IFDIR  = 0x4000
	S_IFBLK  = 0x6000
	S_IFREG  = 0x8000
	S_IFLNK  = 0xa000
	S_IFSOCK = 0xc000
	S_ISUID  = 0x800
	S_ISGID  = 0x400
	S_ISVTX  = 0x200
	S_IRUSR  = 0x100
	S_IWRITE = 0x80
	S_IWUSR  = 0x80
	S_IXUSR  = 0x40
)

Invented values to support what package os expects.

View Source
const (
	FILE_TYPE_CHAR    = 0x0002
	FILE_TYPE_DISK    = 0x0001
	FILE_TYPE_PIPE    = 0x0003
	FILE_TYPE_REMOTE  = 0x8000
	FILE_TYPE_UNKNOWN = 0x0000
)
View Source
const (
	DNS_TYPE_A       = 0x0001
	DNS_TYPE_NS      = 0x0002
	DNS_TYPE_MD      = 0x0003
	DNS_TYPE_MF      = 0x0004
	DNS_TYPE_CNAME   = 0x0005
	DNS_TYPE_SOA     = 0x0006
	DNS_TYPE_MB      = 0x0007
	DNS_TYPE_MG      = 0x0008
	DNS_TYPE_MR      = 0x0009
	DNS_TYPE_NULL    = 0x000a
	DNS_TYPE_WKS     = 0x000b
	DNS_TYPE_PTR     = 0x000c
	DNS_TYPE_HINFO   = 0x000d
	DNS_TYPE_MINFO   = 0x000e
	DNS_TYPE_MX      = 0x000f
	DNS_TYPE_TEXT    = 0x0010
	DNS_TYPE_RP      = 0x0011
	DNS_TYPE_AFSDB   = 0x0012
	DNS_TYPE_X25     = 0x0013
	DNS_TYPE_ISDN    = 0x0014
	DNS_TYPE_RT      = 0x0015
	DNS_TYPE_NSAP    = 0x0016
	DNS_TYPE_NSAPPTR = 0x0017
	DNS_TYPE_SIG     = 0x0018
	DNS_TYPE_KEY     = 0x0019
	DNS_TYPE_PX      = 0x001a
	DNS_TYPE_GPOS    = 0x001b
	DNS_TYPE_AAAA    = 0x001c
	DNS_TYPE_LOC     = 0x001d
	DNS_TYPE_NXT     = 0x001e
	DNS_TYPE_EID     = 0x001f
	DNS_TYPE_NIMLOC  = 0x0020
	DNS_TYPE_SRV     = 0x0021
	DNS_TYPE_ATMA    = 0x0022
	DNS_TYPE_NAPTR   = 0x0023
	DNS_TYPE_KX      = 0x0024
	DNS_TYPE_CERT    = 0x0025
	DNS_TYPE_A6      = 0x0026
	DNS_TYPE_DNAME   = 0x0027
	DNS_TYPE_SINK    = 0x0028
	DNS_TYPE_OPT     = 0x0029
	DNS_TYPE_DS      = 0x002B
	DNS_TYPE_RRSIG   = 0x002E
	DNS_TYPE_NSEC    = 0x002F
	DNS_TYPE_DNSKEY  = 0x0030
	DNS_TYPE_DHCID   = 0x0031
	DNS_TYPE_UINFO   = 0x0064
	DNS_TYPE_UID     = 0x0065
	DNS_TYPE_GID     = 0x0066
	DNS_TYPE_UNSPEC  = 0x0067
	DNS_TYPE_ADDRS   = 0x00f8
	DNS_TYPE_TKEY    = 0x00f9
	DNS_TYPE_TSIG    = 0x00fa
	DNS_TYPE_IXFR    = 0x00fb
	DNS_TYPE_AXFR    = 0x00fc
	DNS_TYPE_MAILB   = 0x00fd
	DNS_TYPE_MAILA   = 0x00fe
	DNS_TYPE_ALL     = 0x00ff
	DNS_TYPE_ANY     = 0x00ff
	DNS_TYPE_WINS    = 0xff01
	DNS_TYPE_WINSR   = 0xff02
	DNS_TYPE_NBSTAT  = 0xff01
)
View Source
const (
	// flags inside DNSRecord.Dw
	DnsSectionQuestion   = 0x0000
	DnsSectionAnswer     = 0x0001
	DnsSectionAuthority  = 0x0002
	DnsSectionAdditional = 0x0003
)
View Source
const (
	TF_DISCONNECT         = 1
	TF_REUSE_SOCKET       = 2
	TF_WRITE_BEHIND       = 4
	TF_USE_DEFAULT_WORKER = 0
	TF_USE_SYSTEM_THREAD  = 16
	TF_USE_KERNEL_APC     = 32
)
View Source
const (
	IFF_UP           = 1
	IFF_BROADCAST    = 2
	IFF_LOOPBACK     = 4
	IFF_POINTTOPOINT = 8
	IFF_MULTICAST    = 16
)
View Source
const (
	// do not reorder
	HKEY_CLASSES_ROOT = 0x80000000 + iota
	HKEY_CURRENT_USER
	HKEY_LOCAL_MACHINE
	HKEY_USERS
	HKEY_PERFORMANCE_DATA
	HKEY_CURRENT_CONFIG
	HKEY_DYN_DATA

	KEY_QUERY_VALUE        = 1
	KEY_SET_VALUE          = 2
	KEY_CREATE_SUB_KEY     = 4
	KEY_ENUMERATE_SUB_KEYS = 8
	KEY_NOTIFY             = 16
	KEY_CREATE_LINK        = 32
	KEY_WRITE              = 0x20006
	KEY_EXECUTE            = 0x20019
	KEY_READ               = 0x20019
	KEY_WOW64_64KEY        = 0x0100
	KEY_WOW64_32KEY        = 0x0200
	KEY_ALL_ACCESS         = 0xf003f
)
View Source
const (
	// do not reorder
	REG_NONE = iota
	REG_SZ
	REG_EXPAND_SZ
	REG_BINARY
	REG_DWORD_LITTLE_ENDIAN
	REG_DWORD_BIG_ENDIAN
	REG_LINK
	REG_MULTI_SZ
	REG_RESOURCE_LIST
	REG_FULL_RESOURCE_DESCRIPTOR
	REG_RESOURCE_REQUIREMENTS_LIST
	REG_QWORD_LITTLE_ENDIAN
	REG_DWORD = REG_DWORD_LITTLE_ENDIAN
	REG_QWORD = REG_QWORD_LITTLE_ENDIAN
)
View Source
const (
	AI_PASSIVE     = 1
	AI_CANONNAME   = 2
	AI_NUMERICHOST = 4
)
View Source
const (
	FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1
	FILE_SKIP_SET_EVENT_ON_HANDLE        = 2
)
View Source
const (
	WSAPROTOCOL_LEN    = 255
	MAX_PROTOCOL_CHAIN = 7
	BASE_PROTOCOL      = 1
	LAYERED_PROTOCOL   = 0

	XP1_CONNECTIONLESS           = 0x00000001
	XP1_GUARANTEED_DELIVERY      = 0x00000002
	XP1_GUARANTEED_ORDER         = 0x00000004
	XP1_MESSAGE_ORIENTED         = 0x00000008
	XP1_PSEUDO_STREAM            = 0x00000010
	XP1_GRACEFUL_CLOSE           = 0x00000020
	XP1_EXPEDITED_DATA           = 0x00000040
	XP1_CONNECT_DATA             = 0x00000080
	XP1_DISCONNECT_DATA          = 0x00000100
	XP1_SUPPORT_BROADCAST        = 0x00000200
	XP1_SUPPORT_MULTIPOINT       = 0x00000400
	XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800
	XP1_MULTIPOINT_DATA_PLANE    = 0x00001000
	XP1_QOS_SUPPORTED            = 0x00002000
	XP1_UNI_SEND                 = 0x00008000
	XP1_UNI_RECV                 = 0x00010000
	XP1_IFS_HANDLES              = 0x00020000
	XP1_PARTIAL_MESSAGE          = 0x00040000
	XP1_SAN_SUPPORT_SDP          = 0x00080000

	PFL_MULTIPLE_PROTO_ENTRIES  = 0x00000001
	PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002
	PFL_HIDDEN                  = 0x00000004
	PFL_MATCHES_PROTOCOL_ZERO   = 0x00000008
	PFL_NETWORKDIRECT_PROVIDER  = 0x00000010
)
View Source
const (
	FSCTL_GET_REPARSE_POINT          = 0x900A8
	MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
	IO_REPARSE_TAG_MOUNT_POINT       = 0xA0000003
	IO_REPARSE_TAG_SYMLINK           = 0xA000000C
	SYMBOLIC_LINK_FLAG_DIRECTORY     = 0x1
)
View Source
const (
	ComputerNameNetBIOS                   = 0
	ComputerNameDnsHostname               = 1
	ComputerNameDnsDomain                 = 2
	ComputerNameDnsFullyQualified         = 3
	ComputerNamePhysicalNetBIOS           = 4
	ComputerNamePhysicalDnsHostname       = 5
	ComputerNamePhysicalDnsDomain         = 6
	ComputerNamePhysicalDnsFullyQualified = 7
	ComputerNameMax                       = 8
)
View Source
const (
	MOVEFILE_REPLACE_EXISTING      = 0x1
	MOVEFILE_COPY_ALLOWED          = 0x2
	MOVEFILE_DELAY_UNTIL_REBOOT    = 0x4
	MOVEFILE_WRITE_THROUGH         = 0x8
	MOVEFILE_CREATE_HARDLINK       = 0x10
	MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20
)
View Source
const (
	IF_TYPE_OTHER              = 1
	IF_TYPE_ETHERNET_CSMACD    = 6
	IF_TYPE_ISO88025_TOKENRING = 9
	IF_TYPE_PPP                = 23
	IF_TYPE_SOFTWARE_LOOPBACK  = 24
	IF_TYPE_ATM                = 37
	IF_TYPE_IEEE80211          = 71
	IF_TYPE_TUNNEL             = 131
	IF_TYPE_IEEE1394           = 144
)
View Source
const (
	IfOperStatusUp             = 1
	IfOperStatusDown           = 2
	IfOperStatusTesting        = 3
	IfOperStatusUnknown        = 4
	IfOperStatusDormant        = 5
	IfOperStatusNotPresent     = 6
	IfOperStatusLowerLayerDown = 7
)
View Source
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
)
View Source
const (
	DNS_INFO_NO_RECORDS = 0x251D
)
View Source
const GAA_FLAG_INCLUDE_PREFIX = 0x00000010
View Source
const ImplementsGetwd = true
View Source
const MAXLEN_IFDESCR = 256
View Source
const MAXLEN_PHYSADDR = 8
View Source
const MAX_ADAPTER_ADDRESS_LENGTH = 8
View Source
const MAX_ADAPTER_DESCRIPTION_LENGTH = 128
View Source
const MAX_ADAPTER_NAME_LENGTH = 256
View Source
const MAX_INTERFACE_NAME_LEN = 256
View Source
const SIO_GET_INTERFACE_LIST = 0x4004747F
View Source
const UNIX_PATH_MAX = 108 // defined in afunix.h

Variables

View Source
var (
	SECURITY_NULL_SID_AUTHORITY        = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 0}}
	SECURITY_WORLD_SID_AUTHORITY       = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 1}}
	SECURITY_LOCAL_SID_AUTHORITY       = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 2}}
	SECURITY_CREATOR_SID_AUTHORITY     = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 3}}
	SECURITY_NON_UNIQUE_AUTHORITY      = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 4}}
	SECURITY_NT_AUTHORITY              = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 5}}
	SECURITY_MANDATORY_LABEL_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 16}}
)
View Source
var (
	Stdin  = getStdHandle(STD_INPUT_HANDLE)
	Stdout = getStdHandle(STD_OUTPUT_HANDLE)
	Stderr = getStdHandle(STD_ERROR_HANDLE)
)
View Source
var (
	OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
	OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
	OID_SGC_NETSCAPE        = []byte("2.16.840.1.113730.4.1\x00")
)
View Source
var SocketDisableIPv6 bool

For testing: clients can set this flag to force creation of IPv6 sockets to return EAFNOSUPPORT.

View Source
var WSAID_CONNECTEX = GUID{
	0x25a207b9,
	0xddf3,
	0x4660,
	[8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e},
}
View Source
var WSAID_WSARECVMSG = GUID{
	0xf689d7c8,
	0x6f1f,
	0x436b,
	[8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22},
}
View Source
var WSAID_WSASENDMSG = GUID{
	0xa441e712,
	0x754f,
	0x43ca,
	[8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d},
}

Functions

func Accept

func Accept(fd Handle) (nfd Handle, sa Sockaddr, err error)

func AcceptEx

func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error)

func AllocateAndInitializeSid

func 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)

func Bind

func Bind(fd Handle, sa Sockaddr) (err error)

func BytePtrFromString

func BytePtrFromString(s string) (*byte, error)

BytePtrFromString returns a pointer to a NUL-terminated array of bytes containing the text of s. If s contains a NUL byte at any location, it returns (nil, syscall.EINVAL).

func ByteSliceFromString

func ByteSliceFromString(s string) ([]byte, error)

ByteSliceFromString returns a NUL-terminated slice of bytes containing the text of s. If s contains a NUL byte at any location, it returns (nil, syscall.EINVAL).

func CancelIo

func CancelIo(s Handle) (err error)

func CancelIoEx

func CancelIoEx(s Handle, o *Overlapped) (err error)

func CertAddCertificateContextToStore

func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error)

func CertCloseStore

func CertCloseStore(store Handle, flags uint32) (err error)

func CertFreeCertificateChain

func CertFreeCertificateChain(ctx *CertChainContext)

func CertFreeCertificateContext

func CertFreeCertificateContext(ctx *CertContext) (err error)

func CertGetCertificateChain

func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error)

func CertVerifyCertificateChainPolicy

func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error)

func ChangeServiceConfig

func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error)

func ChangeServiceConfig2

func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error)

func Chdir

func Chdir(path string) (err error)

func Chmod

func Chmod(path string, mode uint32) (err error)

func Chown

func Chown(path string, uid int, gid int) (err error)

func Clearenv

func Clearenv()

func Close

func Close(fd Handle) (err error)

func CloseHandle

func CloseHandle(handle Handle) (err error)

func CloseOnExec

func CloseOnExec(fd Handle)

func CloseServiceHandle

func CloseServiceHandle(handle Handle) (err error)

func Closesocket

func Closesocket(s Handle) (err error)

func CommandLineToArgv

func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error)

func ComputerName

func ComputerName() (name string, err error)

func Connect

func Connect(fd Handle, sa Sockaddr) (err error)

func ConnectEx

func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesSent *uint32, overlapped *Overlapped) error

func ControlService

func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error)

func ConvertSidToStringSid

func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error)

func ConvertStringSidToSid

func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error)

func CopySid

func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error)

func CreateDirectory

func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error)
func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error)

func CreatePipe

func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error)

func CreateProcess

func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error)
func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error)

func CryptAcquireContext

func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error)

func CryptGenRandom

func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error)

func CryptReleaseContext

func CryptReleaseContext(provhandle Handle, flags uint32) (err error)

func DefineDosDevice

func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error)

func DeleteFile

func DeleteFile(path *uint16) (err error)

func DeleteService

func DeleteService(service Handle) (err error)

func DeleteVolumeMountPoint

func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error)

func DeregisterEventSource

func DeregisterEventSource(handle Handle) (err error)

func DeviceIoControl

func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error)

func DnsNameCompare

func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool)

func DnsQuery

func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error)

func DnsRecordListFree

func DnsRecordListFree(rl *DNSRecord, freetype uint32)

func DuplicateHandle

func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)

func EnumServicesStatusEx

func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error)

func Environ

func Environ() []string

func EqualSid

func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool)

func EscapeArg

func EscapeArg(s string) string

EscapeArg rewrites command line argument s as prescribed in http://msdn.microsoft.com/en-us/library/ms880421. This function returns "" (2 double quotes) if s is empty. Alternatively, these transformations are done:

  • every back slash (\) is doubled, but only if immediately followed by double quote (");
  • every double quote (") is escaped by back slash (\);
  • finally, s is wrapped with double quotes (arg -> "arg"), but only if there is space or tab inside s.

func Exit

func Exit(code int)

func ExitProcess

func ExitProcess(exitcode uint32)

func Fchdir

func Fchdir(fd Handle) (err error)

TODO(brainman): fix all needed for os

func Fchmod

func Fchmod(fd Handle, mode uint32) (err error)

func Fchown

func Fchown(fd Handle, uid int, gid int) (err error)

func FindClose

func FindClose(handle Handle) (err error)

func FindNextFile

func FindNextFile(handle Handle, data *Win32finddata) (err error)

func FindNextVolume

func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error)

func FindNextVolumeMountPoint

func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error)

func FindVolumeClose

func FindVolumeClose(findVolume Handle) (err error)

func FindVolumeMountPointClose

func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error)

func FlushFileBuffers

func FlushFileBuffers(handle Handle) (err error)

func FlushViewOfFile

func FlushViewOfFile(addr uintptr, length uintptr) (err error)

func FormatMessage

func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error)

func FreeAddrInfoW

func FreeAddrInfoW(addrinfo *AddrinfoW)

func FreeEnvironmentStrings

func FreeEnvironmentStrings(envs *uint16) (err error)

func FreeLibrary

func FreeLibrary(handle Handle) (err error)

func FreeSid

func FreeSid(sid *SID) (err error)

func Fsync

func Fsync(fd Handle) (err error)

func Ftruncate

func Ftruncate(fd Handle, length int64) (err error)

func FullPath

func FullPath(name string) (path string, err error)

FullPath retrieves the full path of the specified file.

func GetACP

func GetACP() (acp uint32)

func GetAcceptExSockaddrs

func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32)

func GetAdaptersAddresses

func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error)

func GetAdaptersInfo

func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error)

func GetAddrInfoW

func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error)

func GetCommandLine

func GetCommandLine() (cmd *uint16)

func GetComputerName

func GetComputerName(buf *uint16, n *uint32) (err error)

func GetComputerNameEx

func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error)

func GetConsoleMode

func GetConsoleMode(console Handle, mode *uint32) (err error)

func GetConsoleScreenBufferInfo

func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error)

func GetCurrentDirectory

func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error)

func GetCurrentThreadId

func GetCurrentThreadId() (id uint32)

func GetDriveType

func GetDriveType(rootPathName *uint16) (driveType uint32)

func GetEnvironmentStrings

func GetEnvironmentStrings() (envs *uint16, err error)

func GetEnvironmentVariable

func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error)

func GetExitCodeProcess

func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)

func GetFileAttributes

func GetFileAttributes(name *uint16) (attrs uint32, err error)

func GetFileAttributesEx

func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error)

func GetFileInformationByHandle

func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)

func GetFileType

func GetFileType(filehandle Handle) (n uint32, err error)

func GetFullPathName

func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error)

func GetIfEntry

func GetIfEntry(pIfRow *MibIfRow) (errcode error)

func GetLastError

func GetLastError() (lasterr error)

func GetLengthSid

func GetLengthSid(sid *SID) (len uint32)

func GetLogicalDriveStrings

func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error)

func GetLogicalDrives

func GetLogicalDrives() (drivesBitMask uint32, err error)

func GetLongPathName

func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error)

func GetProcAddress

func GetProcAddress(module Handle, procname string) (proc uintptr, err error)

func GetProcAddressByOrdinal

func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err error)

GetProcAddressByOrdinal retrieves the address of the exported function from module by ordinal.

func GetProcessTimes

func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)

func GetQueuedCompletionStatus

func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error)

func GetShortPathName

func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error)

func GetStartupInfo

func GetStartupInfo(startupInfo *StartupInfo) (err error)

func GetSystemTimeAsFileTime

func GetSystemTimeAsFileTime(time *Filetime)

func GetSystemTimePreciseAsFileTime

func GetSystemTimePreciseAsFileTime(time *Filetime)

func GetTempPath

func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error)

func GetTimeZoneInformation

func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error)

func GetTokenInformation

func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error)

func GetUserNameEx

func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error)

func GetUserProfileDirectory

func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error)

func GetVersion

func GetVersion() (ver uint32, err error)

func GetVolumeInformation

func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error)

func GetVolumeInformationByHandle

func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error)

func GetVolumeNameForVolumeMountPoint

func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error)

func GetVolumePathName

func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error)

func GetVolumePathNamesForVolumeName

func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error)

func Getegid

func Getegid() (egid int)

func Getenv

func Getenv(key string) (value string, found bool)

func Geteuid

func Geteuid() (euid int)

func Getgid

func Getgid() (gid int)

func Getgroups

func Getgroups() (gids []int, err error)

func Getpagesize

func Getpagesize() int

func Getpid

func Getpid() (pid int)

func Getppid

func Getppid() (ppid int)

func Getsockopt

func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error)

func GetsockoptInt

func GetsockoptInt(fd Handle, level, opt int) (int, error)

func Gettimeofday

func Gettimeofday(tv *Timeval) (err error)

func Getuid

func Getuid() (uid int)

func Getwd

func Getwd() (wd string, err error)

func Lchown

func Lchown(path string, uid int, gid int) (err error)
func Link(oldpath, newpath string) (err error)

func Listen

func Listen(s Handle, n int) (err error)

func LoadCancelIoEx

func LoadCancelIoEx() error

func LoadConnectEx

func LoadConnectEx() error
func LoadCreateSymbolicLink() error

func LoadGetAddrInfo

func LoadGetAddrInfo() error

func LoadGetSystemTimePreciseAsFileTime

func LoadGetSystemTimePreciseAsFileTime() error

func LoadSetFileCompletionNotificationModes

func LoadSetFileCompletionNotificationModes() error

func LookupAccountName

func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error)

func LookupAccountSid

func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error)

func MapViewOfFile

func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error)

func Mkdir

func Mkdir(path string, mode uint32) (err error)

func MoveFile

func MoveFile(from *uint16, to *uint16) (err error)

func MoveFileEx

func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error)

func MultiByteToWideChar

func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error)

func NetApiBufferFree

func NetApiBufferFree(buf *byte) (neterr error)

func NetGetJoinInformation

func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error)

func NetUserGetInfo

func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error)

func NewCallback

func NewCallback(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 NewCallbackCDecl

func NewCallbackCDecl(fn interface{}) uintptr

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 Ntohs

func Ntohs(netshort uint16) (u uint16)

func OpenProcessToken

func OpenProcessToken(h Handle, access uint32, token *Token) (err error)

func Pipe

func Pipe(p []Handle) (err error)

func PostQueuedCompletionStatus

func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error)

func Process32First

func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error)

func Process32Next

func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error)

func PulseEvent

func PulseEvent(event Handle) (err error)

func QueryDosDevice

func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error)

func QueryServiceConfig

func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error)

func QueryServiceConfig2

func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error)

func QueryServiceStatus

func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error)

func QueryServiceStatusEx

func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error)

func Read

func Read(fd Handle, p []byte) (n int, err error)

func ReadConsole

func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error)

func ReadDirectoryChanges

func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error)

func ReadFile

func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)
func Readlink(path string, buf []byte) (n int, err error)

Readlink returns the destination of the named symbolic link.

func RegCloseKey

func RegCloseKey(key Handle) (regerrno error)

func RegEnumKeyEx

func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error)

func RegOpenKeyEx

func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error)

func RegQueryInfoKey

func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error)

func RegQueryValueEx

func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error)

func RemoveDirectory

func RemoveDirectory(path *uint16) (err error)

func Rename

func Rename(oldpath, newpath string) (err error)

func ReportEvent

func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error)

func ResetEvent

func ResetEvent(event Handle) (err error)

func Rmdir

func Rmdir(path string) (err error)

func Seek

func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error)

func Sendto

func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (err error)

func SetConsoleMode

func SetConsoleMode(console Handle, mode uint32) (err error)

func SetCurrentDirectory

func SetCurrentDirectory(path *uint16) (err error)

func SetEndOfFile

func SetEndOfFile(handle Handle) (err error)

func SetEnvironmentVariable

func SetEnvironmentVariable(name *uint16, value *uint16) (err error)

func SetEvent

func SetEvent(event Handle) (err error)

func SetFileAttributes

func SetFileAttributes(name *uint16, attrs uint32) (err error)

func SetFileCompletionNotificationModes

func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error)

func SetFilePointer

func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error)

func SetFileTime

func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error)

func SetHandleInformation

func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error)

func SetServiceStatus

func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error)

func SetStdHandle

func SetStdHandle(stdhandle uint32, handle Handle) (err error)

func SetVolumeLabel

func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error)

func SetVolumeMountPoint

func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error)

func Setenv

func Setenv(key, value string) error

func Setsockopt

func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error)

func SetsockoptIPMreq

func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error)

func SetsockoptIPv6Mreq

func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error)

func SetsockoptInet4Addr

func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error)

func SetsockoptInt

func SetsockoptInt(fd Handle, level, opt int, value int) (err error)

func SetsockoptLinger

func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error)

func SetsockoptTimeval

func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (err error)

func Shutdown

func Shutdown(fd Handle, how int) (err error)

func StartService

func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error)

func StartServiceCtrlDispatcher

func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error)

func StringToUTF16

func StringToUTF16(s string) []uint16

StringToUTF16 is deprecated. Use UTF16FromString instead. If s contains a NUL byte this function panics instead of returning an error.

func StringToUTF16Ptr

func StringToUTF16Ptr(s string) *uint16

StringToUTF16Ptr is deprecated. Use UTF16PtrFromString instead. If s contains a NUL byte this function panics instead of returning an error.

func Symlink(path, link string) (err error)

func TerminateProcess

func TerminateProcess(handle Handle, exitcode uint32) (err error)

func TimespecToNsec

func TimespecToNsec(ts Timespec) int64

func TranslateAccountName

func TranslateAccountName(username string, from, to uint32, initSize int) (string, error)

TranslateAccountName converts a directory service object name from one format to another.

func TranslateName

func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error)

func TransmitFile

func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error)

func UTF16FromString

func UTF16FromString(s string) ([]uint16, error)

UTF16FromString returns the UTF-16 encoding of the UTF-8 string s, with a terminating NUL added. If s contains a NUL byte at any location, it returns (nil, syscall.EINVAL).

func UTF16PtrFromString

func UTF16PtrFromString(s string) (*uint16, error)

UTF16PtrFromString returns pointer to the UTF-16 encoding of the UTF-8 string s, with a terminating NUL added. If s contains a NUL byte at any location, it returns (nil, syscall.EINVAL).

func UTF16ToString

func UTF16ToString(s []uint16) string

UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s, with a terminating NUL removed.

func Unlink(path string) (err error)

func UnmapViewOfFile

func UnmapViewOfFile(addr uintptr) (err error)

func Unsetenv

func Unsetenv(key string) error

func Utimes

func Utimes(path string, tv []Timeval) (err error)

func UtimesNano

func UtimesNano(path string, ts []Timespec) (err error)

func VirtualAlloc

func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error)

func VirtualFree

func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error)

func VirtualLock

func VirtualLock(addr uintptr, length uintptr) (err error)

func VirtualProtect

func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error)

func VirtualUnlock

func VirtualUnlock(addr uintptr, length uintptr) (err error)

func WSACleanup

func WSACleanup() (err error)

func WSAEnumProtocols

func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error)

func WSAIoctl

func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error)

func WSARecv

func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error)

func WSARecvFrom

func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error)

func WSARecvMsg

func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error

func WSASend

func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error)

func WSASendMsg

func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error

func WSASendTo

func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error)

func WSASendto

func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error)

func WSAStartup

func WSAStartup(verreq uint32, data *WSAData) (sockerr error)

func WaitForSingleObject

func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error)

func Write

func Write(fd Handle, p []byte) (n int, err error)

func WriteConsole

func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error)

func WriteFile

func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error)

Types

type AddrinfoW

type AddrinfoW struct {
	Flags     int32
	Family    int32
	Socktype  int32
	Protocol  int32
	Addrlen   uintptr
	Canonname *uint16
	Addr      uintptr
	Next      *AddrinfoW
}

type ByHandleFileInformation

type ByHandleFileInformation struct {
	FileAttributes     uint32
	CreationTime       Filetime
	LastAccessTime     Filetime
	LastWriteTime      Filetime
	VolumeSerialNumber uint32
	FileSizeHigh       uint32
	FileSizeLow        uint32
	NumberOfLinks      uint32
	FileIndexHigh      uint32
	FileIndexLow       uint32
}

type CertChainContext

type CertChainContext struct {
	Size                       uint32
	TrustStatus                CertTrustStatus
	ChainCount                 uint32
	Chains                     **CertSimpleChain
	LowerQualityChainCount     uint32
	LowerQualityChains         **CertChainContext
	HasRevocationFreshnessTime uint32
	RevocationFreshnessTime    uint32
}

type CertChainElement

type CertChainElement struct {
	Size              uint32
	CertContext       *CertContext
	TrustStatus       CertTrustStatus
	RevocationInfo    *CertRevocationInfo
	IssuanceUsage     *CertEnhKeyUsage
	ApplicationUsage  *CertEnhKeyUsage
	ExtendedErrorInfo *uint16
}

type CertChainPara

type CertChainPara struct {
	Size                         uint32
	RequestedUsage               CertUsageMatch
	RequstedIssuancePolicy       CertUsageMatch
	URLRetrievalTimeout          uint32
	CheckRevocationFreshnessTime uint32
	RevocationFreshnessTime      uint32
	CacheResync                  *Filetime
}

type CertChainPolicyPara

type CertChainPolicyPara struct {
	Size            uint32
	Flags           uint32
	ExtraPolicyPara Pointer
}

type CertChainPolicyStatus

type CertChainPolicyStatus struct {
	Size              uint32
	Error             uint32
	ChainIndex        uint32
	ElementIndex      uint32
	ExtraPolicyStatus Pointer
}

type CertContext

type CertContext struct {
	EncodingType uint32
	EncodedCert  *byte
	Length       uint32
	CertInfo     *CertInfo
	Store        Handle
}

func CertCreateCertificateContext

func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error)

func CertEnumCertificatesInStore

func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error)

type CertEnhKeyUsage

type CertEnhKeyUsage struct {
	Length           uint32
	UsageIdentifiers **byte
}

type CertInfo

type CertInfo struct {
}

type CertRevocationCrlInfo

type CertRevocationCrlInfo struct {
}

type CertRevocationInfo

type CertRevocationInfo struct {
	Size             uint32
	RevocationResult uint32
	RevocationOid    *byte
	OidSpecificInfo  Pointer
	HasFreshnessTime uint32
	FreshnessTime    uint32
	CrlInfo          *CertRevocationCrlInfo
}

type CertSimpleChain

type CertSimpleChain struct {
	Size                       uint32
	TrustStatus                CertTrustStatus
	NumElements                uint32
	Elements                   **CertChainElement
	TrustListInfo              *CertTrustListInfo
	HasRevocationFreshnessTime uint32
	RevocationFreshnessTime    uint32
}

type CertTrustListInfo

type CertTrustListInfo struct {
}

type CertTrustStatus

type CertTrustStatus struct {
	ErrorStatus uint32
	InfoStatus  uint32
}

type CertUsageMatch

type CertUsageMatch struct {
	Type  uint32
	Usage CertEnhKeyUsage
}

type ConsoleScreenBufferInfo

type ConsoleScreenBufferInfo struct {
	Size              Coord
	CursorPosition    Coord
	Attributes        uint16
	Window            SmallRect
	MaximumWindowSize Coord
}

type Coord

type Coord struct {
	X int16
	Y int16
}

type DLL

type DLL struct {
	Name   string
	Handle Handle
}

A DLL implements access to a single DLL.

func LoadDLL

func LoadDLL(name string) (dll *DLL, err error)

LoadDLL loads DLL file into memory.

Warning: using LoadDLL without an absolute path name is subject to DLL preloading attacks. To safely load a system DLL, use LazyDLL with System set to true, or use LoadLibraryEx directly.

func MustLoadDLL

func MustLoadDLL(name string) *DLL

MustLoadDLL is like LoadDLL but panics if load operation failes.

func (*DLL) FindProc

func (d *DLL) FindProc(name string) (proc *Proc, err error)

FindProc searches DLL d for procedure named name and returns *Proc if found. It returns an error if search fails.

func (*DLL) MustFindProc

func (d *DLL) MustFindProc(name string) *Proc

MustFindProc is like FindProc but panics if search fails.

func (*DLL) Release

func (d *DLL) Release() (err error)

Release unloads DLL d from memory.

type DLLError

type DLLError struct {
	Err     error
	ObjName string
	Msg     string
}

DLLError describes reasons for DLL load failures.

func (*DLLError) Error

func (e *DLLError) Error() string

type DNSMXData

type DNSMXData struct {
	NameExchange *uint16
	Preference   uint16
	Pad          uint16
}

type DNSPTRData

type DNSPTRData struct {
	Host *uint16
}

type DNSRecord

type DNSRecord struct {
	Next     *DNSRecord
	Name     *uint16
	Type     uint16
	Length   uint16
	Dw       uint32
	Ttl      uint32
	Reserved uint32
	Data     [40]byte
}

type DNSSRVData

type DNSSRVData struct {
	Target   *uint16
	Priority uint16
	Weight   uint16
	Port     uint16
	Pad      uint16
}

type DNSTXTData

type DNSTXTData struct {
	StringCount uint16
	StringArray [1]*uint16
}

type ENUM_SERVICE_STATUS_PROCESS

type ENUM_SERVICE_STATUS_PROCESS struct {
	ServiceName          *uint16
	DisplayName          *uint16
	ServiceStatusProcess SERVICE_STATUS_PROCESS
}

type Errno

type Errno = syscall.Errno

type FileNotifyInformation

type FileNotifyInformation struct {
	NextEntryOffset uint32
	Action          uint32
	FileNameLength  uint32
	FileName        uint16
}

type Filetime

type Filetime struct {
	LowDateTime  uint32
	HighDateTime uint32
}

func NsecToFiletime

func NsecToFiletime(nsec int64) (ft Filetime)

func (*Filetime) Nanoseconds

func (ft *Filetime) Nanoseconds() int64

Nanoseconds returns Filetime ft in nanoseconds since Epoch (00:00:00 UTC, January 1, 1970).

type GUID

type GUID struct {
	Data1 uint32
	Data2 uint16
	Data3 uint16
	Data4 [8]byte
}

type Handle

type Handle uintptr

func CertOpenStore

func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error)

func CertOpenSystemStore

func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error)

func CreateEvent

func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error)

func CreateEventEx

func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error)

func CreateFile

func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error)

func CreateFileMapping

func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error)

func CreateIoCompletionPort

func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error)

func CreateService

func 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)

func CreateToolhelp32Snapshot

func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error)

func FindFirstFile

func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error)

func FindFirstVolume

func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error)

func FindFirstVolumeMountPoint

func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error)

func GetCurrentProcess

func GetCurrentProcess() (pseudoHandle Handle, err error)

func GetStdHandle

func GetStdHandle(stdhandle uint32) (handle Handle, err error)

func LoadLibrary

func LoadLibrary(libname string) (handle Handle, err error)
Example
package main

import (
	"syscall"

	"github.com/go-xe2/third/golang.org/x/sys/windows"
)

func abort(funcname string, err error) {
	panic(funcname + " failed: " + err.Error())
}

func main() {
	h, err := windows.LoadLibrary("kernel32.dll")
	if err != nil {
		abort("LoadLibrary", err)
	}
	defer windows.FreeLibrary(h)
	proc, err := windows.GetProcAddress(h, "GetVersion")
	if err != nil {
		abort("GetProcAddress", err)
	}
	r, _, _ := syscall.Syscall(uintptr(proc), 0, 0, 0, 0)
	major := byte(r)
	minor := uint8(r >> 8)
	build := uint16(r >> 16)
	print("windows version ", major, ".", minor, " (Build ", build, ")\n")
}

func LoadLibraryEx

func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error)

func LocalFree

func LocalFree(hmem Handle) (handle Handle, err error)

func Open

func Open(path string, mode int, perm uint32) (fd Handle, err error)

func OpenEvent

func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error)

func OpenProcess

func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error)

func OpenSCManager

func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error)

func OpenService

func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error)

func RegisterEventSource

func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error)

func Socket

func Socket(domain, typ, proto int) (fd Handle, err error)

type Hostent

type Hostent struct {
	Name     *byte
	Aliases  **byte
	AddrType uint16
	Length   uint16
	AddrList **byte
}

func GetHostByName

func GetHostByName(name string) (h *Hostent, err error)

type IPMreq

type IPMreq struct {
	Multiaddr [4]byte /* in_addr */
	Interface [4]byte /* in_addr */
}

type IPv6Mreq

type IPv6Mreq struct {
	Multiaddr [16]byte /* in6_addr */
	Interface uint32
}

type InterfaceInfo

type InterfaceInfo struct {
	Flags            uint32
	Address          SockaddrGen
	BroadcastAddress SockaddrGen
	Netmask          SockaddrGen
}

type IpAdapterAddresses

type IpAdapterAddresses struct {
	Length                uint32
	IfIndex               uint32
	Next                  *IpAdapterAddresses
	AdapterName           *byte
	FirstUnicastAddress   *IpAdapterUnicastAddress
	FirstAnycastAddress   *IpAdapterAnycastAddress
	FirstMulticastAddress *IpAdapterMulticastAddress
	FirstDnsServerAddress *IpAdapterDnsServerAdapter
	DnsSuffix             *uint16
	Description           *uint16
	FriendlyName          *uint16
	PhysicalAddress       [syscall.MAX_ADAPTER_ADDRESS_LENGTH]byte
	PhysicalAddressLength uint32
	Flags                 uint32
	Mtu                   uint32
	IfType                uint32
	OperStatus            uint32
	Ipv6IfIndex           uint32
	ZoneIndices           [16]uint32
	FirstPrefix           *IpAdapterPrefix
}

type IpAdapterAnycastAddress

type IpAdapterAnycastAddress struct {
	Length  uint32
	Flags   uint32
	Next    *IpAdapterAnycastAddress
	Address SocketAddress
}

type IpAdapterDnsServerAdapter

type IpAdapterDnsServerAdapter struct {
	Length   uint32
	Reserved uint32
	Next     *IpAdapterDnsServerAdapter
	Address  SocketAddress
}

type IpAdapterInfo

type IpAdapterInfo struct {
	Next                *IpAdapterInfo
	ComboIndex          uint32
	AdapterName         [MAX_ADAPTER_NAME_LENGTH + 4]byte
	Description         [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte
	AddressLength       uint32
	Address             [MAX_ADAPTER_ADDRESS_LENGTH]byte
	Index               uint32
	Type                uint32
	DhcpEnabled         uint32
	CurrentIpAddress    *IpAddrString
	IpAddressList       IpAddrString
	GatewayList         IpAddrString
	DhcpServer          IpAddrString
	HaveWins            bool
	PrimaryWinsServer   IpAddrString
	SecondaryWinsServer IpAddrString
	LeaseObtained       int64
	LeaseExpires        int64
}

type IpAdapterMulticastAddress

type IpAdapterMulticastAddress struct {
	Length  uint32
	Flags   uint32
	Next    *IpAdapterMulticastAddress
	Address SocketAddress
}

type IpAdapterPrefix

type IpAdapterPrefix struct {
	Length       uint32
	Flags        uint32
	Next         *IpAdapterPrefix
	Address      SocketAddress
	PrefixLength uint32
}

type IpAdapterUnicastAddress

type IpAdapterUnicastAddress struct {
	Length             uint32
	Flags              uint32
	Next               *IpAdapterUnicastAddress
	Address            SocketAddress
	PrefixOrigin       int32
	SuffixOrigin       int32
	DadState           int32
	ValidLifetime      uint32
	PreferredLifetime  uint32
	LeaseLifetime      uint32
	OnLinkPrefixLength uint8
}

type IpAddrString

type IpAddrString struct {
	Next      *IpAddrString
	IpAddress IpAddressString
	IpMask    IpMaskString
	Context   uint32
}

type IpAddressString

type IpAddressString struct {
	String [16]byte
}

type IpMaskString

type IpMaskString IpAddressString

type LazyDLL

type LazyDLL struct {
	Name string

	// System determines whether the DLL must be loaded from the
	// Windows System directory, bypassing the normal DLL search
	// path.
	System bool
	// contains filtered or unexported fields
}

A LazyDLL implements access to a single DLL. It will delay the load of the DLL until the first call to its Handle method or to one of its LazyProc's Addr method.

func NewLazyDLL

func NewLazyDLL(name string) *LazyDLL

NewLazyDLL creates new LazyDLL associated with DLL file.

func NewLazySystemDLL

func NewLazySystemDLL(name string) *LazyDLL

NewLazySystemDLL is like NewLazyDLL, but will only search Windows System directory for the DLL if name is a base name (like "advapi32.dll").

func (*LazyDLL) Handle

func (d *LazyDLL) Handle() uintptr

Handle returns d's module handle.

func (*LazyDLL) Load

func (d *LazyDLL) Load() error

Load loads DLL file d.Name into memory. It returns an error if fails. Load will not try to load DLL, if it is already loaded into memory.

func (*LazyDLL) NewProc

func (d *LazyDLL) NewProc(name string) *LazyProc

NewProc returns a LazyProc for accessing the named procedure in the DLL d.

type LazyProc

type LazyProc struct {
	Name string
	// contains filtered or unexported fields
}

A LazyProc implements access to a procedure inside a LazyDLL. It delays the lookup until the Addr method is called.

func (*LazyProc) Addr

func (p *LazyProc) Addr() uintptr

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 (*LazyProc) Call

func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error)

Call executes procedure p with arguments a. It will panic, if more than 15 arguments are supplied. It will also panic if the procedure cannot be found.

The returned error is always non-nil, constructed from the result of GetLastError. Callers must inspect the primary return value to decide whether an error occurred (according to the semantics of the specific function being called) before consulting the error. The error will be guaranteed to contain windows.Errno.

func (*LazyProc) Find

func (p *LazyProc) Find() error

Find searches DLL for procedure named p.Name. It returns an error if search fails. Find will not search procedure, if it is already found and loaded into memory.

type Linger

type Linger struct {
	Onoff  int32
	Linger int32
}

type MibIfRow

type MibIfRow struct {
	Name            [MAX_INTERFACE_NAME_LEN]uint16
	Index           uint32
	Type            uint32
	Mtu             uint32
	Speed           uint32
	PhysAddrLen     uint32
	PhysAddr        [MAXLEN_PHYSADDR]byte
	AdminStatus     uint32
	OperStatus      uint32
	LastChange      uint32
	InOctets        uint32
	InUcastPkts     uint32
	InNUcastPkts    uint32
	InDiscards      uint32
	InErrors        uint32
	InUnknownProtos uint32
	OutOctets       uint32
	OutUcastPkts    uint32
	OutNUcastPkts   uint32
	OutDiscards     uint32
	OutErrors       uint32
	OutQLen         uint32
	DescrLen        uint32
	Descr           [MAXLEN_IFDESCR]byte
}

type Overlapped

type Overlapped struct {
	Internal     uintptr
	InternalHigh uintptr
	Offset       uint32
	OffsetHigh   uint32
	HEvent       Handle
}

type Pointer

type Pointer *struct{}

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 Proc

type Proc struct {
	Dll  *DLL
	Name string
	// contains filtered or unexported fields
}

A Proc implements access to a procedure inside a DLL.

func (*Proc) Addr

func (p *Proc) Addr() uintptr

Addr returns the address of the procedure represented by p. The return value can be passed to Syscall to run the procedure.

func (*Proc) Call

func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error)

Call executes procedure p with arguments a. It will panic, if more than 15 arguments are supplied.

The returned error is always non-nil, constructed from the result of GetLastError. Callers must inspect the primary return value to decide whether an error occurred (according to the semantics of the specific function being called) before consulting the error. The error will be guaranteed to contain windows.Errno.

type ProcessEntry32

type ProcessEntry32 struct {
	Size            uint32
	Usage           uint32
	ProcessID       uint32
	DefaultHeapID   uintptr
	ModuleID        uint32
	Threads         uint32
	ParentProcessID uint32
	PriClassBase    int32
	Flags           uint32
	ExeFile         [MAX_PATH]uint16
}

type ProcessInformation

type ProcessInformation struct {
	Process   Handle
	Thread    Handle
	ProcessId uint32
	ThreadId  uint32
}

type Protoent

type Protoent struct {
	Name    *byte
	Aliases **byte
	Proto   uint16
}

func GetProtoByName

func GetProtoByName(name string) (p *Protoent, err error)

type QUERY_SERVICE_CONFIG

type QUERY_SERVICE_CONFIG struct {
	ServiceType      uint32
	StartType        uint32
	ErrorControl     uint32
	BinaryPathName   *uint16
	LoadOrderGroup   *uint16
	TagId            uint32
	Dependencies     *uint16
	ServiceStartName *uint16
	DisplayName      *uint16
}

type RawSockaddr

type RawSockaddr struct {
	Family uint16
	Data   [14]int8
}

type RawSockaddrAny

type RawSockaddrAny struct {
	Addr RawSockaddr
	Pad  [100]int8
}

func (*RawSockaddrAny) Sockaddr

func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error)

type RawSockaddrInet4

type RawSockaddrInet4 struct {
	Family uint16
	Port   uint16
	Addr   [4]byte /* in_addr */
	Zero   [8]uint8
}

type RawSockaddrInet6

type RawSockaddrInet6 struct {
	Family   uint16
	Port     uint16
	Flowinfo uint32
	Addr     [16]byte /* in6_addr */
	Scope_id uint32
}

type RawSockaddrUnix

type RawSockaddrUnix struct {
	Family uint16
	Path   [UNIX_PATH_MAX]int8
}

type Rusage

type Rusage struct {
	CreationTime Filetime
	ExitTime     Filetime
	KernelTime   Filetime
	UserTime     Filetime
}

Invented structures to support what package os expects.

type SC_ACTION

type SC_ACTION struct {
	Type  uint32
	Delay uint32
}

type SERVICE_DESCRIPTION

type SERVICE_DESCRIPTION struct {
	Description *uint16
}

type SERVICE_FAILURE_ACTIONS

type SERVICE_FAILURE_ACTIONS struct {
	ResetPeriod  uint32
	RebootMsg    *uint16
	Command      *uint16
	ActionsCount uint32
	Actions      *SC_ACTION
}

type SERVICE_STATUS

type SERVICE_STATUS struct {
	ServiceType             uint32
	CurrentState            uint32
	ControlsAccepted        uint32
	Win32ExitCode           uint32
	ServiceSpecificExitCode uint32
	CheckPoint              uint32
	WaitHint                uint32
}

type SERVICE_STATUS_PROCESS

type SERVICE_STATUS_PROCESS struct {
	ServiceType             uint32
	CurrentState            uint32
	ControlsAccepted        uint32
	Win32ExitCode           uint32
	ServiceSpecificExitCode uint32
	CheckPoint              uint32
	WaitHint                uint32
	ProcessId               uint32
	ServiceFlags            uint32
}

type SERVICE_TABLE_ENTRY

type SERVICE_TABLE_ENTRY struct {
	ServiceName *uint16
	ServiceProc uintptr
}

type SID

type SID struct{}

The security identifier (SID) structure is a variable-length structure used to uniquely identify users or groups.

func LookupSID

func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error)

LookupSID retrieves a security identifier sid for the account and the name of the domain on which the account was found. System specify target computer to search.

func StringToSid

func StringToSid(s string) (*SID, error)

StringToSid converts a string-format security identifier sid into a valid, functional sid.

func (*SID) Copy

func (sid *SID) Copy() (*SID, error)

Copy creates a duplicate of security identifier sid.

func (*SID) Len

func (sid *SID) Len() int

Len returns the length, in bytes, of a valid security identifier sid.

func (*SID) LookupAccount

func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error)

LookupAccount retrieves the name of the account for this sid and the name of the first domain on which this sid is found. System specify target computer to search for.

func (*SID) String

func (sid *SID) String() (string, error)

String converts sid to a string format suitable for display, storage, or transmission.

type SIDAndAttributes

type SIDAndAttributes struct {
	Sid        *SID
	Attributes uint32
}

type SSLExtraCertChainPolicyPara

type SSLExtraCertChainPolicyPara struct {
	Size       uint32
	AuthType   uint32
	Checks     uint32
	ServerName *uint16
}

type SecurityAttributes

type SecurityAttributes struct {
	Length             uint32
	SecurityDescriptor uintptr
	InheritHandle      uint32
}

type Servent

type Servent struct {
	Name    *byte
	Aliases **byte
	Proto   *byte
	Port    uint16
}

func GetServByName

func GetServByName(name string, proto string) (s *Servent, err error)

type SidIdentifierAuthority

type SidIdentifierAuthority struct {
	Value [6]byte
}

type Signal

type Signal int

func (Signal) Signal

func (s Signal) Signal()

func (Signal) String

func (s Signal) String() string

type SmallRect

type SmallRect struct {
	Left   int16
	Top    int16
	Right  int16
	Bottom int16
}

type Sockaddr

type Sockaddr interface {
	// contains filtered or unexported methods
}

func Getpeername

func Getpeername(fd Handle) (sa Sockaddr, err error)

func Getsockname

func Getsockname(fd Handle) (sa Sockaddr, err error)

func Recvfrom

func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, err error)

type SockaddrGen

type SockaddrGen [24]byte

type SockaddrInet4

type SockaddrInet4 struct {
	Port int
	Addr [4]byte
	// contains filtered or unexported fields
}

type SockaddrInet6

type SockaddrInet6 struct {
	Port   int
	ZoneId uint32
	Addr   [16]byte
	// contains filtered or unexported fields
}

type SockaddrUnix

type SockaddrUnix struct {
	Name string
	// contains filtered or unexported fields
}

type SocketAddress

type SocketAddress struct {
	Sockaddr       *syscall.RawSockaddrAny
	SockaddrLength int32
}

type StartupInfo

type StartupInfo struct {
	Cb uint32

	Desktop       *uint16
	Title         *uint16
	X             uint32
	Y             uint32
	XSize         uint32
	YSize         uint32
	XCountChars   uint32
	YCountChars   uint32
	FillAttribute uint32
	Flags         uint32
	ShowWindow    uint16

	StdInput  Handle
	StdOutput Handle
	StdErr    Handle
	// contains filtered or unexported fields
}

type SysProcAttr

type SysProcAttr = syscall.SysProcAttr

type Systemtime

type Systemtime struct {
	Year         uint16
	Month        uint16
	DayOfWeek    uint16
	Day          uint16
	Hour         uint16
	Minute       uint16
	Second       uint16
	Milliseconds uint16
}

type TCPKeepalive

type TCPKeepalive struct {
	OnOff    uint32
	Time     uint32
	Interval uint32
}

type Timespec

type Timespec struct {
	Sec  int64
	Nsec int64
}

Timespec is an invented structure on Windows, but here for consistency with the corresponding package for other operating systems.

func NsecToTimespec

func NsecToTimespec(nsec int64) (ts Timespec)

func (*Timespec) Nano

func (ts *Timespec) Nano() int64

func (*Timespec) Unix

func (ts *Timespec) Unix() (sec int64, nsec int64)

type Timeval

type Timeval struct {
	Sec  int32
	Usec int32
}

Invented values to support what package os expects.

func NsecToTimeval

func NsecToTimeval(nsec int64) (tv Timeval)

func (*Timeval) Nano

func (tv *Timeval) Nano() int64

func (*Timeval) Nanoseconds

func (tv *Timeval) Nanoseconds() int64

func (*Timeval) Unix

func (tv *Timeval) Unix() (sec int64, nsec int64)

type Timezoneinformation

type Timezoneinformation struct {
	Bias         int32
	StandardName [32]uint16
	StandardDate Systemtime
	StandardBias int32
	DaylightName [32]uint16
	DaylightDate Systemtime
	DaylightBias int32
}

type Token

type Token Handle

An access token contains the security information for a logon session. The system creates an access token when a user logs on, and every process executed on behalf of the user has a copy of the token. The token identifies the user, the user's groups, and the user's privileges. The system uses the token to control access to securable objects and to control the ability of the user to perform various system-related operations on the local computer.

func OpenCurrentProcessToken

func OpenCurrentProcessToken() (Token, error)

OpenCurrentProcessToken opens the access token associated with current process.

func (Token) Close

func (t Token) Close() error

Close releases access to access token.

func (Token) GetTokenGroups

func (t Token) GetTokenGroups() (*Tokengroups, error)

GetTokenGroups retrieves group accounts associated with access token t.

func (Token) GetTokenPrimaryGroup

func (t Token) GetTokenPrimaryGroup() (*Tokenprimarygroup, error)

GetTokenPrimaryGroup retrieves access token t primary group information. A pointer to a SID structure representing a group that will become the primary group of any objects created by a process using this access token.

func (Token) GetTokenUser

func (t Token) GetTokenUser() (*Tokenuser, error)

GetTokenUser retrieves access token t user account information.

func (Token) GetUserProfileDirectory

func (t Token) GetUserProfileDirectory() (string, error)

GetUserProfileDirectory retrieves path to the root directory of the access token t user's profile.

func (Token) IsMember

func (t Token) IsMember(sid *SID) (bool, error)

IsMember reports whether the access token t is a member of the provided SID.

type Tokengroups

type Tokengroups struct {
	GroupCount uint32
	Groups     [1]SIDAndAttributes
}

type Tokenprimarygroup

type Tokenprimarygroup struct {
	PrimaryGroup *SID
}

type Tokenuser

type Tokenuser struct {
	User SIDAndAttributes
}

type TransmitFileBuffers

type TransmitFileBuffers struct {
	Head       uintptr
	HeadLength uint32
	Tail       uintptr
	TailLength uint32
}

type UserInfo10

type UserInfo10 struct {
	Name       *uint16
	Comment    *uint16
	UsrComment *uint16
	FullName   *uint16
}

type WSABuf

type WSABuf struct {
	Len uint32
	Buf *byte
}

type WSAData

type WSAData struct {
	Version      uint16
	HighVersion  uint16
	MaxSockets   uint16
	MaxUdpDg     uint16
	VendorInfo   *byte
	Description  [WSADESCRIPTION_LEN + 1]byte
	SystemStatus [WSASYS_STATUS_LEN + 1]byte
}

type WSAMsg

type WSAMsg struct {
	Name        *syscall.RawSockaddrAny
	Namelen     int32
	Buffers     *WSABuf
	BufferCount uint32
	Control     WSABuf
	Flags       uint32
}

type WSAProtocolChain

type WSAProtocolChain struct {
	ChainLen     int32
	ChainEntries [MAX_PROTOCOL_CHAIN]uint32
}

type WSAProtocolInfo

type WSAProtocolInfo struct {
	ServiceFlags1     uint32
	ServiceFlags2     uint32
	ServiceFlags3     uint32
	ServiceFlags4     uint32
	ProviderFlags     uint32
	ProviderId        GUID
	CatalogEntryId    uint32
	ProtocolChain     WSAProtocolChain
	Version           int32
	AddressFamily     int32
	MaxSockAddr       int32
	MinSockAddr       int32
	SocketType        int32
	Protocol          int32
	ProtocolMaxOffset int32
	NetworkByteOrder  int32
	SecurityScheme    int32
	MessageSize       uint32
	ProviderReserved  uint32
	ProtocolName      [WSAPROTOCOL_LEN + 1]uint16
}

type WaitStatus

type WaitStatus struct {
	ExitCode uint32
}

func (WaitStatus) Continued

func (w WaitStatus) Continued() bool

func (WaitStatus) CoreDump

func (w WaitStatus) CoreDump() bool

func (WaitStatus) ExitStatus

func (w WaitStatus) ExitStatus() int

func (WaitStatus) Exited

func (w WaitStatus) Exited() bool

func (WaitStatus) Signal

func (w WaitStatus) Signal() Signal

func (WaitStatus) Signaled

func (w WaitStatus) Signaled() bool

func (WaitStatus) StopSignal

func (w WaitStatus) StopSignal() Signal

func (WaitStatus) Stopped

func (w WaitStatus) Stopped() bool

func (WaitStatus) TrapCause

func (w WaitStatus) TrapCause() int

type Win32FileAttributeData

type Win32FileAttributeData struct {
	FileAttributes uint32
	CreationTime   Filetime
	LastAccessTime Filetime
	LastWriteTime  Filetime
	FileSizeHigh   uint32
	FileSizeLow    uint32
}

type Win32finddata

type Win32finddata struct {
	FileAttributes    uint32
	CreationTime      Filetime
	LastAccessTime    Filetime
	LastWriteTime     Filetime
	FileSizeHigh      uint32
	FileSizeLow       uint32
	Reserved0         uint32
	Reserved1         uint32
	FileName          [MAX_PATH - 1]uint16
	AlternateFileName [13]uint16
}

Notes

Bugs

  • The definition of Linger is not appropriate for direct use with Setsockopt and Getsockopt. Use SetsockoptLinger instead.

Directories

Path Synopsis
svc
Package svc provides everything required to build Windows service.
Package svc provides everything required to build Windows service.
debug
Package debug provides facilities to execute svc.Handler on console.
Package debug provides facilities to execute svc.Handler on console.
eventlog
Package eventlog implements access to Windows event log.
Package eventlog implements access to Windows event log.
example command
Example service program that beeps.
Example service program that beeps.
mgr
Package mgr can be used to manage Windows service programs.
Package mgr can be used to manage Windows service programs.

Jump to

Keyboard shortcuts

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