Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
@woodgear
we currently use rust write windows driver and has deploy it to product env.
we add some km binding of winapi
is a brief example how we do.
cargo xbuild + custom target + km binding of winapi.
i afraid of request a PR cause we juse use it in our company. but of couse we want to make it merge into winapi.
@woodgear
we use rust-bindgen to transform ddk header file to rust and edit it manual to pick up function or struct what we used.
how you guys think?
@retep998
Peter Atashian
@retep998
@woodgear I do want to have bindings to kernel mode stuff, however actually linking to kernel mode specific stuff is a very hairy problem right now
types and constants can be provided just fine though
@woodgear
why? what the difference?
@woodgear
what the problem is? maybe be we could fix that
Peter Atashian
@retep998
@woodgear I'd need Rust to officially bless certain targets for windows kernel mode, so I can detect them and link to different things for them.
@woodgear
en,maybe a branch like feature/km? we could not do nothing but just wait for rust officially .
i will open a pr to push rust add windows kernel mode target (by the way where should i go? rust/rustup?)
@woodgear
for now, we could temporary assume that the target name is i686-kernel-windows-msvc for x86 and x86_64-kernel-windows-msvc for x64
there are some people who want to km binding of winapi like retep998/winapi-rs#605
Peter Atashian
@retep998
I'll try to work on some stuff in a branch
@woodgear
cool,please make that branch be public, we are gratefully to contribute our code.
hopefully be helpful
@woodgear
i will open a pr(could not be merge) to show what we have done.
Peter Atashian
@retep998
locating the km libraries should be the job of rust, not winapi
or rather, the cc crate
@woodgear
locating the km libraries? you mean find the path of those lib?
Peter Atashian
@retep998
most of the stuff in that build.rs you linked is supposed to be handled automatically by rust through the cc crate
Peter Atashian
@retep998
anyway, I kicked things off by filing an issue in Rust rust-lang/rust#59994
@woodgear
seems great
FXTi
@FXTi
Hey guys, I'm new to rust on Windows. I wonder how to use NtDeviceIoControlFile in nt.dll in rust way.
I see it in ntdll.def. But seems there's no rust source code about it in winapi-rs crate. And I think it may concerns bindgen.
anyway, is there a way to call that function? It's quite complicated for me...
Peter Atashian
@retep998
@FXTi that function is in the Windows SDK, so it's just a matter of someone submitting a pull request to winapi adding the bindings for it correctly.
FXTi
@FXTi
@retep998 Like this? retep998/winapi-rs#775
FXTi
@FXTi
Sorry to bother you, another solution found.
Ryan Levick
@rylev
Hello! I was wondering if anyone had a good idea of how complete the winapi crate is in terms of API coverage. Just having some conversations at work about the likelihood of running into unimplemented bindings
Peter Atashian
@retep998
rylev: yes
Ryan Levick
@rylev
@retep998 would you be able to give a rough estimate of API coverage (and I do realize how hard that might be...)
Peter Atashian
@retep998
@rylev maybe 20%?
plus or minus 20%
Ryan Levick
@rylev
Meaning 20% is covered right?
Peter Atashian
@retep998
roughly yeah
the windows sdk is huge
Peter Atashian
@retep998
and unfortunately tools like bindgen don't work very well
Brian Merchant
@bzm3r
what's the preferred way to pass a path to a winapi wrapper?
i'm finding that there's no easy way to go from OsStr to a const * _?
Peter Atashian
@retep998
@bzm3r OsStrExt::encode_wide().chain(once(0)).collect() to get you a Vec<u16>. You can then call .as_ptr() on it to get a pointer to pass to winapi.
@bzm3r As for your ID3D10Blob question, you would call the GetBufferPointer and GetBufferSize methods to get the pointer and size, and pass them to std::slice::from_raw_parts to get a &[T].