Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 + @"DriverXYZ.inf", 0);
            if (result != 0)
                MessageBox.Show("Driver installation failed.");
        }
    }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
417 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...