stop crashing for nothing, fix reboot to firmware
This commit is contained in:
30
pkg/windows/windows.go
Normal file
30
pkg/windows/windows.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package windows
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
NULL = 0
|
||||
MB_OK = 0
|
||||
)
|
||||
|
||||
// MessageBox of Win32 API.
|
||||
func MessageBox(hwnd uintptr, caption, title string, flags uint) int {
|
||||
_caption, err := syscall.UTF16PtrFromString(caption)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_title, err := syscall.UTF16PtrFromString(title)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ret, _, _ := syscall.NewLazyDLL("user32.dll").NewProc("MessageBoxW").Call(
|
||||
uintptr(hwnd),
|
||||
uintptr(unsafe.Pointer(_caption)),
|
||||
uintptr(unsafe.Pointer(_title)),
|
||||
uintptr(flags))
|
||||
|
||||
return int(ret)
|
||||
}
|
||||
Reference in New Issue
Block a user