我需要通过c#安装设备驱动程序(INF文件)。我使用了功能UpdateDriverForPlugAndPlayDevices。但是,它返回我FALSE,但GetLastError()返回一个值,它指示安装的成功消息。 不知道我是否以正确的方式继续进行。 任何人都可以帮忙吗? 由于提前, P以编程方式安装设备驱动程序
1
A
回答
1
你应该看看源devcon。它在WDK中可用,正是您所需要的。具体查找devcon will install an INF file的方式。我仍然使用Windows 7 WDK,它位于C:\WinDDK\7600.16385.1\src\setup\devcon
。
你可能会发现它是using the SetupCopyOEMInf()
function,你应该尝试从你的C#应用程序中使用它。
1
这个简单的代码为我工作
private void driverInstall()
{
var process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = "/c C:\\Windows\\System32\\InfDefaultInstall.exe " + driverPath; // where driverPath is path of .inf file
process.Start();
process.WaitForExit();
process.Dispose();
MessageBox.Show(@"ADB/Fastboot/Google Android Driver has been installed");
}
相关问题
- 1. 以编程方式为USB设备安装“不兼容”的驱动程序
- 2. 以编程方式安装筛选器驱动程序?
- 3. 以编程方式安装NDIS筛选器驱动程序
- 4. 以编程方式安装Windows NDIS中级(IM)驱动程序
- 5. 以编程方式为MySQL数据库安装驱动程序
- 6. 安装用于便携式设备的USB驱动程序
- 7. 平台设备/驱动程序vs i2c设备/驱动程序
- 8. 以编程方式模拟串行端口,无需安装驱动程序
- 9. 可以阻止设备驱动程序成为字符设备驱动程序
- 10. Android设备上如何以编程方式“安装”文件
- 11. 在iOS设备上安装以编程方式下载的ipa
- 12. 设备驱动程序代码编译?
- 13. 编写键盘设备驱动程序
- 14. 设备驱动程序编译
- 15. 嵌入式系统编程与设备驱动程序
- 16. 以编程方式安装应用程序快捷方式
- 17. 安装驱动程序(WinUSB)以及Clickonce?
- 18. 安装驱动程序Cuda
- 19. 安装Chrome驱动程序
- 20. Wince设备驱动程序
- 21. Linux设备驱动程序
- 22. Windows设备驱动程序
- 23. scull设备驱动程序
- 24. INNO安装驱动程序已安装
- 25. 使用InstallShield安装驱动程序(USB设备)
- 26. 在Windows XP上静默安装设备驱动程序
- 27. 如何为任何Android设备安装ADB驱动程序?
- 28. 确定是否Windows 8的可安装设备驱动程序
- 29. 在Linux上安装FTDI设备驱动程序
- 30. 将过滤器驱动程序安装到现有设备
它的工作。谢谢:) – Pranoy
代码示例更详细的答案可以在这里找到[如何在安装过程中使用SetupCopyOEMInf](http://stackoverflow.com/questions/18404660/how-to-use-setupcopyoeminf-during-installer) –