mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-17 18:19:04 +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:
@@ -22,9 +22,14 @@ import (
|
||||
"log/slog"
|
||||
"unsafe"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// Load checks that wtsapi32.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() }
|
||||
|
||||
type WTSTypeClass int
|
||||
|
||||
// The valid values for the WTSTypeClass enumeration.
|
||||
@@ -107,6 +112,8 @@ var (
|
||||
procWTSFreeMemoryEx = wtsapi32.NewProc("WTSFreeMemoryExW")
|
||||
procWTSCloseServer = wtsapi32.NewProc("WTSCloseServer")
|
||||
|
||||
load = lazyproc.Once(wtsapi32, procWTSOpenServerEx, procWTSEnumerateSessionsEx, procWTSFreeMemoryEx, procWTSCloseServer)
|
||||
|
||||
WTSSessionStates = map[WTSConnectState]string{
|
||||
wtsActive: "active",
|
||||
wtsConnected: "connected",
|
||||
|
||||
Reference in New Issue
Block a user