ohadravid / wmi-rs

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

feat: handle all integer types in safearray_to_vec #54

Closed vthib closed 2 years ago

vthib commented 2 years ago

Thank you for your crate, I have been using it a lot and it works well!

I just got hit by the UnimplementArrayItem error however, when deserializing arrays of integers. Handling those types are very simple, the underlying SAFEARRAY just stores an array of those primitives, which we just need to copy, so I made a PR for it.

I have not handled VT_BOOL, because i'm not sure how it is represented. Even in https://docs.microsoft.com/fr-fr/cpp/atl/reference/ccomsafearray-class?view=msvc-170 which is a wrapper of a SAFEARRAY for C++ api, there does appear to be handling of VT_BOOL.

ohadravid commented 2 years ago

Hi!

Thanks for this PR, it looks good to me 🎉

Could you add a test for one or two of the newly supported arrays? Maybe under it_can_query_arrays, add more queries with objects which return some of these arrays? (and bump the version to 0.11.1).

I also fixed the CI so merge from main to have the tests run for your branch 🚀

vthib commented 2 years ago

I had the error on MSFTMpPreference ( https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/dn455323(v=vs.85) ), for the fields ThreatIDDefaultAction*. The issue is that those are empty by default, so it would require to fill them before being able to test the query, which is not really possible.

I've looked at many other classes to try and find array fields that are not empty and that are not UI4 variants, and I've not find any yet :/

vthib commented 2 years ago

Thanks for the quick merge and new release!