diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-26 07:30:17 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-26 07:43:49 -0600 |
commit | 7a33df13357bf2b760e8df5bd6ec43d2e13f8ab0 (patch) | |
tree | 889bd4fac7ad182f8902eab3963ca975dc2ca935 /elevate/zsyscall_windows.go | |
parent | firewall: use RtlGetNtVersionNumbers for kernel compat checks (diff) | |
download | wireguard-windows-7a33df13357bf2b760e8df5bd6ec43d2e13f8ab0.tar.xz wireguard-windows-7a33df13357bf2b760e8df5bd6ec43d2e13f8ab0.zip |
elevate: mark as terminal services aware
Diffstat (limited to '')
-rw-r--r-- | elevate/zsyscall_windows.go | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/elevate/zsyscall_windows.go b/elevate/zsyscall_windows.go index a3c5400d..6ce8f0db 100644 --- a/elevate/zsyscall_windows.go +++ b/elevate/zsyscall_windows.go @@ -41,30 +41,16 @@ var ( modntdll = windows.NewLazySystemDLL("ntdll.dll") modole32 = windows.NewLazySystemDLL("ole32.dll") - procGetModuleHandleW = modkernel32.NewProc("GetModuleHandleW") - procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW") - procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString") - procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb") - procCoInitializeEx = modole32.NewProc("CoInitializeEx") - procCoUninitialize = modole32.NewProc("CoUninitialize") - procCoGetObject = modole32.NewProc("CoGetObject") + procGetSystemWindowsDirectoryW = modkernel32.NewProc("GetSystemWindowsDirectoryW") + procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString") + procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb") + procCoInitializeEx = modole32.NewProc("CoInitializeEx") + procCoUninitialize = modole32.NewProc("CoUninitialize") + procCoGetObject = modole32.NewProc("CoGetObject") ) -func getModuleHandle(moduleName *uint16) (moduleHandle uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(unsafe.Pointer(moduleName)), 0, 0) - moduleHandle = uintptr(r0) - if moduleHandle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getWindowsDirectory(windowsDirectory *uint16, inLen uint32) (outLen uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(windowsDirectory)), uintptr(inLen), 0) +func getSystemWindowsDirectory(windowsDirectory *uint16, inLen uint32) (outLen uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(windowsDirectory)), uintptr(inLen), 0) outLen = uint32(r0) if outLen == 0 { if e1 != 0 { |