windows-drivers-rs icon indicating copy to clipboard operation
windows-drivers-rs copied to clipboard

[cargo-wdk] Newly created project should build successfully

Open gurry opened this issue 6 months ago • 2 comments

When you create a new project with cargo wdk new command and then immediately run cargo wdk build the build fails with InfVerif errors. This makes for a bad user experience especially for first time users. We should ensure that this build completes successfully.

Here are the build errors you get:

Caused by:
    Command 'infverif' with args ["/v", "/w", "C:\\Users\\user1\\code\\my-driver\\target\\debug\\my_driver_package\\my_driver.inf"] failed
     STDOUT: Running in Verbose
    Running Windows Driver INF check
 
    Validating my_driver.inf
    WARNING my_driver.inf: Failed to determine supported architectures
    ERROR(1199) in C:\Users\user1\code\my-driver\target\debug\my_driver_package\my_driver.inf, line 0: The syntax 'DIRID 13 (CopyFiles)' was introduced in OS version 10.0.16299, but DDInstall sections utilizing the syntax will install on earlier OS versions. Those DDInstall sections should be restricted to only install on 10.0.16299 or higher using a TargetOSVersion decoration.
    ERROR(1234) in C:\Users\user1\code\my-driver\target\debug\my_driver_package\my_driver.inf, line 5: Required directive Provider missing, empty, or invalid in [Version] section.
    ERROR(1234) in C:\Users\user1\code\my-driver\target\debug\my_driver_package\my_driver.inf, line 5: Required directive Class missing, empty, or invalid in [Version] section.
    ERROR(1010) in C:\Users\user1\code\my-driver\target\debug\my_driver_package\my_driver.inf, line 8: Invalid ClassGuid "", expecting {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.
    INF is NOT VALID

I suppose the fix would be to take version, class GUID etc. as inputs to the new command and insert them into the INF file being created.

gurry avatar Jul 14 '25 11:07 gurry

Rather than force new mandatory args on new, consider using an interactive prompting experience. Something like https://github.com/mikaelmello/inquire or https://docs.rs/dialoguer/latest/dialoguer/

wmmc88 avatar Jul 14 '25 19:07 wmmc88

Yes, given the inputs to new are growing, we will have to lean on prompts. For everything we prompt for we should also have an arg to support unattended runs/scripting.

gurry avatar Jul 15 '25 03:07 gurry