microsoft / windows-drivers-rs

Platform that enables Windows driver development in Rust. Developed by Surface.
Apache License 2.0
1.49k stars 65 forks source link

`wdk-build` does not work with shared folders/virtual filesystems #191

Open kedom1337 opened 2 months ago

kedom1337 commented 2 months ago

I have a somewhat unique setup where I develop on my linux host machine and build the project in a Windows virtual machine. The project is shared through a shared folder (currently using virtiofs and WinFSP but I tried SAMBA aswell). The build script specifically the function load_wdk_build_makefile right here fails when trying to build the project within that shared folder. See my other issue here for more information. It seems the problem lies with std::os::windows::fs::symlink_file or rather CreateSymbolicLinkW which it seems to be using. As already say in the other issue everything works as espected as soon as I copy the project from the shared folder to the guest machines C: drive and run the script from there.

Here is a minimal rust application which I used for debugging. Z: is the virtual file system and myproject is a simple Windows rust driver according to the instructions of this repository

use std::env;
use std::path::Path;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let root = Path::new("Z:\\myproject");
    env::set_current_dir(&root).unwrap();
    env::set_var("CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY", "Z:\\myproject");
    wdk_build::cargo_make::load_rust_driver_makefile()?;

    Ok(())
}