From 70484b2e0c7c7242809fd2bf4bd2841be7edcc16 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 20 Jul 2022 16:59:30 +0200 Subject: [PATCH] fix(battery): fix Windows deadlock resolves #2549 --- src/environment/battery/battery_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/environment/battery/battery_windows.go b/src/environment/battery/battery_windows.go index 78cd846b..7c8cd373 100644 --- a/src/environment/battery/battery_windows.go +++ b/src/environment/battery/battery_windows.go @@ -92,7 +92,7 @@ func uint32ToFloat64(num uint32) (float64, error) { } func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, error) { - r1, _, errno := syscall.SyscallN(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) // nolint:staticcheck if windows.Handle(r1) == windows.InvalidHandle { if errno != 0 { return 0, error(errno) @@ -103,7 +103,7 @@ func setupDiSetup(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) } func setupDiCall(proc *windows.LazyProc, nargs, a1, a2, a3, a4, a5, a6 uintptr) syscall.Errno { - r1, _, errno := syscall.SyscallN(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) + r1, _, errno := syscall.Syscall6(proc.Addr(), nargs, a1, a2, a3, a4, a5, a6) // nolint:staticcheck if r1 == 0 { if errno != 0 { return errno @@ -148,7 +148,7 @@ func systemGet(idx int) (*battery, error) { return nil, err } defer func() { - _, _, _ = syscall.SyscallN(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) + _, _, _ = syscall.Syscall(setupDiDestroyDeviceInfoList.Addr(), 1, hdev, 0, 0) // nolint:staticcheck }() var did spDeviceInterfaceData