aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/elevate/syscall_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-03 09:25:35 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-05 20:12:19 +0200
commitcea56d3a253408c4915ed3db5a15c499288cb89b (patch)
tree094f6a07f7619ad83c7679388a32835418fb25bc /elevate/syscall_windows.go
parentui: remove SetFocus hack from EditDialog (diff)
downloadwireguard-windows-cea56d3a253408c4915ed3db5a15c499288cb89b.tar.xz
wireguard-windows-cea56d3a253408c4915ed3db5a15c499288cb89b.zip
elevate: do not show UAC prompt for frictionless UX
Diffstat (limited to 'elevate/syscall_windows.go')
-rw-r--r--elevate/syscall_windows.go52
1 files changed, 52 insertions, 0 deletions
diff --git a/elevate/syscall_windows.go b/elevate/syscall_windows.go
new file mode 100644
index 00000000..c73be812
--- /dev/null
+++ b/elevate/syscall_windows.go
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
+ */
+
+package elevate
+
+type cBIND_OPTS3 struct {
+ cbStruct uint32
+ grfFlags uint32
+ grfMode uint32
+ dwTickCountDeadline uint32
+ dwTrackFlags uint32
+ dwClassContext uint32
+ locale uint32
+ pServerInfo *uintptr
+ hwnd *uintptr
+}
+
+type cUNICODE_STRING struct {
+ Length uint16
+ MaximumLength uint16
+ Buffer *uint16
+}
+
+type cLDR_DATA_TABLE_ENTRY struct {
+ Reserved1 [2]uintptr
+ InMemoryOrderLinks [2]uintptr
+ Reserved2 [2]uintptr
+ DllBase uintptr
+ Reserved3 [2]uintptr
+ FullDllName cUNICODE_STRING
+ Reserved4 [8]byte
+ Reserved5 [3]uintptr
+ Reserved6 uintptr
+ TimeDateStamp uint32
+}
+
+const (
+ cCLSCTX_LOCAL_SERVER = 4
+ cCOINIT_APARTMENTTHREADED = 2
+)
+
+//sys getModuleHandle(moduleName *uint16) (moduleHandle uintptr, err error) [failretval==0] = kernel32.GetModuleHandleW
+//sys getWindowsDirectory(windowsDirectory *uint16, inLen uint32) (outLen uint32, err error) [failretval==0] = kernel32.GetWindowsDirectoryW
+
+//sys rtlInitUnicodeString(destinationString *cUNICODE_STRING, sourceString *uint16) = ntdll.RtlInitUnicodeString
+//sys ldrFindEntryForAddress(moduleHandle uintptr, entry **cLDR_DATA_TABLE_ENTRY) (ntstatus uint32) = ntdll.LdrFindEntryForAddress
+
+//sys coInitializeEx(reserved uintptr, coInit uint32) (ret error) = ole32.CoInitializeEx
+//sys coUninitialize() = ole32.CoUninitialize
+//sys coGetObject(name *uint16, bindOpts *cBIND_OPTS3, guid *windows.GUID, functionTable ***[0xffff]uintptr) (ret error) = ole32.CoGetObject