zyantific / zydis-rs

Zydis Rust Bindings
MIT License
83 stars 14 forks source link

Update Rust bindings to 4.0.0 #31

Closed oberrich closed 1 year ago

oberrich commented 1 year ago

This PR

I have manually reviewed and compared everything inside ffi/decoder.rs, ffi/utils.rs, as well as enums.rs (modulo the formatter token stuff) against the C definitions. @athre0z The only thing I have to wonder about is why I can't find a single reference to MAX_OPERAND_COUNT_VISIBLE inside the C code anymore, yet the rust bindings are still using it for the formatter. Is this intended or is further work needed?

I have also removed the ZydisDecodingFlags as I can't find a single code reference in neither the C code nor the Rust code and assume it has been removed again (rel: https://github.com/zyantific/zydis/pull/406)

oberrich commented 1 year ago

I wouldn't have minded implementing the encoder interface as well but I barely know any Rust 🤣 All ffi definitions should now be updated to reflect the latest API changes.

athre0z commented 1 year ago

Thanks, that's some good progress!

I have also removed the ZydisDecodingFlags as I can't find a single code reference in neither the C code nor the Rust code and assume it has been removed again (rel: https://github.com/zyantific/zydis/pull/406)

Yes -- they were temporarily part of the ZydisDecoderDecodeFull interface but got removed before the v4.0 final because we found the interface to be too bloated.

The only thing I have to wonder about is why I can't find a single reference to MAX_OPERAND_COUNT_VISIBLE inside the C code anymore, yet the rust bindings are still using it for the formatter. Is this intended or is further work needed?

This is coincidental -- ZYDIS_MAX_OPERAND_COUNT_VISIBLE is a supported way to ask the decoder to only write visible operands -- the examples in the C code just don't use it right now.