microsoft / microsoft/wdkmetadata
feat: Useful names for reparse data buffers
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 110
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
Right now, I have code like so:
// Size of the union, -1 for the 1 byte in-struct array, + path lengths.
let reparse_data_length = mem::size_of::<REPARSE_DATA_BUFFER_0_2>() - 1 + path_length * 2;
// u32 + USHORT*2
let reparse_length = reparse_data_length + 8;
let mut reparse_data_vec: Vec<u8> = vec![0; reparse_length];
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:
#[repr(C)]
#[derive(Clone, Copy)]
pub struct REPARSE_DATA_BUFFER {
pub ReparseTag: u32,
pub ReparseDataLength: u16,
pub Reserved: u16,
pub u: REPARSE_DATA_BUFFER_u,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union REPARSE_DATA_BUFFER_u {
pub SymbolicLinkReparseBuffer: REPARSE_DATA_BUFFER_u_SymbolicLinkReparseBuffer,
pub MountPointReparseBuffer: REPARSE_DATA_BUFFER_u_MountPointReparseBuffer,
pub GenericReparseBuffer: REPARSE_DATA_BUFFER_u_GenericReparseBuffer,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct REPARSE_DATA_BUFFER_u_SymbolicLinkReparseBuffer {
pub SubstituteNameOffset: u16,
pub SubstituteNameLength: u16,
pub PrintNameOffset: u16,
pub PrintNameLength: u16,
pub Flags: u32,
pub PathBuffer: [u16; 1],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct REPARSE_DATA_BUFFER_u_MountPointReparseBuffer {
pub SubstituteNameOffset: u16,
pub SubstituteNameLength: u16,
pub PrintNameOffset: u16,
pub PrintNameLength: u16,
pub PathBuffer: [u16; 1],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct REPARSE_DATA_BUFFER_u_GenericReparseBuffer {
pub DataBuffer: [u16; 1],
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the generated REPARSE_DATA_BUFFER definitions and the metadata that produces their anonymous union members. Compare those definitions with the named Rust structs in the issue, and verify that callers can refer to the symbolic-link, mount-point, and generic buffers by name for size calculations; the issue names no tests to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100