我想在安装程序中部署基于.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.");
}
}
}