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:
Jan-Otto Kröpke
2026-10-16 02:32:29 +02:00
committed by GitHub
parent af2a7c3f6c
commit 2f5781ff13
43 changed files with 866 additions and 16 deletions
+7
View File
@@ -27,6 +27,7 @@ import (
"fmt"
"unsafe"
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
"golang.org/x/sys/windows"
)
@@ -38,8 +39,14 @@ var (
procOpenPrinterW = modWinspool.NewProc("OpenPrinterW")
procClosePrinter = modWinspool.NewProc("ClosePrinter")
procEnumJobsW = modWinspool.NewProc("EnumJobsW")
load = lazyproc.Once(modWinspool, procEnumPrintersW, procOpenPrinterW, procClosePrinter, procEnumJobsW)
)
// Load checks that winspool.drv exports every function of this package. Call
// it in Build: a missing export panics on the first call otherwise.
func Load() error { return load() }
// EnumPrinters returns the printers selected by flags, a combination of PRINTER_ENUM_* values.
func EnumPrinters(flags uint32) ([]Printer, error) {
buf, count, err := enum(func(buf *byte, size uint32, needed, returned *uint32) (uintptr, error) {