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