Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I deploy a .inf based driver?

I would like to deploy a .inf based USB driver with my installer.

I guess the .inf needs to be placed in %SystemRoot%\inf, but there is also a .cat (WHQL certification I guess?), and .sys files. What do I do with those?

EDIT: Resolved, thanks to the helpful answers. I was able to P/Invoke the function, so I have a post-install action which runs the following code:

namespace DriverPackageInstallAction
{
    static class Program
    {
        [DllImport("DIFXApi.dll", CharSet = CharSet.Unicode)]
        public static extern Int32 DriverPackagePreinstall(string DriverPackageInfPath, Int32 Flags);

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            DirectoryInfo assemblyDir = new DirectoryInfo(Application.ExecutablePath);
            DirectoryInfo installDir = assemblyDir.Parent;

            int result = DriverPackagePreinstall(installDir.FullName + @"\Driver\XYZ.inf", 0);
            if (result != 0)
                MessageBox.Show("Driver installation failed.");
        }
    }
}
like image 251
Nick Avatar asked Mar 24 '09 14:03

Nick


People also ask

Is an INF file a driver?

A setup information (INF) file is a text file in a driver package that contains all of the information that device installation components use to install a driver package on a device. Windows uses INF files to install the following components for a device: One or more drivers that support the device.

Where is the INF file for printer drivers?

Open the "Windows" folder, then open the "System32\DriverStore\FileRepository" folder. Alternatively, paste "C:\Windows\System32\DriverStore\FileRepository" into the address bar of Windows Explorer and press "Enter." 4. Open the folder that contains the driver files for your printer.


1 Answers

I would start by reading about SetupAPI and DIFx. The Windows Driver Kit includes samples of both, including a DIFx-based merge module and a DIFx-based WiX library. The source for the command-line devcon utility, which is based on SetupAPI, is also included in the WDK samples.

like image 82
bk1e Avatar answered Sep 30 '22 04:09

bk1e