...
Source file src/pkg/syscall/types_windows.go
1
2
3
4
5 package syscall
6
7 const (
8
9 ERROR_FILE_NOT_FOUND Errno = 2
10 ERROR_PATH_NOT_FOUND Errno = 3
11 ERROR_ACCESS_DENIED Errno = 5
12 ERROR_NO_MORE_FILES Errno = 18
13 ERROR_HANDLE_EOF Errno = 38
14 ERROR_NETNAME_DELETED Errno = 64
15 ERROR_FILE_EXISTS Errno = 80
16 ERROR_BROKEN_PIPE Errno = 109
17 ERROR_BUFFER_OVERFLOW Errno = 111
18 ERROR_INSUFFICIENT_BUFFER Errno = 122
19 ERROR_MOD_NOT_FOUND Errno = 126
20 ERROR_PROC_NOT_FOUND Errno = 127
21 ERROR_DIR_NOT_EMPTY Errno = 145
22 ERROR_ALREADY_EXISTS Errno = 183
23 ERROR_ENVVAR_NOT_FOUND Errno = 203
24 ERROR_MORE_DATA Errno = 234
25 ERROR_OPERATION_ABORTED Errno = 995
26 ERROR_IO_PENDING Errno = 997
27 ERROR_NOT_FOUND Errno = 1168
28 ERROR_PRIVILEGE_NOT_HELD Errno = 1314
29 WSAEACCES Errno = 10013
30 WSAECONNABORTED Errno = 10053
31 WSAECONNRESET Errno = 10054
32 )
33
34 const (
35
36 O_RDONLY = 0x00000
37 O_WRONLY = 0x00001
38 O_RDWR = 0x00002
39 O_CREAT = 0x00040
40 O_EXCL = 0x00080
41 O_NOCTTY = 0x00100
42 O_TRUNC = 0x00200
43 O_NONBLOCK = 0x00800
44 O_APPEND = 0x00400
45 O_SYNC = 0x01000
46 O_ASYNC = 0x02000
47 O_CLOEXEC = 0x80000
48 )
49
50 const (
51
52 SIGHUP = Signal(0x1)
53 SIGINT = Signal(0x2)
54 SIGQUIT = Signal(0x3)
55 SIGILL = Signal(0x4)
56 SIGTRAP = Signal(0x5)
57 SIGABRT = Signal(0x6)
58 SIGBUS = Signal(0x7)
59 SIGFPE = Signal(0x8)
60 SIGKILL = Signal(0x9)
61 SIGSEGV = Signal(0xb)
62 SIGPIPE = Signal(0xd)
63 SIGALRM = Signal(0xe)
64 SIGTERM = Signal(0xf)
65 )
66
67 var signals = [...]string{
68 1: "hangup",
69 2: "interrupt",
70 3: "quit",
71 4: "illegal instruction",
72 5: "trace/breakpoint trap",
73 6: "aborted",
74 7: "bus error",
75 8: "floating point exception",
76 9: "killed",
77 10: "user defined signal 1",
78 11: "segmentation fault",
79 12: "user defined signal 2",
80 13: "broken pipe",
81 14: "alarm clock",
82 15: "terminated",
83 }
84
85 const (
86 GENERIC_READ = 0x80000000
87 GENERIC_WRITE = 0x40000000
88 GENERIC_EXECUTE = 0x20000000
89 GENERIC_ALL = 0x10000000
90
91 FILE_LIST_DIRECTORY = 0x00000001
92 FILE_APPEND_DATA = 0x00000004
93 FILE_WRITE_ATTRIBUTES = 0x00000100
94
95 FILE_SHARE_READ = 0x00000001
96 FILE_SHARE_WRITE = 0x00000002
97 FILE_SHARE_DELETE = 0x00000004
98 FILE_ATTRIBUTE_READONLY = 0x00000001
99 FILE_ATTRIBUTE_HIDDEN = 0x00000002
100 FILE_ATTRIBUTE_SYSTEM = 0x00000004
101 FILE_ATTRIBUTE_DIRECTORY = 0x00000010
102 FILE_ATTRIBUTE_ARCHIVE = 0x00000020
103 FILE_ATTRIBUTE_NORMAL = 0x00000080
104 FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
105
106 INVALID_FILE_ATTRIBUTES = 0xffffffff
107
108 CREATE_NEW = 1
109 CREATE_ALWAYS = 2
110 OPEN_EXISTING = 3
111 OPEN_ALWAYS = 4
112 TRUNCATE_EXISTING = 5
113
114 FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
115 FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
116 FILE_FLAG_OVERLAPPED = 0x40000000
117
118 HANDLE_FLAG_INHERIT = 0x00000001
119 STARTF_USESTDHANDLES = 0x00000100
120 STARTF_USESHOWWINDOW = 0x00000001
121 DUPLICATE_CLOSE_SOURCE = 0x00000001
122 DUPLICATE_SAME_ACCESS = 0x00000002
123
124 STD_INPUT_HANDLE = -10
125 STD_OUTPUT_HANDLE = -11
126 STD_ERROR_HANDLE = -12
127
128 FILE_BEGIN = 0
129 FILE_CURRENT = 1
130 FILE_END = 2
131
132 LANG_ENGLISH = 0x09
133 SUBLANG_ENGLISH_US = 0x01
134
135 FORMAT_MESSAGE_ALLOCATE_BUFFER = 256
136 FORMAT_MESSAGE_IGNORE_INSERTS = 512
137 FORMAT_MESSAGE_FROM_STRING = 1024
138 FORMAT_MESSAGE_FROM_HMODULE = 2048
139 FORMAT_MESSAGE_FROM_SYSTEM = 4096
140 FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192
141 FORMAT_MESSAGE_MAX_WIDTH_MASK = 255
142
143 MAX_PATH = 260
144 MAX_LONG_PATH = 32768
145
146 MAX_COMPUTERNAME_LENGTH = 15
147
148 TIME_ZONE_ID_UNKNOWN = 0
149 TIME_ZONE_ID_STANDARD = 1
150
151 TIME_ZONE_ID_DAYLIGHT = 2
152 IGNORE = 0
153 INFINITE = 0xffffffff
154
155 WAIT_TIMEOUT = 258
156 WAIT_ABANDONED = 0x00000080
157 WAIT_OBJECT_0 = 0x00000000
158 WAIT_FAILED = 0xFFFFFFFF
159
160 CREATE_NEW_PROCESS_GROUP = 0x00000200
161 CREATE_UNICODE_ENVIRONMENT = 0x00000400
162
163 PROCESS_TERMINATE = 1
164 PROCESS_QUERY_INFORMATION = 0x00000400
165 SYNCHRONIZE = 0x00100000
166
167 PAGE_READONLY = 0x02
168 PAGE_READWRITE = 0x04
169 PAGE_WRITECOPY = 0x08
170 PAGE_EXECUTE_READ = 0x20
171 PAGE_EXECUTE_READWRITE = 0x40
172 PAGE_EXECUTE_WRITECOPY = 0x80
173
174 FILE_MAP_COPY = 0x01
175 FILE_MAP_WRITE = 0x02
176 FILE_MAP_READ = 0x04
177 FILE_MAP_EXECUTE = 0x20
178
179 CTRL_C_EVENT = 0
180 CTRL_BREAK_EVENT = 1
181 )
182
183 const (
184
185 TH32CS_SNAPHEAPLIST = 0x01
186 TH32CS_SNAPPROCESS = 0x02
187 TH32CS_SNAPTHREAD = 0x04
188 TH32CS_SNAPMODULE = 0x08
189 TH32CS_SNAPMODULE32 = 0x10
190 TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
191 TH32CS_INHERIT = 0x80000000
192 )
193
194 const (
195
196 FILE_NOTIFY_CHANGE_FILE_NAME = 1 << iota
197 FILE_NOTIFY_CHANGE_DIR_NAME
198 FILE_NOTIFY_CHANGE_ATTRIBUTES
199 FILE_NOTIFY_CHANGE_SIZE
200 FILE_NOTIFY_CHANGE_LAST_WRITE
201 FILE_NOTIFY_CHANGE_LAST_ACCESS
202 FILE_NOTIFY_CHANGE_CREATION
203 )
204
205 const (
206
207 FILE_ACTION_ADDED = iota + 1
208 FILE_ACTION_REMOVED
209 FILE_ACTION_MODIFIED
210 FILE_ACTION_RENAMED_OLD_NAME
211 FILE_ACTION_RENAMED_NEW_NAME
212 )
213
214 const (
215
216 PROV_RSA_FULL = 1
217 PROV_RSA_SIG = 2
218 PROV_DSS = 3
219 PROV_FORTEZZA = 4
220 PROV_MS_EXCHANGE = 5
221 PROV_SSL = 6
222 PROV_RSA_SCHANNEL = 12
223 PROV_DSS_DH = 13
224 PROV_EC_ECDSA_SIG = 14
225 PROV_EC_ECNRA_SIG = 15
226 PROV_EC_ECDSA_FULL = 16
227 PROV_EC_ECNRA_FULL = 17
228 PROV_DH_SCHANNEL = 18
229 PROV_SPYRUS_LYNKS = 20
230 PROV_RNG = 21
231 PROV_INTEL_SEC = 22
232 PROV_REPLACE_OWF = 23
233 PROV_RSA_AES = 24
234 CRYPT_VERIFYCONTEXT = 0xF0000000
235 CRYPT_NEWKEYSET = 0x00000008
236 CRYPT_DELETEKEYSET = 0x00000010
237 CRYPT_MACHINE_KEYSET = 0x00000020
238 CRYPT_SILENT = 0x00000040
239 CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080
240
241 USAGE_MATCH_TYPE_AND = 0
242 USAGE_MATCH_TYPE_OR = 1
243
244 X509_ASN_ENCODING = 0x00000001
245 PKCS_7_ASN_ENCODING = 0x00010000
246
247 CERT_STORE_PROV_MEMORY = 2
248
249 CERT_STORE_ADD_ALWAYS = 4
250
251 CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004
252
253 CERT_TRUST_NO_ERROR = 0x00000000
254 CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001
255 CERT_TRUST_IS_REVOKED = 0x00000004
256 CERT_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008
257 CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010
258 CERT_TRUST_IS_UNTRUSTED_ROOT = 0x00000020
259 CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040
260 CERT_TRUST_IS_CYCLIC = 0x00000080
261 CERT_TRUST_INVALID_EXTENSION = 0x00000100
262 CERT_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200
263 CERT_TRUST_INVALID_BASIC_CONSTRAINTS = 0x00000400
264 CERT_TRUST_INVALID_NAME_CONSTRAINTS = 0x00000800
265 CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000
266 CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000
267 CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000
268 CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000
269 CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000
270 CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000
271 CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000
272 CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000
273
274 CERT_CHAIN_POLICY_BASE = 1
275 CERT_CHAIN_POLICY_AUTHENTICODE = 2
276 CERT_CHAIN_POLICY_AUTHENTICODE_TS = 3
277 CERT_CHAIN_POLICY_SSL = 4
278 CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = 5
279 CERT_CHAIN_POLICY_NT_AUTH = 6
280 CERT_CHAIN_POLICY_MICROSOFT_ROOT = 7
281 CERT_CHAIN_POLICY_EV = 8
282
283 CERT_E_EXPIRED = 0x800B0101
284 CERT_E_ROLE = 0x800B0103
285 CERT_E_PURPOSE = 0x800B0106
286 CERT_E_UNTRUSTEDROOT = 0x800B0109
287 CERT_E_CN_NO_MATCH = 0x800B010F
288
289 AUTHTYPE_CLIENT = 1
290 AUTHTYPE_SERVER = 2
291 )
292
293 var (
294 OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
295 OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
296 OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
297 )
298
299
300
301
302
303
304
305 type Pointer *struct{}
306
307
308 type Timeval struct {
309 Sec int32
310 Usec int32
311 }
312
313 func (tv *Timeval) Nanoseconds() int64 {
314 return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3
315 }
316
317 func NsecToTimeval(nsec int64) (tv Timeval) {
318 tv.Sec = int32(nsec / 1e9)
319 tv.Usec = int32(nsec % 1e9 / 1e3)
320 return
321 }
322
323 type SecurityAttributes struct {
324 Length uint32
325 SecurityDescriptor uintptr
326 InheritHandle uint32
327 }
328
329 type Overlapped struct {
330 Internal uintptr
331 InternalHigh uintptr
332 Offset uint32
333 OffsetHigh uint32
334 HEvent Handle
335 }
336
337 type FileNotifyInformation struct {
338 NextEntryOffset uint32
339 Action uint32
340 FileNameLength uint32
341 FileName uint16
342 }
343
344 type Filetime struct {
345 LowDateTime uint32
346 HighDateTime uint32
347 }
348
349
350
351 func (ft *Filetime) Nanoseconds() int64 {
352
353 nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime)
354
355 nsec -= 116444736000000000
356
357 nsec *= 100
358 return nsec
359 }
360
361 func NsecToFiletime(nsec int64) (ft Filetime) {
362
363 nsec /= 100
364
365 nsec += 116444736000000000
366
367 ft.LowDateTime = uint32(nsec & 0xffffffff)
368 ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff)
369 return ft
370 }
371
372 type Win32finddata struct {
373 FileAttributes uint32
374 CreationTime Filetime
375 LastAccessTime Filetime
376 LastWriteTime Filetime
377 FileSizeHigh uint32
378 FileSizeLow uint32
379 Reserved0 uint32
380 Reserved1 uint32
381 FileName [MAX_PATH - 1]uint16
382 AlternateFileName [13]uint16
383 }
384
385
386
387 type win32finddata1 struct {
388 FileAttributes uint32
389 CreationTime Filetime
390 LastAccessTime Filetime
391 LastWriteTime Filetime
392 FileSizeHigh uint32
393 FileSizeLow uint32
394 Reserved0 uint32
395 Reserved1 uint32
396 FileName [MAX_PATH]uint16
397 AlternateFileName [14]uint16
398 }
399
400 func copyFindData(dst *Win32finddata, src *win32finddata1) {
401 dst.FileAttributes = src.FileAttributes
402 dst.CreationTime = src.CreationTime
403 dst.LastAccessTime = src.LastAccessTime
404 dst.LastWriteTime = src.LastWriteTime
405 dst.FileSizeHigh = src.FileSizeHigh
406 dst.FileSizeLow = src.FileSizeLow
407 dst.Reserved0 = src.Reserved0
408 dst.Reserved1 = src.Reserved1
409
410
411 copy(dst.FileName[:], src.FileName[:])
412 copy(dst.AlternateFileName[:], src.AlternateFileName[:])
413 }
414
415 type ByHandleFileInformation struct {
416 FileAttributes uint32
417 CreationTime Filetime
418 LastAccessTime Filetime
419 LastWriteTime Filetime
420 VolumeSerialNumber uint32
421 FileSizeHigh uint32
422 FileSizeLow uint32
423 NumberOfLinks uint32
424 FileIndexHigh uint32
425 FileIndexLow uint32
426 }
427
428 const (
429 GetFileExInfoStandard = 0
430 GetFileExMaxInfoLevel = 1
431 )
432
433 type Win32FileAttributeData struct {
434 FileAttributes uint32
435 CreationTime Filetime
436 LastAccessTime Filetime
437 LastWriteTime Filetime
438 FileSizeHigh uint32
439 FileSizeLow uint32
440 }
441
442
443 const (
444
445 SW_HIDE = 0
446 SW_NORMAL = 1
447 SW_SHOWNORMAL = 1
448 SW_SHOWMINIMIZED = 2
449 SW_SHOWMAXIMIZED = 3
450 SW_MAXIMIZE = 3
451 SW_SHOWNOACTIVATE = 4
452 SW_SHOW = 5
453 SW_MINIMIZE = 6
454 SW_SHOWMINNOACTIVE = 7
455 SW_SHOWNA = 8
456 SW_RESTORE = 9
457 SW_SHOWDEFAULT = 10
458 SW_FORCEMINIMIZE = 11
459 )
460
461 type StartupInfo struct {
462 Cb uint32
463 _ *uint16
464 Desktop *uint16
465 Title *uint16
466 X uint32
467 Y uint32
468 XSize uint32
469 YSize uint32
470 XCountChars uint32
471 YCountChars uint32
472 FillAttribute uint32
473 Flags uint32
474 ShowWindow uint16
475 _ uint16
476 _ *byte
477 StdInput Handle
478 StdOutput Handle
479 StdErr Handle
480 }
481
482 type ProcessInformation struct {
483 Process Handle
484 Thread Handle
485 ProcessId uint32
486 ThreadId uint32
487 }
488
489 type ProcessEntry32 struct {
490 Size uint32
491 Usage uint32
492 ProcessID uint32
493 DefaultHeapID uintptr
494 ModuleID uint32
495 Threads uint32
496 ParentProcessID uint32
497 PriClassBase int32
498 Flags uint32
499 ExeFile [MAX_PATH]uint16
500 }
501
502 type Systemtime struct {
503 Year uint16
504 Month uint16
505 DayOfWeek uint16
506 Day uint16
507 Hour uint16
508 Minute uint16
509 Second uint16
510 Milliseconds uint16
511 }
512
513 type Timezoneinformation struct {
514 Bias int32
515 StandardName [32]uint16
516 StandardDate Systemtime
517 StandardBias int32
518 DaylightName [32]uint16
519 DaylightDate Systemtime
520 DaylightBias int32
521 }
522
523
524
525 const (
526 AF_UNSPEC = 0
527 AF_UNIX = 1
528 AF_INET = 2
529 AF_INET6 = 23
530 AF_NETBIOS = 17
531
532 SOCK_STREAM = 1
533 SOCK_DGRAM = 2
534 SOCK_RAW = 3
535 SOCK_SEQPACKET = 5
536
537 IPPROTO_IP = 0
538 IPPROTO_IPV6 = 0x29
539 IPPROTO_TCP = 6
540 IPPROTO_UDP = 17
541
542 SOL_SOCKET = 0xffff
543 SO_REUSEADDR = 4
544 SO_KEEPALIVE = 8
545 SO_DONTROUTE = 16
546 SO_BROADCAST = 32
547 SO_LINGER = 128
548 SO_RCVBUF = 0x1002
549 SO_SNDBUF = 0x1001
550 SO_UPDATE_ACCEPT_CONTEXT = 0x700b
551 SO_UPDATE_CONNECT_CONTEXT = 0x7010
552
553 IOC_OUT = 0x40000000
554 IOC_IN = 0x80000000
555 IOC_VENDOR = 0x18000000
556 IOC_INOUT = IOC_IN | IOC_OUT
557 IOC_WS2 = 0x08000000
558 SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6
559 SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4
560 SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
561
562
563
564 IP_TOS = 0x3
565 IP_TTL = 0x4
566 IP_MULTICAST_IF = 0x9
567 IP_MULTICAST_TTL = 0xa
568 IP_MULTICAST_LOOP = 0xb
569 IP_ADD_MEMBERSHIP = 0xc
570 IP_DROP_MEMBERSHIP = 0xd
571
572 IPV6_V6ONLY = 0x1b
573 IPV6_UNICAST_HOPS = 0x4
574 IPV6_MULTICAST_IF = 0x9
575 IPV6_MULTICAST_HOPS = 0xa
576 IPV6_MULTICAST_LOOP = 0xb
577 IPV6_JOIN_GROUP = 0xc
578 IPV6_LEAVE_GROUP = 0xd
579
580 SOMAXCONN = 0x7fffffff
581
582 TCP_NODELAY = 1
583
584 SHUT_RD = 0
585 SHUT_WR = 1
586 SHUT_RDWR = 2
587
588 WSADESCRIPTION_LEN = 256
589 WSASYS_STATUS_LEN = 128
590 )
591
592 type WSABuf struct {
593 Len uint32
594 Buf *byte
595 }
596
597
598 const (
599 S_IFMT = 0x1f000
600 S_IFIFO = 0x1000
601 S_IFCHR = 0x2000
602 S_IFDIR = 0x4000
603 S_IFBLK = 0x6000
604 S_IFREG = 0x8000
605 S_IFLNK = 0xa000
606 S_IFSOCK = 0xc000
607 S_ISUID = 0x800
608 S_ISGID = 0x400
609 S_ISVTX = 0x200
610 S_IRUSR = 0x100
611 S_IWRITE = 0x80
612 S_IWUSR = 0x80
613 S_IXUSR = 0x40
614 )
615
616 const (
617 FILE_TYPE_CHAR = 0x0002
618 FILE_TYPE_DISK = 0x0001
619 FILE_TYPE_PIPE = 0x0003
620 FILE_TYPE_REMOTE = 0x8000
621 FILE_TYPE_UNKNOWN = 0x0000
622 )
623
624 type Hostent struct {
625 Name *byte
626 Aliases **byte
627 AddrType uint16
628 Length uint16
629 AddrList **byte
630 }
631
632 type Protoent struct {
633 Name *byte
634 Aliases **byte
635 Proto uint16
636 }
637
638 const (
639 DNS_TYPE_A = 0x0001
640 DNS_TYPE_NS = 0x0002
641 DNS_TYPE_MD = 0x0003
642 DNS_TYPE_MF = 0x0004
643 DNS_TYPE_CNAME = 0x0005
644 DNS_TYPE_SOA = 0x0006
645 DNS_TYPE_MB = 0x0007
646 DNS_TYPE_MG = 0x0008
647 DNS_TYPE_MR = 0x0009
648 DNS_TYPE_NULL = 0x000a
649 DNS_TYPE_WKS = 0x000b
650 DNS_TYPE_PTR = 0x000c
651 DNS_TYPE_HINFO = 0x000d
652 DNS_TYPE_MINFO = 0x000e
653 DNS_TYPE_MX = 0x000f
654 DNS_TYPE_TEXT = 0x0010
655 DNS_TYPE_RP = 0x0011
656 DNS_TYPE_AFSDB = 0x0012
657 DNS_TYPE_X25 = 0x0013
658 DNS_TYPE_ISDN = 0x0014
659 DNS_TYPE_RT = 0x0015
660 DNS_TYPE_NSAP = 0x0016
661 DNS_TYPE_NSAPPTR = 0x0017
662 DNS_TYPE_SIG = 0x0018
663 DNS_TYPE_KEY = 0x0019
664 DNS_TYPE_PX = 0x001a
665 DNS_TYPE_GPOS = 0x001b
666 DNS_TYPE_AAAA = 0x001c
667 DNS_TYPE_LOC = 0x001d
668 DNS_TYPE_NXT = 0x001e
669 DNS_TYPE_EID = 0x001f
670 DNS_TYPE_NIMLOC = 0x0020
671 DNS_TYPE_SRV = 0x0021
672 DNS_TYPE_ATMA = 0x0022
673 DNS_TYPE_NAPTR = 0x0023
674 DNS_TYPE_KX = 0x0024
675 DNS_TYPE_CERT = 0x0025
676 DNS_TYPE_A6 = 0x0026
677 DNS_TYPE_DNAME = 0x0027
678 DNS_TYPE_SINK = 0x0028
679 DNS_TYPE_OPT = 0x0029
680 DNS_TYPE_DS = 0x002B
681 DNS_TYPE_RRSIG = 0x002E
682 DNS_TYPE_NSEC = 0x002F
683 DNS_TYPE_DNSKEY = 0x0030
684 DNS_TYPE_DHCID = 0x0031
685 DNS_TYPE_UINFO = 0x0064
686 DNS_TYPE_UID = 0x0065
687 DNS_TYPE_GID = 0x0066
688 DNS_TYPE_UNSPEC = 0x0067
689 DNS_TYPE_ADDRS = 0x00f8
690 DNS_TYPE_TKEY = 0x00f9
691 DNS_TYPE_TSIG = 0x00fa
692 DNS_TYPE_IXFR = 0x00fb
693 DNS_TYPE_AXFR = 0x00fc
694 DNS_TYPE_MAILB = 0x00fd
695 DNS_TYPE_MAILA = 0x00fe
696 DNS_TYPE_ALL = 0x00ff
697 DNS_TYPE_ANY = 0x00ff
698 DNS_TYPE_WINS = 0xff01
699 DNS_TYPE_WINSR = 0xff02
700 DNS_TYPE_NBSTAT = 0xff01
701 )
702
703 const (
704 DNS_INFO_NO_RECORDS = 0x251D
705 )
706
707 const (
708
709 DnsSectionQuestion = 0x0000
710 DnsSectionAnswer = 0x0001
711 DnsSectionAuthority = 0x0002
712 DnsSectionAdditional = 0x0003
713 )
714
715 type DNSSRVData struct {
716 Target *uint16
717 Priority uint16
718 Weight uint16
719 Port uint16
720 Pad uint16
721 }
722
723 type DNSPTRData struct {
724 Host *uint16
725 }
726
727 type DNSMXData struct {
728 NameExchange *uint16
729 Preference uint16
730 Pad uint16
731 }
732
733 type DNSTXTData struct {
734 StringCount uint16
735 StringArray [1]*uint16
736 }
737
738 type DNSRecord struct {
739 Next *DNSRecord
740 Name *uint16
741 Type uint16
742 Length uint16
743 Dw uint32
744 Ttl uint32
745 Reserved uint32
746 Data [40]byte
747 }
748
749 const (
750 TF_DISCONNECT = 1
751 TF_REUSE_SOCKET = 2
752 TF_WRITE_BEHIND = 4
753 TF_USE_DEFAULT_WORKER = 0
754 TF_USE_SYSTEM_THREAD = 16
755 TF_USE_KERNEL_APC = 32
756 )
757
758 type TransmitFileBuffers struct {
759 Head uintptr
760 HeadLength uint32
761 Tail uintptr
762 TailLength uint32
763 }
764
765 const (
766 IFF_UP = 1
767 IFF_BROADCAST = 2
768 IFF_LOOPBACK = 4
769 IFF_POINTTOPOINT = 8
770 IFF_MULTICAST = 16
771 )
772
773 const SIO_GET_INTERFACE_LIST = 0x4004747F
774
775
776
777
778 type SockaddrGen [24]byte
779
780 type InterfaceInfo struct {
781 Flags uint32
782 Address SockaddrGen
783 BroadcastAddress SockaddrGen
784 Netmask SockaddrGen
785 }
786
787 type IpAddressString struct {
788 String [16]byte
789 }
790
791 type IpMaskString IpAddressString
792
793 type IpAddrString struct {
794 Next *IpAddrString
795 IpAddress IpAddressString
796 IpMask IpMaskString
797 Context uint32
798 }
799
800 const MAX_ADAPTER_NAME_LENGTH = 256
801 const MAX_ADAPTER_DESCRIPTION_LENGTH = 128
802 const MAX_ADAPTER_ADDRESS_LENGTH = 8
803
804 type IpAdapterInfo struct {
805 Next *IpAdapterInfo
806 ComboIndex uint32
807 AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte
808 Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte
809 AddressLength uint32
810 Address [MAX_ADAPTER_ADDRESS_LENGTH]byte
811 Index uint32
812 Type uint32
813 DhcpEnabled uint32
814 CurrentIpAddress *IpAddrString
815 IpAddressList IpAddrString
816 GatewayList IpAddrString
817 DhcpServer IpAddrString
818 HaveWins bool
819 PrimaryWinsServer IpAddrString
820 SecondaryWinsServer IpAddrString
821 LeaseObtained int64
822 LeaseExpires int64
823 }
824
825 const MAXLEN_PHYSADDR = 8
826 const MAX_INTERFACE_NAME_LEN = 256
827 const MAXLEN_IFDESCR = 256
828
829 type MibIfRow struct {
830 Name [MAX_INTERFACE_NAME_LEN]uint16
831 Index uint32
832 Type uint32
833 Mtu uint32
834 Speed uint32
835 PhysAddrLen uint32
836 PhysAddr [MAXLEN_PHYSADDR]byte
837 AdminStatus uint32
838 OperStatus uint32
839 LastChange uint32
840 InOctets uint32
841 InUcastPkts uint32
842 InNUcastPkts uint32
843 InDiscards uint32
844 InErrors uint32
845 InUnknownProtos uint32
846 OutOctets uint32
847 OutUcastPkts uint32
848 OutNUcastPkts uint32
849 OutDiscards uint32
850 OutErrors uint32
851 OutQLen uint32
852 DescrLen uint32
853 Descr [MAXLEN_IFDESCR]byte
854 }
855
856 type CertInfo struct {
857
858 }
859
860 type CertContext struct {
861 EncodingType uint32
862 EncodedCert *byte
863 Length uint32
864 CertInfo *CertInfo
865 Store Handle
866 }
867
868 type CertChainContext struct {
869 Size uint32
870 TrustStatus CertTrustStatus
871 ChainCount uint32
872 Chains **CertSimpleChain
873 LowerQualityChainCount uint32
874 LowerQualityChains **CertChainContext
875 HasRevocationFreshnessTime uint32
876 RevocationFreshnessTime uint32
877 }
878
879 type CertTrustListInfo struct {
880
881 }
882
883 type CertSimpleChain struct {
884 Size uint32
885 TrustStatus CertTrustStatus
886 NumElements uint32
887 Elements **CertChainElement
888 TrustListInfo *CertTrustListInfo
889 HasRevocationFreshnessTime uint32
890 RevocationFreshnessTime uint32
891 }
892
893 type CertChainElement struct {
894 Size uint32
895 CertContext *CertContext
896 TrustStatus CertTrustStatus
897 RevocationInfo *CertRevocationInfo
898 IssuanceUsage *CertEnhKeyUsage
899 ApplicationUsage *CertEnhKeyUsage
900 ExtendedErrorInfo *uint16
901 }
902
903 type CertRevocationCrlInfo struct {
904
905 }
906
907 type CertRevocationInfo struct {
908 Size uint32
909 RevocationResult uint32
910 RevocationOid *byte
911 OidSpecificInfo Pointer
912 HasFreshnessTime uint32
913 FreshnessTime uint32
914 CrlInfo *CertRevocationCrlInfo
915 }
916
917 type CertTrustStatus struct {
918 ErrorStatus uint32
919 InfoStatus uint32
920 }
921
922 type CertUsageMatch struct {
923 Type uint32
924 Usage CertEnhKeyUsage
925 }
926
927 type CertEnhKeyUsage struct {
928 Length uint32
929 UsageIdentifiers **byte
930 }
931
932 type CertChainPara struct {
933 Size uint32
934 RequestedUsage CertUsageMatch
935 RequstedIssuancePolicy CertUsageMatch
936 URLRetrievalTimeout uint32
937 CheckRevocationFreshnessTime uint32
938 RevocationFreshnessTime uint32
939 CacheResync *Filetime
940 }
941
942 type CertChainPolicyPara struct {
943 Size uint32
944 Flags uint32
945 ExtraPolicyPara Pointer
946 }
947
948 type SSLExtraCertChainPolicyPara struct {
949 Size uint32
950 AuthType uint32
951 Checks uint32
952 ServerName *uint16
953 }
954
955 type CertChainPolicyStatus struct {
956 Size uint32
957 Error uint32
958 ChainIndex uint32
959 ElementIndex uint32
960 ExtraPolicyStatus Pointer
961 }
962
963 const (
964
965 HKEY_CLASSES_ROOT = 0x80000000 + iota
966 HKEY_CURRENT_USER
967 HKEY_LOCAL_MACHINE
968 HKEY_USERS
969 HKEY_PERFORMANCE_DATA
970 HKEY_CURRENT_CONFIG
971 HKEY_DYN_DATA
972
973 KEY_QUERY_VALUE = 1
974 KEY_SET_VALUE = 2
975 KEY_CREATE_SUB_KEY = 4
976 KEY_ENUMERATE_SUB_KEYS = 8
977 KEY_NOTIFY = 16
978 KEY_CREATE_LINK = 32
979 KEY_WRITE = 0x20006
980 KEY_EXECUTE = 0x20019
981 KEY_READ = 0x20019
982 KEY_WOW64_64KEY = 0x0100
983 KEY_WOW64_32KEY = 0x0200
984 KEY_ALL_ACCESS = 0xf003f
985 )
986
987 const (
988
989 REG_NONE = iota
990 REG_SZ
991 REG_EXPAND_SZ
992 REG_BINARY
993 REG_DWORD_LITTLE_ENDIAN
994 REG_DWORD_BIG_ENDIAN
995 REG_LINK
996 REG_MULTI_SZ
997 REG_RESOURCE_LIST
998 REG_FULL_RESOURCE_DESCRIPTOR
999 REG_RESOURCE_REQUIREMENTS_LIST
1000 REG_QWORD_LITTLE_ENDIAN
1001 REG_DWORD = REG_DWORD_LITTLE_ENDIAN
1002 REG_QWORD = REG_QWORD_LITTLE_ENDIAN
1003 )
1004
1005 type AddrinfoW struct {
1006 Flags int32
1007 Family int32
1008 Socktype int32
1009 Protocol int32
1010 Addrlen uintptr
1011 Canonname *uint16
1012 Addr Pointer
1013 Next *AddrinfoW
1014 }
1015
1016 const (
1017 AI_PASSIVE = 1
1018 AI_CANONNAME = 2
1019 AI_NUMERICHOST = 4
1020 )
1021
1022 type GUID struct {
1023 Data1 uint32
1024 Data2 uint16
1025 Data3 uint16
1026 Data4 [8]byte
1027 }
1028
1029 var WSAID_CONNECTEX = GUID{
1030 0x25a207b9,
1031 0xddf3,
1032 0x4660,
1033 [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e},
1034 }
1035
1036 const (
1037 FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1
1038 FILE_SKIP_SET_EVENT_ON_HANDLE = 2
1039 )
1040
1041 const (
1042 WSAPROTOCOL_LEN = 255
1043 MAX_PROTOCOL_CHAIN = 7
1044 BASE_PROTOCOL = 1
1045 LAYERED_PROTOCOL = 0
1046
1047 XP1_CONNECTIONLESS = 0x00000001
1048 XP1_GUARANTEED_DELIVERY = 0x00000002
1049 XP1_GUARANTEED_ORDER = 0x00000004
1050 XP1_MESSAGE_ORIENTED = 0x00000008
1051 XP1_PSEUDO_STREAM = 0x00000010
1052 XP1_GRACEFUL_CLOSE = 0x00000020
1053 XP1_EXPEDITED_DATA = 0x00000040
1054 XP1_CONNECT_DATA = 0x00000080
1055 XP1_DISCONNECT_DATA = 0x00000100
1056 XP1_SUPPORT_BROADCAST = 0x00000200
1057 XP1_SUPPORT_MULTIPOINT = 0x00000400
1058 XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800
1059 XP1_MULTIPOINT_DATA_PLANE = 0x00001000
1060 XP1_QOS_SUPPORTED = 0x00002000
1061 XP1_UNI_SEND = 0x00008000
1062 XP1_UNI_RECV = 0x00010000
1063 XP1_IFS_HANDLES = 0x00020000
1064 XP1_PARTIAL_MESSAGE = 0x00040000
1065 XP1_SAN_SUPPORT_SDP = 0x00080000
1066
1067 PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001
1068 PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002
1069 PFL_HIDDEN = 0x00000004
1070 PFL_MATCHES_PROTOCOL_ZERO = 0x00000008
1071 PFL_NETWORKDIRECT_PROVIDER = 0x00000010
1072 )
1073
1074 type WSAProtocolInfo struct {
1075 ServiceFlags1 uint32
1076 ServiceFlags2 uint32
1077 ServiceFlags3 uint32
1078 ServiceFlags4 uint32
1079 ProviderFlags uint32
1080 ProviderId GUID
1081 CatalogEntryId uint32
1082 ProtocolChain WSAProtocolChain
1083 Version int32
1084 AddressFamily int32
1085 MaxSockAddr int32
1086 MinSockAddr int32
1087 SocketType int32
1088 Protocol int32
1089 ProtocolMaxOffset int32
1090 NetworkByteOrder int32
1091 SecurityScheme int32
1092 MessageSize uint32
1093 ProviderReserved uint32
1094 ProtocolName [WSAPROTOCOL_LEN + 1]uint16
1095 }
1096
1097 type WSAProtocolChain struct {
1098 ChainLen int32
1099 ChainEntries [MAX_PROTOCOL_CHAIN]uint32
1100 }
1101
1102 type TCPKeepalive struct {
1103 OnOff uint32
1104 Time uint32
1105 Interval uint32
1106 }
1107
1108 type symbolicLinkReparseBuffer struct {
1109 SubstituteNameOffset uint16
1110 SubstituteNameLength uint16
1111 PrintNameOffset uint16
1112 PrintNameLength uint16
1113 Flags uint32
1114 PathBuffer [1]uint16
1115 }
1116
1117 type mountPointReparseBuffer struct {
1118 SubstituteNameOffset uint16
1119 SubstituteNameLength uint16
1120 PrintNameOffset uint16
1121 PrintNameLength uint16
1122 PathBuffer [1]uint16
1123 }
1124
1125 type reparseDataBuffer struct {
1126 ReparseTag uint32
1127 ReparseDataLength uint16
1128 Reserved uint16
1129
1130
1131 reparseBuffer byte
1132 }
1133
1134 const (
1135 FSCTL_GET_REPARSE_POINT = 0x900A8
1136 MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
1137 _IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
1138 IO_REPARSE_TAG_SYMLINK = 0xA000000C
1139 SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
1140 _SYMLINK_FLAG_RELATIVE = 1
1141 )
1142
1143 const UNIX_PATH_MAX = 108
1144
View as plain text