diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-02 09:56:19 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-02 10:08:11 +0200 |
commit | f8e2a851e1fa0a91164865963424adb664304ded (patch) | |
tree | 41ad9bac0d946bbc57e09511df9a1dd47233c88c | |
parent | Fix GetSystemMetricsForDpi crash (diff) | |
download | wireguard-windows-f8e2a851e1fa0a91164865963424adb664304ded.tar.xz wireguard-windows-f8e2a851e1fa0a91164865963424adb664304ded.zip |
Add ShellExecute
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | shell32.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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), |