如何部署基于.inf的驱动程序? [英] How do I deploy a .inf based driver?

查看:131
本文介绍了如何部署基于.inf的驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在安装程序中部署基于.inf的USB驱动程序。

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

我想将.inf放在% SystemRoot%\inf ,但也有一个.cat(我猜是WHQL认证?)和.sys文件。我该怎么办?

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?

编辑:已解决,感谢有用的答案。
我能够P /调用该函数,所以我有一个运行后代码的后安装操作:

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.");
        }
    }
}


推荐答案

我将从阅读有关 SetupAPI DIFx 。 Windows驱动程序工具包包括两者的示例,包括基于DIFx的合并模块和基于DIFx的WiX库。命令行 devcon 实用程序的源,该实用程序基于SetupAPI ,也包含在WDK示例中。

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.

这篇关于如何部署基于.inf的驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆