mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-20 03:29:05 +02:00
mi: deliver query results through MI callbacks (#2666)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
839d32c7d5
commit
96fdb6f779
@@ -74,6 +74,25 @@ type ClassDecl struct {
|
||||
OwningClass uintptr
|
||||
}
|
||||
|
||||
// clone returns a copy of the instance that stays valid until it is deleted.
|
||||
//
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/mi/nf-mi-mi_instance_clone
|
||||
func (instance *Instance) clone() (*Instance, error) {
|
||||
if instance == nil || instance.ft == nil {
|
||||
return nil, ErrNotInitialized
|
||||
}
|
||||
|
||||
var clone *Instance
|
||||
|
||||
r0, _, _ := syscall.SyscallN(instance.ft.Clone, uintptr(unsafe.Pointer(instance)), uintptr(unsafe.Pointer(&clone)))
|
||||
|
||||
if result := ResultError(r0); !errors.Is(result, MI_RESULT_OK) {
|
||||
return nil, result
|
||||
}
|
||||
|
||||
return clone, nil
|
||||
}
|
||||
|
||||
func (instance *Instance) Delete() error {
|
||||
if instance == nil || instance.ft == nil {
|
||||
return ErrNotInitialized
|
||||
|
||||
Reference in New Issue
Block a user