我想用我的安装程序部署一个基于 .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.");
}
}
}