mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-20 03:29:05 +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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user