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