summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-02 09:56:19 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-02 10:08:11 +0200
commitf8e2a851e1fa0a91164865963424adb664304ded (patch)
tree41ad9bac0d946bbc57e09511df9a1dd47233c88c
parentFix GetSystemMetricsForDpi crash (diff)
downloadwireguard-windows-f8e2a851e1fa0a91164865963424adb664304ded.tar.xz
wireguard-windows-f8e2a851e1fa0a91164865963424adb664304ded.zip
Add ShellExecute
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--shell32.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/shell32.go b/shell32.go
index f14a6140..9fc209ae 100644
--- a/shell32.go
+++ b/shell32.go
@@ -307,6 +307,7 @@ var (
shGetSpecialFolderPath *windows.LazyProc
shParseDisplayName *windows.LazyProc
shGetStockIconInfo *windows.LazyProc
+ shellExecute *windows.LazyProc
shell_NotifyIcon *windows.LazyProc
)
@@ -324,6 +325,7 @@ func init() {
shGetPathFromIDList = libshell32.NewProc("SHGetPathFromIDListW")
shGetSpecialFolderPath = libshell32.NewProc("SHGetSpecialFolderPathW")
shGetStockIconInfo = libshell32.NewProc("SHGetStockIconInfo")
+ shellExecute = libshell32.NewProc("ShellExecuteW")
shell_NotifyIcon = libshell32.NewProc("Shell_NotifyIconW")
shParseDisplayName = libshell32.NewProc("SHParseDisplayName")
}
@@ -434,6 +436,18 @@ func SHGetStockIconInfo(stockIconId int32, uFlags uint32, stockIcon *SHSTOCKICON
return HRESULT(ret)
}
+func ShellExecute(hWnd HWND, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int) bool {
+ ret, _, _ := syscall.Syscall6(shellExecute.Addr(), 6,
+ uintptr(hWnd),
+ uintptr(unsafe.Pointer(verb)),
+ uintptr(unsafe.Pointer(file)),
+ uintptr(unsafe.Pointer(args)),
+ uintptr(unsafe.Pointer(cwd)),
+ uintptr(showCmd),
+ )
+ return ret != 0
+}
+
func Shell_NotifyIcon(dwMessage uint32, lpdata *NOTIFYICONDATA) bool {
ret, _, _ := syscall.Syscall(shell_NotifyIcon.Addr(), 2,
uintptr(dwMessage),