mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-19 11:09:03 +02:00
headers: fail Build on missing native exports and assert MI/COM layouts (#2739)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
package ntdll
|
||||
|
||||
import (
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -25,8 +26,14 @@ import (
|
||||
var (
|
||||
modNtdll = windows.NewLazySystemDLL("ntdll.dll")
|
||||
procRtlNtStatusToDosError = modNtdll.NewProc("RtlNtStatusToDosError")
|
||||
|
||||
load = lazyproc.Once(modNtdll, procRtlNtStatusToDosError)
|
||||
)
|
||||
|
||||
// Load checks that ntdll.dll exports every function of this package. Call it
|
||||
// in Build: a missing export panics on the first call otherwise.
|
||||
func Load() error { return load() }
|
||||
|
||||
func RtlNtStatusToDosError(status uintptr) error {
|
||||
ret, _, _ := procRtlNtStatusToDosError.Call(status)
|
||||
if ret == 0 {
|
||||
|
||||
Reference in New Issue
Block a user