【问题标题】:How do I deploy a .inf based driver?如何部署基于 .inf 的驱动程序?
【发布时间】:2009-03-24 14:36:57
【问题描述】:

我想用我的安装程序部署一个基于 .inf 的 USB 驱动程序。

我猜.inf 需要放在%SystemRoot%\inf 中,但还有一个.cat(我猜是WHQL 认证?)和.sys 文件。我该怎么处理这些?

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

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

【问题讨论】:

    标签: windows-installer driver


    【解决方案1】:

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

    【讨论】:

    【解决方案2】:

    您可以尝试让 shell 为您安装它:

    %SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 YOUR_FILE.inf
    

    但我 100% 确定有更好的方法...

    【讨论】:

    • 嗯,当我尝试它时,它在我的电脑上工作......我猜你的电脑只是不同......
    猜你喜欢
    • 1970-01-01
    • 2013-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多