1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 ERROR_FILE_NOT_FOUND syscall.Errno = 2
12 ERROR_PATH_NOT_FOUND syscall.Errno = 3
13 ERROR_ACCESS_DENIED syscall.Errno = 5
14 ERROR_NO_MORE_FILES syscall.Errno = 18
15 ERROR_HANDLE_EOF syscall.Errno = 38
16 ERROR_NETNAME_DELETED syscall.Errno = 64
17 ERROR_FILE_EXISTS syscall.Errno = 80
18 ERROR_BROKEN_PIPE syscall.Errno = 109
19 ERROR_BUFFER_OVERFLOW syscall.Errno = 111
20 ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122
21 ERROR_MOD_NOT_FOUND syscall.Errno = 126
22 ERROR_PROC_NOT_FOUND syscall.Errno = 127
23 ERROR_ALREADY_EXISTS syscall.Errno = 183
24 ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203
25 ERROR_MORE_DATA syscall.Errno = 234
26 ERROR_OPERATION_ABORTED syscall.Errno = 995
27 ERROR_IO_PENDING syscall.Errno = 997
28 ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066
29 ERROR_NOT_FOUND syscall.Errno = 1168
30 ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314
31 WSAEACCES syscall.Errno = 10013
32 WSAECONNRESET syscall.Errno = 10054
36 // Invented values to support what package os expects.
52 // More invented values for signals
68 var signals = [...]string{
72 4: "illegal instruction",
73 5: "trace/breakpoint trap",
76 8: "floating point exception",
78 10: "user defined signal 1",
79 11: "segmentation fault",
80 12: "user defined signal 2",
87 GENERIC_READ = 0x80000000
88 GENERIC_WRITE = 0x40000000
89 GENERIC_EXECUTE = 0x20000000
90 GENERIC_ALL = 0x10000000
92 FILE_LIST_DIRECTORY = 0x00000001
93 FILE_APPEND_DATA = 0x00000004
94 FILE_WRITE_ATTRIBUTES = 0x00000100
96 FILE_SHARE_READ = 0x00000001
97 FILE_SHARE_WRITE = 0x00000002
98 FILE_SHARE_DELETE = 0x00000004
99 FILE_ATTRIBUTE_READONLY = 0x00000001
100 FILE_ATTRIBUTE_HIDDEN = 0x00000002
101 FILE_ATTRIBUTE_SYSTEM = 0x00000004
102 FILE_ATTRIBUTE_DIRECTORY = 0x00000010
103 FILE_ATTRIBUTE_ARCHIVE = 0x00000020
104 FILE_ATTRIBUTE_NORMAL = 0x00000080
105 FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
107 INVALID_FILE_ATTRIBUTES = 0xffffffff
113 TRUNCATE_EXISTING = 5
115 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
116 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
117 FILE_FLAG_OVERLAPPED = 0x40000000
119 HANDLE_FLAG_INHERIT = 0x00000001
120 STARTF_USESTDHANDLES = 0x00000100
121 STARTF_USESHOWWINDOW = 0x00000001
122 DUPLICATE_CLOSE_SOURCE = 0x00000001
123 DUPLICATE_SAME_ACCESS = 0x00000002
125 STD_INPUT_HANDLE = -10 & (1<<32 - 1)
126 STD_OUTPUT_HANDLE = -11 & (1<<32 - 1)
127 STD_ERROR_HANDLE = -12 & (1<<32 - 1)
134 SUBLANG_ENGLISH_US = 0x01
136 FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
137 FORMAT_MESSAGE_IGNORE_INSERTS = 512
138 FORMAT_MESSAGE_FROM_STRING = 1024
139 FORMAT_MESSAGE_FROM_HMODULE = 2048
140 FORMAT_MESSAGE_FROM_SYSTEM = 4096
141 FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
142 FORMAT_MESSAGE_MAX_WIDTH_MASK = 255
145 MAX_LONG_PATH = 32768
147 MAX_COMPUTERNAME_LENGTH = 15
149 TIME_ZONE_ID_UNKNOWN = 0
150 TIME_ZONE_ID_STANDARD = 1
152 TIME_ZONE_ID_DAYLIGHT = 2
154 INFINITE = 0xffffffff
157 WAIT_ABANDONED = 0x00000080
158 WAIT_OBJECT_0 = 0x00000000
159 WAIT_FAILED = 0xFFFFFFFF
161 CREATE_NEW_PROCESS_GROUP = 0x00000200
162 CREATE_UNICODE_ENVIRONMENT = 0x00000400
164 PROCESS_TERMINATE = 1
165 PROCESS_QUERY_INFORMATION = 0x00000400
166 SYNCHRONIZE = 0x00100000
169 FILE_MAP_WRITE = 0x02
171 FILE_MAP_EXECUTE = 0x20
176 // Windows reserves errors >= 1<<29 for application use.
177 APPLICATION_ERROR = 1 << 29
181 // flags for CreateToolhelp32Snapshot
182 TH32CS_SNAPHEAPLIST = 0x01
183 TH32CS_SNAPPROCESS = 0x02
184 TH32CS_SNAPTHREAD = 0x04
185 TH32CS_SNAPMODULE = 0x08
186 TH32CS_SNAPMODULE32 = 0x10
187 TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
188 TH32CS_INHERIT = 0x80000000
192 // filters for ReadDirectoryChangesW
193 FILE_NOTIFY_CHANGE_FILE_NAME = 0x001
194 FILE_NOTIFY_CHANGE_DIR_NAME = 0x002
195 FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004
196 FILE_NOTIFY_CHANGE_SIZE = 0x008
197 FILE_NOTIFY_CHANGE_LAST_WRITE = 0x010
198 FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x020
199 FILE_NOTIFY_CHANGE_CREATION = 0x040
200 FILE_NOTIFY_CHANGE_SECURITY = 0x100
205 FILE_ACTION_ADDED = iota + 1
208 FILE_ACTION_RENAMED_OLD_NAME
209 FILE_ACTION_RENAMED_NEW_NAME
220 PROV_RSA_SCHANNEL = 12
222 PROV_EC_ECDSA_SIG = 14
223 PROV_EC_ECNRA_SIG = 15
224 PROV_EC_ECDSA_FULL = 16
225 PROV_EC_ECNRA_FULL = 17
226 PROV_DH_SCHANNEL = 18
227 PROV_SPYRUS_LYNKS = 20
230 PROV_REPLACE_OWF = 23
232 CRYPT_VERIFYCONTEXT = 0xF0000000
233 CRYPT_NEWKEYSET = 0x00000008
234 CRYPT_DELETEKEYSET = 0x00000010
235 CRYPT_MACHINE_KEYSET = 0x00000020
236 CRYPT_SILENT = 0x00000040
237 CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080
239 USAGE_MATCH_TYPE_AND = 0
240 USAGE_MATCH_TYPE_OR = 1
242 X509_ASN_ENCODING = 0x00000001
243 PKCS_7_ASN_ENCODING = 0x00010000
245 CERT_STORE_PROV_MEMORY = 2
247 CERT_STORE_ADD_ALWAYS = 4
249 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004
251 CERT_TRUST_NO_ERROR = 0x00000000
252 CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001
253 CERT_TRUST_IS_REVOKED = 0x00000004
254 CERT_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008
255 CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010
256 CERT_TRUST_IS_UNTRUSTED_ROOT = 0x00000020
257 CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040
258 CERT_TRUST_IS_CYCLIC = 0x00000080
259 CERT_TRUST_INVALID_EXTENSION = 0x00000100
260 CERT_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200
261 CERT_TRUST_INVALID_BASIC_CONSTRAINTS = 0x00000400
262 CERT_TRUST_INVALID_NAME_CONSTRAINTS = 0x00000800
263 CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000
264 CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000
265 CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000
266 CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000
267 CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000
268 CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000
269 CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000
270 CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000
272 CERT_CHAIN_POLICY_BASE = 1
273 CERT_CHAIN_POLICY_AUTHENTICODE = 2
274 CERT_CHAIN_POLICY_AUTHENTICODE_TS = 3
275 CERT_CHAIN_POLICY_SSL = 4
276 CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = 5
277 CERT_CHAIN_POLICY_NT_AUTH = 6
278 CERT_CHAIN_POLICY_MICROSOFT_ROOT = 7
279 CERT_CHAIN_POLICY_EV = 8
281 CERT_E_EXPIRED = 0x800B0101
282 CERT_E_ROLE = 0x800B0103
283 CERT_E_PURPOSE = 0x800B0106
284 CERT_E_UNTRUSTEDROOT = 0x800B0109
285 CERT_E_CN_NO_MATCH = 0x800B010F
292 OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
293 OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
294 OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
297 // Invented values to support what package os expects.
298 type Timeval struct {
303 func (tv *Timeval) Nanoseconds() int64 {
304 return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3
307 func NsecToTimeval(nsec int64) (tv Timeval) {
308 tv.Sec = int32(nsec / 1e9)
309 tv.Usec = int32(nsec % 1e9 / 1e3)
313 type SecurityAttributes struct {
315 SecurityDescriptor uintptr
319 type Overlapped struct {
327 type FileNotifyInformation struct {
328 NextEntryOffset uint32
330 FileNameLength uint32
334 type Filetime struct {
339 // Nanoseconds returns Filetime ft in nanoseconds
340 // since Epoch (00:00:00 UTC, January 1, 1970).
341 func (ft *Filetime) Nanoseconds() int64 {
342 // 100-nanosecond intervals since January 1, 1601
343 nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime)
344 // change starting time to the Epoch (00:00:00 UTC, January 1, 1970)
345 nsec -= 116444736000000000
346 // convert into nanoseconds
351 func NsecToFiletime(nsec int64) (ft Filetime) {
352 // convert into 100-nanosecond
354 // change starting time to January 1, 1601
355 nsec += 116444736000000000
356 // split into high / low
357 ft.LowDateTime = uint32(nsec & 0xffffffff)
358 ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff)
362 type Win32finddata struct {
363 FileAttributes uint32
364 CreationTime Filetime
365 LastAccessTime Filetime
366 LastWriteTime Filetime
371 FileName [MAX_PATH - 1]uint16
372 AlternateFileName [13]uint16
375 // This is the actual system call structure.
376 // Win32finddata is what we committed to in Go 1.
377 type win32finddata1 struct {
378 FileAttributes uint32
379 CreationTime Filetime
380 LastAccessTime Filetime
381 LastWriteTime Filetime
386 FileName [MAX_PATH]uint16
387 AlternateFileName [14]uint16
390 func copyFindData(dst *Win32finddata, src *win32finddata1) {
391 dst.FileAttributes = src.FileAttributes
392 dst.CreationTime = src.CreationTime
393 dst.LastAccessTime = src.LastAccessTime
394 dst.LastWriteTime = src.LastWriteTime
395 dst.FileSizeHigh = src.FileSizeHigh
396 dst.FileSizeLow = src.FileSizeLow
397 dst.Reserved0 = src.Reserved0
398 dst.Reserved1 = src.Reserved1
400 // The src is 1 element bigger than dst, but it must be NUL.
401 copy(dst.FileName[:], src.FileName[:])
402 copy(dst.AlternateFileName[:], src.AlternateFileName[:])
405 type ByHandleFileInformation struct {
406 FileAttributes uint32
407 CreationTime Filetime
408 LastAccessTime Filetime
409 LastWriteTime Filetime
410 VolumeSerialNumber uint32
419 GetFileExInfoStandard = 0
420 GetFileExMaxInfoLevel = 1
423 type Win32FileAttributeData struct {
424 FileAttributes uint32
425 CreationTime Filetime
426 LastAccessTime Filetime
427 LastWriteTime Filetime
432 // ShowWindow constants
441 SW_SHOWNOACTIVATE = 4
444 SW_SHOWMINNOACTIVE = 7
448 SW_FORCEMINIMIZE = 11
451 type StartupInfo struct {
472 type ProcessInformation struct {
479 type ProcessEntry32 struct {
483 DefaultHeapID uintptr
486 ParentProcessID uint32
489 ExeFile [MAX_PATH]uint16
492 type Systemtime struct {
503 type Timezoneinformation struct {
505 StandardName [32]uint16
506 StandardDate Systemtime
508 DaylightName [32]uint16
509 DaylightDate Systemtime
540 SO_UPDATE_ACCEPT_CONTEXT = 0x700b
541 SO_UPDATE_CONNECT_CONTEXT = 0x7010
545 IOC_VENDOR = 0x18000000
546 IOC_INOUT = IOC_IN | IOC_OUT
548 SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
549 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4
550 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
552 // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460
556 IP_MULTICAST_IF = 0x9
557 IP_MULTICAST_TTL = 0xa
558 IP_MULTICAST_LOOP = 0xb
559 IP_ADD_MEMBERSHIP = 0xc
560 IP_DROP_MEMBERSHIP = 0xd
563 IPV6_UNICAST_HOPS = 0x4
564 IPV6_MULTICAST_IF = 0x9
565 IPV6_MULTICAST_HOPS = 0xa
566 IPV6_MULTICAST_LOOP = 0xb
567 IPV6_JOIN_GROUP = 0xc
568 IPV6_LEAVE_GROUP = 0xd
570 SOMAXCONN = 0x7fffffff
578 WSADESCRIPTION_LEN = 256
579 WSASYS_STATUS_LEN = 128
587 // Invented values to support what package os expects.
607 FILE_TYPE_CHAR = 0x0002
608 FILE_TYPE_DISK = 0x0001
609 FILE_TYPE_PIPE = 0x0003
610 FILE_TYPE_REMOTE = 0x8000
611 FILE_TYPE_UNKNOWN = 0x0000
614 type Hostent struct {
622 type Protoent struct {
633 DNS_TYPE_CNAME = 0x0005
634 DNS_TYPE_SOA = 0x0006
638 DNS_TYPE_NULL = 0x000a
639 DNS_TYPE_WKS = 0x000b
640 DNS_TYPE_PTR = 0x000c
641 DNS_TYPE_HINFO = 0x000d
642 DNS_TYPE_MINFO = 0x000e
644 DNS_TYPE_TEXT = 0x0010
646 DNS_TYPE_AFSDB = 0x0012
647 DNS_TYPE_X25 = 0x0013
648 DNS_TYPE_ISDN = 0x0014
650 DNS_TYPE_NSAP = 0x0016
651 DNS_TYPE_NSAPPTR = 0x0017
652 DNS_TYPE_SIG = 0x0018
653 DNS_TYPE_KEY = 0x0019
655 DNS_TYPE_GPOS = 0x001b
656 DNS_TYPE_AAAA = 0x001c
657 DNS_TYPE_LOC = 0x001d
658 DNS_TYPE_NXT = 0x001e
659 DNS_TYPE_EID = 0x001f
660 DNS_TYPE_NIMLOC = 0x0020
661 DNS_TYPE_SRV = 0x0021
662 DNS_TYPE_ATMA = 0x0022
663 DNS_TYPE_NAPTR = 0x0023
665 DNS_TYPE_CERT = 0x0025
667 DNS_TYPE_DNAME = 0x0027
668 DNS_TYPE_SINK = 0x0028
669 DNS_TYPE_OPT = 0x0029
671 DNS_TYPE_RRSIG = 0x002E
672 DNS_TYPE_NSEC = 0x002F
673 DNS_TYPE_DNSKEY = 0x0030
674 DNS_TYPE_DHCID = 0x0031
675 DNS_TYPE_UINFO = 0x0064
676 DNS_TYPE_UID = 0x0065
677 DNS_TYPE_GID = 0x0066
678 DNS_TYPE_UNSPEC = 0x0067
679 DNS_TYPE_ADDRS = 0x00f8
680 DNS_TYPE_TKEY = 0x00f9
681 DNS_TYPE_TSIG = 0x00fa
682 DNS_TYPE_IXFR = 0x00fb
683 DNS_TYPE_AXFR = 0x00fc
684 DNS_TYPE_MAILB = 0x00fd
685 DNS_TYPE_MAILA = 0x00fe
686 DNS_TYPE_ALL = 0x00ff
687 DNS_TYPE_ANY = 0x00ff
688 DNS_TYPE_WINS = 0xff01
689 DNS_TYPE_WINSR = 0xff02
690 DNS_TYPE_NBSTAT = 0xff01
694 DNS_INFO_NO_RECORDS = 0x251D
698 // flags inside DNSRecord.Dw
699 DnsSectionQuestion = 0x0000
700 DnsSectionAnswer = 0x0001
701 DnsSectionAuthority = 0x0002
702 DnsSectionAdditional = 0x0003
705 type DNSSRVData struct {
713 type DNSPTRData struct {
717 type DNSMXData struct {
723 type DNSTXTData struct {
725 StringArray [1]*uint16
728 type DNSRecord struct {
743 TF_USE_DEFAULT_WORKER = 0
744 TF_USE_SYSTEM_THREAD = 16
745 TF_USE_KERNEL_APC = 32
748 type TransmitFileBuffers struct {
763 const SIO_GET_INTERFACE_LIST = 0x4004747F
765 // TODO(mattn): SockaddrGen is union of sockaddr/sockaddr_in/sockaddr_in6_old.
766 // will be fixed to change variable type as suitable.
768 type SockaddrGen [24]byte
770 type InterfaceInfo struct {
773 BroadcastAddress SockaddrGen
777 type IpAddressString struct {
781 type IpMaskString IpAddressString
783 type IpAddrString struct {
785 IpAddress IpAddressString
790 const MAX_ADAPTER_NAME_LENGTH = 256
791 const MAX_ADAPTER_DESCRIPTION_LENGTH = 128
792 const MAX_ADAPTER_ADDRESS_LENGTH = 8
794 type IpAdapterInfo struct {
797 AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte
798 Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte
800 Address [MAX_ADAPTER_ADDRESS_LENGTH]byte
804 CurrentIpAddress *IpAddrString
805 IpAddressList IpAddrString
806 GatewayList IpAddrString
807 DhcpServer IpAddrString
809 PrimaryWinsServer IpAddrString
810 SecondaryWinsServer IpAddrString
815 const MAXLEN_PHYSADDR = 8
816 const MAX_INTERFACE_NAME_LEN = 256
817 const MAXLEN_IFDESCR = 256
819 type MibIfRow struct {
820 Name [MAX_INTERFACE_NAME_LEN]uint16
826 PhysAddr [MAXLEN_PHYSADDR]byte
835 InUnknownProtos uint32
843 Descr [MAXLEN_IFDESCR]byte
846 type CertContext struct {
854 type CertChainContext struct {
856 TrustStatus CertTrustStatus
858 Chains **CertSimpleChain
859 LowerQualityChainCount uint32
860 LowerQualityChains **CertChainContext
861 HasRevocationFreshnessTime uint32
862 RevocationFreshnessTime uint32
865 type CertSimpleChain struct {
867 TrustStatus CertTrustStatus
869 Elements **CertChainElement
870 TrustListInfo uintptr
871 HasRevocationFreshnessTime uint32
872 RevocationFreshnessTime uint32
875 type CertChainElement struct {
877 CertContext *CertContext
878 TrustStatus CertTrustStatus
879 RevocationInfo *CertRevocationInfo
880 IssuanceUsage *CertEnhKeyUsage
881 ApplicationUsage *CertEnhKeyUsage
882 ExtendedErrorInfo *uint16
885 type CertRevocationInfo struct {
887 RevocationResult uint32
889 OidSpecificInfo uintptr
890 HasFreshnessTime uint32
892 CrlInfo uintptr // *CertRevocationCrlInfo
895 type CertTrustStatus struct {
900 type CertUsageMatch struct {
902 Usage CertEnhKeyUsage
905 type CertEnhKeyUsage struct {
907 UsageIdentifiers **byte
910 type CertChainPara struct {
912 RequestedUsage CertUsageMatch
913 RequstedIssuancePolicy CertUsageMatch
914 URLRetrievalTimeout uint32
915 CheckRevocationFreshnessTime uint32
916 RevocationFreshnessTime uint32
917 CacheResync *Filetime
920 type CertChainPolicyPara struct {
923 ExtraPolicyPara uintptr
926 type SSLExtraCertChainPolicyPara struct {
933 type CertChainPolicyStatus struct {
938 ExtraPolicyStatus uintptr
943 HKEY_CLASSES_ROOT = 0x80000000 + iota
947 HKEY_PERFORMANCE_DATA
953 KEY_CREATE_SUB_KEY = 4
954 KEY_ENUMERATE_SUB_KEYS = 8
958 KEY_EXECUTE = 0x20019
960 KEY_WOW64_64KEY = 0x0100
961 KEY_WOW64_32KEY = 0x0200
962 KEY_ALL_ACCESS = 0xf003f
971 REG_DWORD_LITTLE_ENDIAN
976 REG_FULL_RESOURCE_DESCRIPTOR
977 REG_RESOURCE_REQUIREMENTS_LIST
978 REG_QWORD_LITTLE_ENDIAN
979 REG_DWORD = REG_DWORD_LITTLE_ENDIAN
980 REG_QWORD = REG_QWORD_LITTLE_ENDIAN
983 type AddrinfoW struct {
1007 var WSAID_CONNECTEX = GUID{
1011 [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e},
1015 FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1
1016 FILE_SKIP_SET_EVENT_ON_HANDLE = 2
1020 WSAPROTOCOL_LEN = 255
1021 MAX_PROTOCOL_CHAIN = 7
1023 LAYERED_PROTOCOL = 0
1025 XP1_CONNECTIONLESS = 0x00000001
1026 XP1_GUARANTEED_DELIVERY = 0x00000002
1027 XP1_GUARANTEED_ORDER = 0x00000004
1028 XP1_MESSAGE_ORIENTED = 0x00000008
1029 XP1_PSEUDO_STREAM = 0x00000010
1030 XP1_GRACEFUL_CLOSE = 0x00000020
1031 XP1_EXPEDITED_DATA = 0x00000040
1032 XP1_CONNECT_DATA = 0x00000080
1033 XP1_DISCONNECT_DATA = 0x00000100
1034 XP1_SUPPORT_BROADCAST = 0x00000200
1035 XP1_SUPPORT_MULTIPOINT = 0x00000400
1036 XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800
1037 XP1_MULTIPOINT_DATA_PLANE = 0x00001000
1038 XP1_QOS_SUPPORTED = 0x00002000
1039 XP1_UNI_SEND = 0x00008000
1040 XP1_UNI_RECV = 0x00010000
1041 XP1_IFS_HANDLES = 0x00020000
1042 XP1_PARTIAL_MESSAGE = 0x00040000
1043 XP1_SAN_SUPPORT_SDP = 0x00080000
1045 PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001
1046 PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002
1047 PFL_HIDDEN = 0x00000004
1048 PFL_MATCHES_PROTOCOL_ZERO = 0x00000008
1049 PFL_NETWORKDIRECT_PROVIDER = 0x00000010
1052 type WSAProtocolInfo struct {
1053 ServiceFlags1 uint32
1054 ServiceFlags2 uint32
1055 ServiceFlags3 uint32
1056 ServiceFlags4 uint32
1057 ProviderFlags uint32
1059 CatalogEntryId uint32
1060 ProtocolChain WSAProtocolChain
1067 ProtocolMaxOffset int32
1068 NetworkByteOrder int32
1069 SecurityScheme int32
1071 ProviderReserved uint32
1072 ProtocolName [WSAPROTOCOL_LEN + 1]uint16
1075 type WSAProtocolChain struct {
1077 ChainEntries [MAX_PROTOCOL_CHAIN]uint32
1080 type TCPKeepalive struct {
1086 type symbolicLinkReparseBuffer struct {
1087 SubstituteNameOffset uint16
1088 SubstituteNameLength uint16
1089 PrintNameOffset uint16
1090 PrintNameLength uint16
1092 PathBuffer [1]uint16
1095 type mountPointReparseBuffer struct {
1096 SubstituteNameOffset uint16
1097 SubstituteNameLength uint16
1098 PrintNameOffset uint16
1099 PrintNameLength uint16
1100 PathBuffer [1]uint16
1103 type reparseDataBuffer struct {
1105 ReparseDataLength uint16
1108 // GenericReparseBuffer
1113 FSCTL_GET_REPARSE_POINT = 0x900A8
1114 MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
1115 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
1116 IO_REPARSE_TAG_SYMLINK = 0xA000000C
1117 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
1121 ComputerNameNetBIOS = 0
1122 ComputerNameDnsHostname = 1
1123 ComputerNameDnsDomain = 2
1124 ComputerNameDnsFullyQualified = 3
1125 ComputerNamePhysicalNetBIOS = 4
1126 ComputerNamePhysicalDnsHostname = 5
1127 ComputerNamePhysicalDnsDomain = 6
1128 ComputerNamePhysicalDnsFullyQualified = 7
1133 MOVEFILE_REPLACE_EXISTING = 0x1
1134 MOVEFILE_COPY_ALLOWED = 0x2
1135 MOVEFILE_DELAY_UNTIL_REBOOT = 0x4
1136 MOVEFILE_WRITE_THROUGH = 0x8
1137 MOVEFILE_CREATE_HARDLINK = 0x10
1138 MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20
1141 const GAA_FLAG_INCLUDE_PREFIX = 0x00000010
1145 IF_TYPE_ETHERNET_CSMACD = 6
1146 IF_TYPE_ISO88025_TOKENRING = 9
1148 IF_TYPE_SOFTWARE_LOOPBACK = 24
1150 IF_TYPE_IEEE80211 = 71
1151 IF_TYPE_TUNNEL = 131
1152 IF_TYPE_IEEE1394 = 144
1155 type SocketAddress struct {
1156 Sockaddr *syscall.RawSockaddrAny
1157 SockaddrLength int32
1160 type IpAdapterUnicastAddress struct {
1163 Next *IpAdapterUnicastAddress
1164 Address SocketAddress
1168 ValidLifetime uint32
1169 PreferredLifetime uint32
1170 LeaseLifetime uint32
1171 OnLinkPrefixLength uint8
1174 type IpAdapterAnycastAddress struct {
1177 Next *IpAdapterAnycastAddress
1178 Address SocketAddress
1181 type IpAdapterMulticastAddress struct {
1184 Next *IpAdapterMulticastAddress
1185 Address SocketAddress
1188 type IpAdapterDnsServerAdapter struct {
1191 Next *IpAdapterDnsServerAdapter
1192 Address SocketAddress
1195 type IpAdapterPrefix struct {
1198 Next *IpAdapterPrefix
1199 Address SocketAddress
1203 type IpAdapterAddresses struct {
1206 Next *IpAdapterAddresses
1208 FirstUnicastAddress *IpAdapterUnicastAddress
1209 FirstAnycastAddress *IpAdapterAnycastAddress
1210 FirstMulticastAddress *IpAdapterMulticastAddress
1211 FirstDnsServerAddress *IpAdapterDnsServerAdapter
1214 FriendlyName *uint16
1215 PhysicalAddress [syscall.MAX_ADAPTER_ADDRESS_LENGTH]byte
1216 PhysicalAddressLength uint32
1222 ZoneIndices [16]uint32
1223 FirstPrefix *IpAdapterPrefix
1224 /* more fields might be present here. */
1229 IfOperStatusDown = 2
1230 IfOperStatusTesting = 3
1231 IfOperStatusUnknown = 4
1232 IfOperStatusDormant = 5
1233 IfOperStatusNotPresent = 6
1234 IfOperStatusLowerLayerDown = 7
1237 // Console related constants used for the mode parameter to SetConsoleMode. See
1238 // https://docs.microsoft.com/en-us/windows/console/setconsolemode for details.
1241 ENABLE_PROCESSED_INPUT = 0x1
1242 ENABLE_LINE_INPUT = 0x2
1243 ENABLE_ECHO_INPUT = 0x4
1244 ENABLE_WINDOW_INPUT = 0x8
1245 ENABLE_MOUSE_INPUT = 0x10
1246 ENABLE_INSERT_MODE = 0x20
1247 ENABLE_QUICK_EDIT_MODE = 0x40
1248 ENABLE_EXTENDED_FLAGS = 0x80
1249 ENABLE_AUTO_POSITION = 0x100
1250 ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200
1252 ENABLE_PROCESSED_OUTPUT = 0x1
1253 ENABLE_WRAP_AT_EOL_OUTPUT = 0x2
1254 ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
1255 DISABLE_NEWLINE_AUTO_RETURN = 0x8
1256 ENABLE_LVB_GRID_WORLDWIDE = 0x10
1264 type SmallRect struct {
1271 // Used with GetConsoleScreenBuffer to retreive information about a console
1272 // screen buffer. See
1273 // https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str
1276 type ConsoleScreenBufferInfo struct {
1278 CursorPosition Coord
1281 MaximumWindowSize Coord