Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wdi_sign_driver_inf() #234

Closed

Conversation

spiro-trikaliotis
Copy link

This PR add wdi_sign_driver_inf() to the libwdi API. It lets you supply an own INF file which is processed the same way like the built-in winusb.inf, libusb.inf and so on. It can also include "tokenization macros" like #CAT_FILENAME# or #WDF_VERSION#.

This allows to use a more customized INF than the automatically generated ones. For example, the INF can handle multiple devices, or the DFU mode of some devices.

@pbatard
Copy link
Owner

pbatard commented Oct 1, 2021

Thanks. I'm usually reluctant to add code that people submit to solve what is looks like a custom workflow issue they have, but this looks generic enough, so I don't really mind.

I would however like an example of a custom driver (with a .inf containing the relevant tokens) so that I can test this patch, noting that I don't really care about the driver binary files, so you can just reuse the libusb0.sys binary if you are using proprietary stuff.

@spiro-trikaliotis
Copy link
Author

I have an example in my branch:
https://github.com/OpenCBM/libwdi/blob/wdisimple-opencbm/examples/wdi-opencbm.c
The program defined in wdi-opencbm.c is a stripped-down wdi-simple.c with some small modifications.

I am using it to install my AVR devices, which also have some DFU mode. This way, one INF is enough for two devices and their respective DFU modes.

The INF used is at https://github.com/OpenCBM/OpenCBM/blob/master/windrv/opencbm.inf .

@pbatard
Copy link
Owner

pbatard commented Oct 28, 2021

Okay, I'm going to alter your patch so that we don't have to add a new wdi_sign_driver_inf() API, but instead, just add a new external_inf flag to the options of wdi_install_driver(). Then if you just want to sign a driver, just call wdi_install_driver() with the external_inf flag set and supply a path for the .inf parameter, and this is what'll be used instead of the embedded .inf (with the extracted signed driver also using that filename, without the directory part) as the name of the generated .inf).

I'm also going to modify wdi-simple so that it takes a new -e option to specify and external inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants