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

View as plain text