ohadravid / wmi-rs

WMI crate for rust
Apache License 2.0
80 stars 27 forks source link

Add "LIKE" support to FilterValue #75

Closed mon closed 1 year ago

mon commented 1 year ago

I'm trying to detect FTDI devices connected to my computer and tell the user if their drivers aren't installed properly. I can use the following raw query, but I'd like to use proper filters as I think they look nicer:

wmi_con.raw_query("SELECT * FROM Win32_PnPEntity WHERE DeviceID LIKE '%VID_0403%'")

wmi-rs only supports equality for now. I'd make a PR myself but there's a few design thoughts that I don't really know how to answer. Should it be something like FilterValue::StringLike? Should FilterValue also be able to support "Not equals" in the future?

ohadravid commented 1 year ago

Yeah I think Like filter value would be a nice addition to the library 😄

I'm not sure if a negative filter is needed, and if it's worth the added complexity, but it could be interesting to see if a QueryBuilder can be implemented and used in this context if there's a compelling use case