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

Calling methods on WMI objects #87

Closed
ydirson opened this issue Dec 19, 2023 · 1 comment
Closed

Calling methods on WMI objects #87

ydirson opened this issue Dec 19, 2023 · 1 comment

Comments

@ydirson
Copy link

ydirson commented Dec 19, 2023

I am trying to get the Rust equivalent to this python code (intended to run in a Xen guest with the Xen PV drivers installed):

import wmi
wmi_connection = wmi.WMI(namespace="root\\wmi")
xs_base = wmi_connection.CitrixXenStoreBase()[0]
sid = xs_base.AddSession("MyNewSession")[0]
session = wmi_connection.query(f"select * from CitrixXenStoreSession where SessionId={sid}")[0]
session.GetValue("domid")
session.EndSession()

I am able to retrieve xs_base through a query() call, but that's filling a user-specified struct, and does not appear to allow keeping a handle on the object for later use, and I did not find an API for such calls in the crate.

How could I make those calls?

Edit: I finally found out exec_query_native_wrapper, which IIUC returns the objects handles. But that seems to be a long shot to actually call any methods on this. Looks like this should get through IWbemServices::ExecMethod(), which is not actually called in this crate.

@ydirson
Copy link
Author

ydirson commented Dec 19, 2023

dup of #58, after all

@ydirson ydirson closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant