diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-15 13:00:56 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-15 13:00:56 +0200 |
commit | 2f2ca237b6bf73b89098179628f058f2f9a6289c (patch) | |
tree | d562d95c51138fe190baf35abf8c260c9a63ae3a /service/zsyscall_windows.go | |
parent | build: handle errors in env block creation (diff) | |
download | wireguard-windows-2f2ca237b6bf73b89098179628f058f2f9a6289c.tar.xz wireguard-windows-2f2ca237b6bf73b89098179628f058f2f9a6289c.zip |
service: move WTS upstream
Diffstat (limited to '')
-rw-r--r-- | service/zsyscall_windows.go | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/service/zsyscall_windows.go b/service/zsyscall_windows.go deleted file mode 100644 index bb1eced3..00000000 --- a/service/zsyscall_windows.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by 'go generate'; DO NOT EDIT. - -package service - -import ( - "syscall" - "unsafe" - - "golang.org/x/sys/windows" -) - -var _ unsafe.Pointer - -// Do the interface allocations only once for common -// Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - -var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case errnoERROR_IO_PENDING: - return errERROR_IO_PENDING - } - // TODO: add more here, after collecting data on the common - // error values see on Windows. (perhaps when running - // all.bat?) - return e -} - -var ( - modwtsapi32 = windows.NewLazySystemDLL("wtsapi32.dll") - - procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken") - procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW") - procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory") -) - -func wtsQueryUserToken(session uint32, token *windows.Token) (err error) { - r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func wtsEnumerateSessions(handle windows.Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func wtsFreeMemory(ptr uintptr) { - syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) - return -} |