题
我想部署一个.inf根USB驱动程序与我的安装。
我猜的.inf需要被放置在 %SystemRoot%\inf
, 但也有一个。猫(芯片组我的猜测?), 和。sys文件。我该怎么做这些?
编辑: 解决,感谢所有用的答案。我能够P/援引的功能,所以我有一个安装后行动运行的下列代码:
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基于维克斯的图书馆。源于命令行 公司继续走在同行业最前沿 工具,这是基于SetupAPI,还包括在信息,请参见采样。
其他提示
您可以尝试要求外壳为您安装:
%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 YOUR_FILE.inf
但我100%肯定有一个更好的办法...
不隶属于 StackOverflow