github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/syscall/windows/zsyscall_windows.go (about)

     1  // Code generated by 'go generate'; DO NOT EDIT.
     2  
     3  package windows
     4  
     5  import (
     6  	"syscall"
     7  	"unsafe"
     8  
     9  	"github.com/go-asm/go/syscall/windows/sysdll"
    10  )
    11  
    12  var _ unsafe.Pointer
    13  
    14  // Do the interface allocations only once for common
    15  // Errno values.
    16  const (
    17  	errnoERROR_IO_PENDING = 997
    18  )
    19  
    20  var (
    21  	errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
    22  	errERROR_EINVAL     error = syscall.EINVAL
    23  )
    24  
    25  // errnoErr returns common boxed Errno values, to prevent
    26  // allocations at runtime.
    27  func errnoErr(e syscall.Errno) error {
    28  	switch e {
    29  	case 0:
    30  		return errERROR_EINVAL
    31  	case errnoERROR_IO_PENDING:
    32  		return errERROR_IO_PENDING
    33  	}
    34  	// TODO: add more here, after collecting data on the common
    35  	// error values see on Windows. (perhaps when running
    36  	// all.bat?)
    37  	return e
    38  }
    39  
    40  var (
    41  	modadvapi32         = syscall.NewLazyDLL(sysdll.Add("advapi32.dll"))
    42  	modbcryptprimitives = syscall.NewLazyDLL(sysdll.Add("bcryptprimitives.dll"))
    43  	modiphlpapi         = syscall.NewLazyDLL(sysdll.Add("iphlpapi.dll"))
    44  	modkernel32         = syscall.NewLazyDLL(sysdll.Add("kernel32.dll"))
    45  	modnetapi32         = syscall.NewLazyDLL(sysdll.Add("netapi32.dll"))
    46  	modpsapi            = syscall.NewLazyDLL(sysdll.Add("psapi.dll"))
    47  	moduserenv          = syscall.NewLazyDLL(sysdll.Add("userenv.dll"))
    48  	modws2_32           = syscall.NewLazyDLL(sysdll.Add("ws2_32.dll"))
    49  
    50  	procAdjustTokenPrivileges             = modadvapi32.NewProc("AdjustTokenPrivileges")
    51  	procDuplicateTokenEx                  = modadvapi32.NewProc("DuplicateTokenEx")
    52  	procImpersonateSelf                   = modadvapi32.NewProc("ImpersonateSelf")
    53  	procLookupPrivilegeValueW             = modadvapi32.NewProc("LookupPrivilegeValueW")
    54  	procOpenSCManagerW                    = modadvapi32.NewProc("OpenSCManagerW")
    55  	procOpenServiceW                      = modadvapi32.NewProc("OpenServiceW")
    56  	procOpenThreadToken                   = modadvapi32.NewProc("OpenThreadToken")
    57  	procQueryServiceStatus                = modadvapi32.NewProc("QueryServiceStatus")
    58  	procRevertToSelf                      = modadvapi32.NewProc("RevertToSelf")
    59  	procSetTokenInformation               = modadvapi32.NewProc("SetTokenInformation")
    60  	procProcessPrng                       = modbcryptprimitives.NewProc("ProcessPrng")
    61  	procGetAdaptersAddresses              = modiphlpapi.NewProc("GetAdaptersAddresses")
    62  	procCreateEventW                      = modkernel32.NewProc("CreateEventW")
    63  	procGetACP                            = modkernel32.NewProc("GetACP")
    64  	procGetComputerNameExW                = modkernel32.NewProc("GetComputerNameExW")
    65  	procGetConsoleCP                      = modkernel32.NewProc("GetConsoleCP")
    66  	procGetCurrentThread                  = modkernel32.NewProc("GetCurrentThread")
    67  	procGetFileInformationByHandleEx      = modkernel32.NewProc("GetFileInformationByHandleEx")
    68  	procGetFinalPathNameByHandleW         = modkernel32.NewProc("GetFinalPathNameByHandleW")
    69  	procGetModuleFileNameW                = modkernel32.NewProc("GetModuleFileNameW")
    70  	procGetTempPath2W                     = modkernel32.NewProc("GetTempPath2W")
    71  	procGetVolumeInformationByHandleW     = modkernel32.NewProc("GetVolumeInformationByHandleW")
    72  	procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
    73  	procLockFileEx                        = modkernel32.NewProc("LockFileEx")
    74  	procModule32FirstW                    = modkernel32.NewProc("Module32FirstW")
    75  	procModule32NextW                     = modkernel32.NewProc("Module32NextW")
    76  	procMoveFileExW                       = modkernel32.NewProc("MoveFileExW")
    77  	procMultiByteToWideChar               = modkernel32.NewProc("MultiByteToWideChar")
    78  	procRtlLookupFunctionEntry            = modkernel32.NewProc("RtlLookupFunctionEntry")
    79  	procRtlVirtualUnwind                  = modkernel32.NewProc("RtlVirtualUnwind")
    80  	procSetFileInformationByHandle        = modkernel32.NewProc("SetFileInformationByHandle")
    81  	procUnlockFileEx                      = modkernel32.NewProc("UnlockFileEx")
    82  	procVirtualQuery                      = modkernel32.NewProc("VirtualQuery")
    83  	procNetShareAdd                       = modnetapi32.NewProc("NetShareAdd")
    84  	procNetShareDel                       = modnetapi32.NewProc("NetShareDel")
    85  	procNetUserGetLocalGroups             = modnetapi32.NewProc("NetUserGetLocalGroups")
    86  	procGetProcessMemoryInfo              = modpsapi.NewProc("GetProcessMemoryInfo")
    87  	procCreateEnvironmentBlock            = moduserenv.NewProc("CreateEnvironmentBlock")
    88  	procDestroyEnvironmentBlock           = moduserenv.NewProc("DestroyEnvironmentBlock")
    89  	procGetProfilesDirectoryW             = moduserenv.NewProc("GetProfilesDirectoryW")
    90  	procWSASocketW                        = modws2_32.NewProc("WSASocketW")
    91  )
    92  
    93  func adjustTokenPrivileges(token syscall.Token, disableAllPrivileges bool, newstate *TOKEN_PRIVILEGES, buflen uint32, prevstate *TOKEN_PRIVILEGES, returnlen *uint32) (ret uint32, err error) {
    94  	var _p0 uint32
    95  	if disableAllPrivileges {
    96  		_p0 = 1
    97  	}
    98  	r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
    99  	ret = uint32(r0)
   100  	if true {
   101  		err = errnoErr(e1)
   102  	}
   103  	return
   104  }
   105  
   106  func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTokenAttributes *syscall.SecurityAttributes, impersonationLevel uint32, tokenType TokenType, phNewToken *syscall.Token) (err error) {
   107  	r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(hExistingToken), uintptr(dwDesiredAccess), uintptr(unsafe.Pointer(lpTokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(phNewToken)))
   108  	if r1 == 0 {
   109  		err = errnoErr(e1)
   110  	}
   111  	return
   112  }
   113  
   114  func ImpersonateSelf(impersonationlevel uint32) (err error) {
   115  	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
   116  	if r1 == 0 {
   117  		err = errnoErr(e1)
   118  	}
   119  	return
   120  }
   121  
   122  func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
   123  	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
   124  	if r1 == 0 {
   125  		err = errnoErr(e1)
   126  	}
   127  	return
   128  }
   129  
   130  func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle syscall.Handle, err error) {
   131  	r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
   132  	handle = syscall.Handle(r0)
   133  	if handle == 0 {
   134  		err = errnoErr(e1)
   135  	}
   136  	return
   137  }
   138  
   139  func OpenService(mgr syscall.Handle, serviceName *uint16, access uint32) (handle syscall.Handle, err error) {
   140  	r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
   141  	handle = syscall.Handle(r0)
   142  	if handle == 0 {
   143  		err = errnoErr(e1)
   144  	}
   145  	return
   146  }
   147  
   148  func OpenThreadToken(h syscall.Handle, access uint32, openasself bool, token *syscall.Token) (err error) {
   149  	var _p0 uint32
   150  	if openasself {
   151  		_p0 = 1
   152  	}
   153  	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(h), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
   154  	if r1 == 0 {
   155  		err = errnoErr(e1)
   156  	}
   157  	return
   158  }
   159  
   160  func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS) (err error) {
   161  	r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(hService), uintptr(unsafe.Pointer(lpServiceStatus)), 0)
   162  	if r1 == 0 {
   163  		err = errnoErr(e1)
   164  	}
   165  	return
   166  }
   167  
   168  func RevertToSelf() (err error) {
   169  	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
   170  	if r1 == 0 {
   171  		err = errnoErr(e1)
   172  	}
   173  	return
   174  }
   175  
   176  func SetTokenInformation(tokenHandle syscall.Token, tokenInformationClass uint32, tokenInformation uintptr, tokenInformationLength uint32) (err error) {
   177  	r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(tokenHandle), uintptr(tokenInformationClass), uintptr(tokenInformation), uintptr(tokenInformationLength), 0, 0)
   178  	if r1 == 0 {
   179  		err = errnoErr(e1)
   180  	}
   181  	return
   182  }
   183  
   184  func ProcessPrng(buf []byte) (err error) {
   185  	var _p0 *byte
   186  	if len(buf) > 0 {
   187  		_p0 = &buf[0]
   188  	}
   189  	r1, _, e1 := syscall.Syscall(procProcessPrng.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0)
   190  	if r1 == 0 {
   191  		err = errnoErr(e1)
   192  	}
   193  	return
   194  }
   195  
   196  func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
   197  	r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
   198  	if r0 != 0 {
   199  		errcode = syscall.Errno(r0)
   200  	}
   201  	return
   202  }
   203  
   204  func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle syscall.Handle, err error) {
   205  	r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
   206  	handle = syscall.Handle(r0)
   207  	if handle == 0 {
   208  		err = errnoErr(e1)
   209  	}
   210  	return
   211  }
   212  
   213  func GetACP() (acp uint32) {
   214  	r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
   215  	acp = uint32(r0)
   216  	return
   217  }
   218  
   219  func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) {
   220  	r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nameformat), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
   221  	if r1 == 0 {
   222  		err = errnoErr(e1)
   223  	}
   224  	return
   225  }
   226  
   227  func GetConsoleCP() (ccp uint32) {
   228  	r0, _, _ := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
   229  	ccp = uint32(r0)
   230  	return
   231  }
   232  
   233  func GetCurrentThread() (pseudoHandle syscall.Handle, err error) {
   234  	r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
   235  	pseudoHandle = syscall.Handle(r0)
   236  	if pseudoHandle == 0 {
   237  		err = errnoErr(e1)
   238  	}
   239  	return
   240  }
   241  
   242  func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byte, bufsize uint32) (err error) {
   243  	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(info)), uintptr(bufsize), 0, 0)
   244  	if r1 == 0 {
   245  		err = errnoErr(e1)
   246  	}
   247  	return
   248  }
   249  
   250  func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
   251  	r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
   252  	n = uint32(r0)
   253  	if n == 0 {
   254  		err = errnoErr(e1)
   255  	}
   256  	return
   257  }
   258  
   259  func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32, err error) {
   260  	r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(fn)), uintptr(len))
   261  	n = uint32(r0)
   262  	if n == 0 {
   263  		err = errnoErr(e1)
   264  	}
   265  	return
   266  }
   267  
   268  func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) {
   269  	r0, _, e1 := syscall.Syscall(procGetTempPath2W.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
   270  	n = uint32(r0)
   271  	if n == 0 {
   272  		err = errnoErr(e1)
   273  	}
   274  	return
   275  }
   276  
   277  func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
   278  	r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
   279  	if r1 == 0 {
   280  		err = errnoErr(e1)
   281  	}
   282  	return
   283  }
   284  
   285  func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
   286  	r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
   287  	if r1 == 0 {
   288  		err = errnoErr(e1)
   289  	}
   290  	return
   291  }
   292  
   293  func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
   294  	r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
   295  	if r1 == 0 {
   296  		err = errnoErr(e1)
   297  	}
   298  	return
   299  }
   300  
   301  func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
   302  	r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
   303  	if r1 == 0 {
   304  		err = errnoErr(e1)
   305  	}
   306  	return
   307  }
   308  
   309  func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
   310  	r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
   311  	if r1 == 0 {
   312  		err = errnoErr(e1)
   313  	}
   314  	return
   315  }
   316  
   317  func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
   318  	r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
   319  	if r1 == 0 {
   320  		err = errnoErr(e1)
   321  	}
   322  	return
   323  }
   324  
   325  func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
   326  	r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
   327  	nwrite = int32(r0)
   328  	if nwrite == 0 {
   329  		err = errnoErr(e1)
   330  	}
   331  	return
   332  }
   333  
   334  func RtlLookupFunctionEntry(pc uintptr, baseAddress *uintptr, table *byte) (ret uintptr) {
   335  	r0, _, _ := syscall.Syscall(procRtlLookupFunctionEntry.Addr(), 3, uintptr(pc), uintptr(unsafe.Pointer(baseAddress)), uintptr(unsafe.Pointer(table)))
   336  	ret = uintptr(r0)
   337  	return
   338  }
   339  
   340  func RtlVirtualUnwind(handlerType uint32, baseAddress uintptr, pc uintptr, entry uintptr, ctxt uintptr, data *uintptr, frame *uintptr, ctxptrs *byte) (ret uintptr) {
   341  	r0, _, _ := syscall.Syscall9(procRtlVirtualUnwind.Addr(), 8, uintptr(handlerType), uintptr(baseAddress), uintptr(pc), uintptr(entry), uintptr(ctxt), uintptr(unsafe.Pointer(data)), uintptr(unsafe.Pointer(frame)), uintptr(unsafe.Pointer(ctxptrs)), 0)
   342  	ret = uintptr(r0)
   343  	return
   344  }
   345  
   346  func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint32, buf unsafe.Pointer, bufsize uint32) (err error) {
   347  	r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize), 0, 0)
   348  	if r1 == 0 {
   349  		err = errnoErr(e1)
   350  	}
   351  	return
   352  }
   353  
   354  func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
   355  	r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
   356  	if r1 == 0 {
   357  		err = errnoErr(e1)
   358  	}
   359  	return
   360  }
   361  
   362  func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
   363  	r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
   364  	if r1 == 0 {
   365  		err = errnoErr(e1)
   366  	}
   367  	return
   368  }
   369  
   370  func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) (neterr error) {
   371  	r0, _, _ := syscall.Syscall6(procNetShareAdd.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)), 0, 0)
   372  	if r0 != 0 {
   373  		neterr = syscall.Errno(r0)
   374  	}
   375  	return
   376  }
   377  
   378  func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr error) {
   379  	r0, _, _ := syscall.Syscall(procNetShareDel.Addr(), 3, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(netName)), uintptr(reserved))
   380  	if r0 != 0 {
   381  		neterr = syscall.Errno(r0)
   382  	}
   383  	return
   384  }
   385  
   386  func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, flags uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32) (neterr error) {
   387  	r0, _, _ := syscall.Syscall9(procNetUserGetLocalGroups.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(flags), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), 0)
   388  	if r0 != 0 {
   389  		neterr = syscall.Errno(r0)
   390  	}
   391  	return
   392  }
   393  
   394  func GetProcessMemoryInfo(handle syscall.Handle, memCounters *PROCESS_MEMORY_COUNTERS, cb uint32) (err error) {
   395  	r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(memCounters)), uintptr(cb))
   396  	if r1 == 0 {
   397  		err = errnoErr(e1)
   398  	}
   399  	return
   400  }
   401  
   402  func CreateEnvironmentBlock(block **uint16, token syscall.Token, inheritExisting bool) (err error) {
   403  	var _p0 uint32
   404  	if inheritExisting {
   405  		_p0 = 1
   406  	}
   407  	r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
   408  	if r1 == 0 {
   409  		err = errnoErr(e1)
   410  	}
   411  	return
   412  }
   413  
   414  func DestroyEnvironmentBlock(block *uint16) (err error) {
   415  	r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
   416  	if r1 == 0 {
   417  		err = errnoErr(e1)
   418  	}
   419  	return
   420  }
   421  
   422  func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) {
   423  	r1, _, e1 := syscall.Syscall(procGetProfilesDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)), 0)
   424  	if r1 == 0 {
   425  		err = errnoErr(e1)
   426  	}
   427  	return
   428  }
   429  
   430  func WSASocket(af int32, typ int32, protocol int32, protinfo *syscall.WSAProtocolInfo, group uint32, flags uint32) (handle syscall.Handle, err error) {
   431  	r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protinfo)), uintptr(group), uintptr(flags))
   432  	handle = syscall.Handle(r0)
   433  	if handle == syscall.InvalidHandle {
   434  		err = errnoErr(e1)
   435  	}
   436  	return
   437  }