Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added InvokeMethod on WmiClass #99

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pkg/wmiinstance/WmiClass.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,16 @@ func (c *WmiClass) MethodParameters(methodName string) []string {
// https://docs.microsoft.com/en-us/windows/win32/wmisdk/swbemmethodset
// https://docs.microsoft.com/en-us/windows/win32/wmisdk/swbemmethod
}
func (c *WmiClass) InvokeMethod(methodName string, methodParams []string, inputOptions string) (error, string) {
panic("not implemented")
// TODO. Should theoretically be the same as WmiInstance InvokeMethod?
// both are SWbemObjects: https://docs.microsoft.com/en-us/windows/win32/wmisdk/swbemobject

// Invoke static method on a wmi class
func (c *WmiClass) InvokeMethod(methodName string, params ...interface{}) ([]interface{}, error) {
rawResult, err := oleutil.CallMethod(c.class, methodName, params...)
if err != nil {
return nil, err
}
defer rawResult.Clear()
values, err := GetVariantValues(rawResult)
return values, err
}

// CloseAllClasses
Expand Down