stop crashing for nothing, fix reboot to firmware

This commit is contained in:
2025-09-25 18:50:31 +02:00
parent 79dea1606b
commit 669c5b3011
2 changed files with 55 additions and 8 deletions

30
pkg/windows/windows.go Normal file
View 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)
}