Skip to content Skip to footer
Writing a simple windows driver in Rust by ingve

Writing a simple windows driver in Rust by ingve

6 Comments

  • Post Author
    mastax
    Posted February 8, 2025 at 6:56 pm

    I had an idea to write a filesystem filter driver which would let you configure path remapping rules of sorts, depending on the application. Things like:

    – %userprofile%.vscode -> %appdata%vscode

    – %CSIDL_MYDOCUMENTS%Call of Duty -> %userprofile%Saved GamesCall of Duty

    Because my documents and home directories filling up with a bunch of garbage which has a designated place on the filesystem filled me with impotent rage. I scaffolded out a project to write a filter driver in rust, read through the minifilter documentation, realized how much work it was going to be, and gave up.

    I have made my peace with the fact that a windows system is just going to be filled with garbage.

  • Post Author
    the__alchemist
    Posted February 8, 2025 at 7:25 pm

    Interesting! This looks very different from embedded drivers, which I've done a lot of in rust. Those are mostly reg reads, writes, bit shifting, DMA, and data sheet references.

  • Post Author
    ilrwbwrkhv
    Posted February 8, 2025 at 8:14 pm

    Great article and even more impressive design of the blog. Just clean straight forward easy on the eyes and loads instantly.

  • Post Author
    gpm
    Posted February 8, 2025 at 9:18 pm

    Semi-related, anyone have any up to date information on rust usage in the windows kernel?

    Almost 2 years ago they said "36,000 lines of code including a systemcall" [1], I'm curious how that project has progressed.

    [1] https://www.thurrott.com/windows/282471/microsoft-is-rewriti…

  • Post Author
    justmarc
    Posted February 8, 2025 at 10:36 pm

    Some 25 years ago I was tasked with writing a certain driver for Windows.

    Being totally migrated to Linux by then I refused to use Windows for writing as well as building it, so I worked hard to build it with MSYS.

    Long story short, I made it, and the driver worked great.

    I think I had to write a patcher for the resulting PE (.sys) to get it to actually load.

    Fun times.

  • Post Author
    AndrewGaspar
    Posted February 8, 2025 at 10:43 pm

    The code here looks to be essentially C with different syntax – every function marked unsafe, all resources manually managed. Sorry to be blunt, but what's the point of this?

Leave a comment

In the Shadows of Innovation”

© 2025 HackTech.info. All Rights Reserved.

Sign Up to Our Newsletter

Be the first to know the latest updates

Whoops, you're not connected to Mailchimp. You need to enter a valid Mailchimp API key.