Skip to content

Update Rust crate wmi to 0.17.0 #289

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update Rust crate wmi to 0.17.0 #289

wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 14, 2025

This PR contains the following updates:

Package Type Update Change
wmi dependencies minor 0.15.0 -> 0.17.0

Release Notes

ohadravid/wmi-rs (wmi)

v0.17.0

Compare Source

What's Changed

Breaking Changes

New Contributors

Full Changelog: ohadravid/wmi-rs@v0.16.0...v0.17.0

v0.16.0

Compare Source

This version adds support for more serialization inputs (nested structures, array), and changes the public API to be more cohesive.

New Features

Nested structrure can be serialized when provided as method parameters (#​120):

let in_params = CreateInput {
    CommandLine: "explorer.exe".to_string(),
    ProcessStartupInformation: Win32_ProcessStartup {
        PriorityClass: 128, // High priority.
    },
};
let out: CreateOutput = wmi_con
    .exec_class_method::<Win32_Process, _>("Create", in_params)?;

Arrays can be serialized when provided as method parameters (#​121):

#[derive(Deserialize, Serialize)]
struct SetBinaryValue {
    sSubKeyName: String,
    sValueName: String,
    uValue: Vec<u8>,
}

let test_value = vec![0, 1, 2, 3];

let set_binary_value_params = SetBinaryValue {
    // ..
    uValue: test_value,
};

let value: SetBinaryValueOut = wmi_con
    .exec_class_method::<StdRegProv, _>("SetBinaryValue", &set_binary_value_params)?;

More lower-level API functions are exposed for IWbemClassWrapper:

let in_params = wmi_con
    .get_object("Win32_Process")?
    .get_method("Create")?
    .unwrap() // Can be `None`.
    .spawn_instance()?;

in_params
    .put_property("CommandLine", "explorer.exe".to_string())?;

let out = wmi_con
    .exec_method("Win32_Process", "Create", Some(&in_params))?;

Breaking Changes

  1. Method calling API was changed a little (#​120):
// Before:
let output: CreateOutput = wmi_con.exec_class_method::<Win32_Process, _, _>("Create", input)?;
let output: PrinterOutput = wmi_con.exec_instance_method::<Win32_Printer, _, _>("Pause", &printer.__Path, ())?;
// Now, only the Class and Out generics are named:
let output: CreateOutput = wmi_con.exec_class_method::<Win32_Process, _>("Create", input)?;
let output: PrinterOutput = wmi_con.exec_instance_method::<Win32_Printer, _>(&printer.__Path, "Pause", ())?;
  1. Rename lower-level (_native) methods to match the original names (exec_method_native_wrapper -> exec_method, exec_query_native_wrapper -> exec_query, etc.)
  2. Only expose as pub the needed structures and functions.

What's Changed

Full Changelog: ohadravid/wmi-rs@v0.15.2...v0.16.0

v0.15.2

Compare Source

What's Changed

Full Changelog: ohadravid/wmi-rs@v0.15.1...v0.15.2

v0.15.1

Compare Source

What's Changed

  • Updated windows and windows-core crates to version 0.60

Full Changelog: ohadravid/wmi-rs@v0.15.0...v0.15.1


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

Copy link

sourcery-ai bot commented Apr 14, 2025

Reviewer's Guide by Sourcery

This pull request updates the wmi crate from version 0.15.0 to 0.16.0. This update includes new features such as support for serializing nested structures and arrays as method parameters, as well as breaking changes to the method calling API.

Sequence diagram for executing a WMI class method

sequenceDiagram
    participant Client
    participant WMIConnection
    participant IWbemClassWrapper
    participant WMI

    Client->>WMIConnection: exec_class_method::<Win32_Process, _>("Create", in_params)
    WMIConnection->>IWbemClassWrapper: get_object("Win32_Process")
    IWbemClassWrapper->>WMI: Get class object
    WMI-->>IWbemClassWrapper: Returns class object
    IWbemClassWrapper-->>WMIConnection: Returns IWbemClassObject
    WMIConnection->>IWbemClassWrapper: get_method("Create")
    IWbemClassWrapper->>WMI: Get method object
    WMI-->>IWbemClassWrapper: Returns method object
    IWbemClassWrapper-->>WMIConnection: Returns IWbemClassObject
    WMIConnection->>IWbemClassWrapper: spawn_instance()
    IWbemClassWrapper->>WMI: Create instance
    WMI-->>IWbemClassWrapper: Returns instance
    IWbemClassWrapper-->>WMIConnection: Returns IWbemClassObject
    WMIConnection->>IWbemClassWrapper: put_property("CommandLine", "explorer.exe")
    IWbemClassWrapper->>WMI: Set property
    WMI-->>IWbemClassWrapper: Success
    WMIConnection->>WMIConnection: exec_method("Win32_Process", "Create", in_params)
    WMIConnection->>WMI: Execute method
    WMI-->>WMIConnection: Returns result
    WMIConnection-->>Client: Returns CreateOutput
Loading

Updated class diagram for WMI method calling

classDiagram
    class WMIConnection {
        +exec_class_method<Class, Out>(method_name: &str, in_params: In) Out
        +exec_instance_method<Class, Out>(path: &str, method_name: &str, in_params: In) Out
    }

    note for WMIConnection "The generics for exec_class_method and exec_instance_method have changed."
Loading

File-Level Changes

Change Details Files
The crate wmi was updated from version 0.15.0 to 0.16.0.
  • Updated the wmi crate version in Cargo.toml.
wmi_execute/Cargo.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. Here's why:

  • It seems to have been created by a bot (hey, renovate[bot]!). We assume it knows what it's doing!
  • We don't review packaging changes - Let us know if you'd like us to change this.

@renovate renovate bot force-pushed the renovate/wmi-0.x branch from 39e5ec1 to f5f5424 Compare April 19, 2025 08:39
@renovate renovate bot changed the title Update Rust crate wmi to 0.16.0 Update Rust crate wmi to 0.17.0 Apr 19, 2025
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

Successfully merging this pull request may close these issues.

0 participants