You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since this is my first opened issue and I am not entirely sure if I am doing this right, feel free to moderate this as necessary and/or move it to the correct queue. Since this is a feature request, the guidelines told me to open the issue here, so this is what I am doing, alas not with great confidence (this is by no means an RFC).
It would be great to be able to build this with cargo and be it only because the rls only supports cargo projects at the moment. For this to happen, there'd need to be the possibility to write
#![windows_subsystem = "native"]
at the top of the crate which would prompt cargo to link it with the /subsystem:native switch and against the ntoskrnl.lib library instead of the standard userspace Windows libraries. A quick test showed that this will probably have to go in conjunction with somethingl ike #![no_std] or some additional work is required to define what happens should a panic! occur; this is actually not easy to do because a Windows Kernel Mode driver can only be successfully unloaded if it calls IoDeleteDevice on all its devices, which should be possible (all the devices are available as a linked list through the DRIVER_OBJECT variable passed to the unload function) but which itself can only be called once there are no pending interrupt/io requests on that device. For now I would be content with something as small as
Also, the aforementioned winapi-kmd-rs should probably be reviewed (some unions in MS-structs are implemented by picking a more or less random member — maybe these could be made into untagged unions once these land) and if deemed worthy, be elevated to something more „official“ like the winapi crate.
The text was updated successfully, but these errors were encountered:
I don't really see a connection here: the RFC is about compiling and subsequently linking resource files into the program while this issue is about linking the program in a special way to make it loadable as a kernel mode driver. Maybe I am missing something?
Ah, I see. I guess the connection is very loose then... I would also like to see special linking abilities in stable rust. Currently, I think we only have the nightly #[link_args(...)], and IIRC, it only supports passing -l and -L...
Windows kernel mode drivers should probably be a separate target rather than using #![windows_subsystem] given that libstd would either be entirely unavailable or use a different implementation based on the windows kernel driver api's.
Since this is my first opened issue and I am not entirely sure if I am doing this right, feel free to moderate this as necessary and/or move it to the correct queue. Since this is a feature request, the guidelines told me to open the issue here, so this is what I am doing, alas not with great confidence (this is by no means an RFC).
Right now, if I want
with the type bindings from eg. the winapi-kmd-rs crate to successfully run on my machine, I have to compile it with
and then link it manually
It would be great to be able to build this with cargo and be it only because the rls only supports cargo projects at the moment. For this to happen, there'd need to be the possibility to write
#![windows_subsystem = "native"]
at the top of the crate which would prompt cargo to link it with the
/subsystem:native
switch and against thentoskrnl.lib
library instead of the standard userspace Windows libraries. A quick test showed that this will probably have to go in conjunction with somethingl ike#![no_std]
or some additional work is required to define what happens should a panic! occur; this is actually not easy to do because a Windows Kernel Mode driver can only be successfully unloaded if it callsIoDeleteDevice
on all its devices, which should be possible (all the devices are available as a linked list through theDRIVER_OBJECT
variable passed to the unload function) but which itself can only be called once there are no pending interrupt/io requests on that device. For now I would be content with something as small asAlso, the aforementioned winapi-kmd-rs should probably be reviewed (some unions in MS-structs are implemented by picking a more or less random member — maybe these could be made into untagged unions once these land) and if deemed worthy, be elevated to something more „official“ like the winapi crate.
The text was updated successfully, but these errors were encountered: