Source file src/syscall/types_windows.go

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

View as plain text