Как программно обновить драйвер?
Пробовал этот код, но он только устанавливает драйвер как дополнительний, а не обновляет существующий.
private static void UpdateDriver(string directory, string driverInfName, bool reboot)
{
if (SetupCopyOEMInf(directory, null, 0, 0, null, 0, 0, null)) {
UpdateDriverForPlugAndPlayDevices(IntPtr.Zero, driverInfName, directory, 0, reboot);
}
}
[DllImport("setupapi.dll")]
public static extern bool SetupCopyOEMInf(
string sourceInfFileName,
string oemSourceMediaLocation,
int oemSourceMediaType,
int copyStyle,
string destinationInfFileName,
int destinationInfFileNameSize,
int requiredSize,
string destinationInfFileNameComponent
);
[DllImport("newdev.dll")]
public static extern bool UpdateDriverForPlugAndPlayDevices(
IntPtr hwndParent,
string hardwareId,
string fullInfPath,
uint installFlags,
bool bRebootRequired
);
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости