headers: call per-scrape native functions with SyscallN (#2746)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-16 10:33:18 +02:00
committed by GitHub
parent 4cd3e5411d
commit b1b2888e0f
9 changed files with 148 additions and 12 deletions
+2 -1
View File
@@ -18,6 +18,7 @@
package psapi
import (
"syscall"
"unsafe"
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
@@ -61,7 +62,7 @@ func GetPerformanceInfo() (PerformanceInformation, error) {
size := uint32(unsafe.Sizeof(lppi))
lppi.cb = size
r1, _, err := procGetPerformanceInfo.Call(uintptr(unsafe.Pointer(&lppi)), uintptr(size))
r1, _, err := syscall.SyscallN(procGetPerformanceInfo.Addr(), uintptr(unsafe.Pointer(&lppi)), uintptr(size))
if ret := *(*bool)(unsafe.Pointer(&r1)); !ret {
return PerformanceInformation{}, err