From: Fredrik Johansson on
Hi, I would like to install a driver during the setup wizard (MSI) of my
application. The driver is usbser.sys (provided by MS) and I have my own
*.inf file.

I am using C#/.NET 2.0 and I have tried using the DriverPackagePreinstall
method in DIFxAPI.dll. During the installation I see a popup that tells me
that the driver is not signed etc, which is the expected behaviour since I
haven't signed my driver package.

However, after the installation, when I plug the USB device in I see the
dialog "Found new hardware wizard". If I choose the automatic installation
Windows will copy the driver and install the device successfully.

Why does this wizard show after I have pre-installed the driver? If i choose
not to complete the "new hardware"-wizard I see my device under "Ports" in
the device manager, but with an exclamation mark and it tells me I have to
reinstall the driver. Is it possible to make the driver auto-install without
user interaction? (Except for the unsigned driver warning)

Same result if I manually try installing with DPInst, see below what my log
file says:

INFO: Running on path 'C:\Drivers'
INFO: No valid 'dpinst.xml' file provided.
INFO: Install option set: Suppressing Wizard but no OS popups.
INFO: Install option set: legacy mode on.
INFO: Install option set: Suppress Add or Remove Programs entries.
INFO: Install option set: uninstall will be set to delete driver binaries.
INFO: Found driver package: 'C:\Drivers\myinf.inf'.
INFO: Preinstalling 'c:\drivers\myinf.inf' ...
INFO: ENTER: DriverPackagePreinstallW
SUCCESS:c:\drivers\myinf.inf is preinstalled.
INFO: RETURN: DriverPackagePreinstallW (0x0)
INFO: ENTER: DriverPackageGetPathW
INFO: RETURN: DriverPackageGetPathW (0x0)
INFO: ENTER: DriverPackageInstallW
INFO: Installing INF file 'c:\drivers\myinf.inf' (Plug and Play).
INFO: Looking for Model Section [DeviceList]...
INFO: Installing devices with Id "USB\VID_0xxx&PID_0xxx&REV_0001" using
INF
"C:\Windows\System32\DriverStore\FileRepository\myinf.inf_142a40d6\myinf.inf".
INFO: Installation did not occur because the hardware isn't currently
present.
INFO: No drivers installed. No devices found that match driver(s)
contained in
'C:\Windows\System32\DriverStore\FileRepository\myinf.inf_142a40d6\myinf.inf'.
INFO: RETURN: DriverPackageInstallW (0xE000020B)
INFO: No matching device was found for 'c:\drivers\myinf.inf'. Driver will
be installed when plugged in.
INFO: Returning with code 0x100
From: Chris on
On Sep 7, 8:26 am, Fredrik Johansson
<FredrikJohans...(a)discussions.microsoft.com> wrote:

> However, after the installation, when I plug the USB device in I see the
> dialog "Found new hardware wizard". If I choose the automatic installation
> Windows will copy the driver and install the device successfully.
>
> Why does this wizard show after I have pre-installed the driver?

Same reason as you noted above, because you haven't signed the driver.

> Is it possible to make the driver auto-install without user interaction?
> (Except for the unsigned driver warning)

You've got to get signed which will solve both problems.