Open rbtcollins opened 4 months ago
While more descriptive naming on the metadata side would be nice, I think this can also be improved on the rust side.
On stable you can use std::mem::offset_of
to get the offset of the path buffer (then add the path length, etc):
let offset = offset_of!(REPARSE_DATA_BUFFER, Anonymous) + offset_of!(REPARSE_DATA_BUFFER_0_1, PathBuffer);
With the nightly feature offset_of_nested
this is simplified to:
let offset = offset_of!(REPARSE_DATA_BUFFER, Anonymous.MountPointReparseBuffer.PathBuffer);
Thanks @ChrisDenton ! I'll leave this open as you say, it would be nice to improve, but I'll use your tip myself :).
Right now, I have code like so:
sizeof in rust takes types, not paths-to-types. That is, (at least as far as I know), I can't say 'REBASE_DATA_BUFFER::Anonymous::SymbolicLinkReparseBuffer` which of course is what the code above is dealing with.
When I hand-rolled these types I gave them names like so: