microsoft / wdkmetadata

Tooling to generate metadata for Win32 APIs in the Windows Driver Kit (WDK).
Other
96 stars 10 forks source link

Rust support for ntstrsafe.h inline functions #11

Closed Xaeroxe closed 1 year ago

Xaeroxe commented 1 year ago

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntstrsafe/nf-ntstrsafe-rtlunicodestringinitex this API is missing. I think it's pretty easy to add but I'm not sure.

kennykerr commented 1 year ago

This is a WDK function - will transfer to the Win32 metadata repo as they're working on adding WDK support.

mikebattista commented 1 year ago

Everything in ntstrsafe.h appears to be inline functions, which aren't supported in the metadata.

Since Rust driver development is the target, should someone try to implement these natively in Rust?

kennykerr commented 1 year ago

We only support metadata-generated bindings. So, if there aren't any function exports then there's nothing here for windows-rs to consume. Developers are free to implement these in their own crates.

rbtcollins commented 1 year ago

Thats a fair decision to take, but I will note that it means folk have to dig up the function and reimplement, rather than the Rust crates Microsoft publish having a reference implementation - its a lost opportunity to reduce friction for building things in Rust.

And for the record, the target wasn't/isn't Rust driver development, it was necessary tooling to use NTCreateFile APIs, to implement a crate that works analogous to posix openat/rmdirat etc calls.

kennykerr commented 1 year ago

We can always reevaluate but at this point we have almost no WDK coverage to begin with. We need to get exports fleshed out and viable before considering additional hand-written APIs.

rbtcollins commented 4 months ago

The status on this could perhaps be changed to 'Fixed' as I now see this available at windows_sys::Wdk::Storage::FileSystem::RtlInitUnicodeStringEx with feature Wdk_Storage_FileSystem enabled. Though its weird about the feature enabling it :). Thank you!