Skip to contentSkip to conversation

installer: do not enforce driver removal

PATCH Superseded Marc Becker 1 participant 3 messages Oct 16, 2020 – Oct 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 installer: do not enforce driver removal

Persistend network adapters hold locks on installed driver. Forced removal breaks service/PnP ownership references.

Do not enforce driver removal and make failure non-fatal.
This should have no effect on Uninstall, adapters are deleted in advance. Tested in OpenVPN TAP MSM (https://github.com/OpenVPN/tap-windows6/pull/135)

---
 installer/installation.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
installer/installation.c +3 -4
index cd93ffb..3c6628e 100644
@@ -345,9 +345,9 @@ static BOOL RemoveWintun(VOID)
         {
             PathStripPath(DriverDetail->InfFileName);
             Logger(LOG_INFO, TEXT("Removing existing driver"));
-            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, SUOI_FORCEDELETE, NULL))
+            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, 0, NULL))
             {
-                PrintError(LOG_ERR, TEXT("Unable to remove existing driver"));
+                PrintError(LOG_WARN, TEXT("Failed to uninstall old drivers, probably some are in use by adapters. Continuing."));
                 Ret = FALSE;
             }
         }
@@ -601,8 +601,7 @@ BOOL InstallOrUpdate(VOID)
     }
     if (!RemoveWintun())
     {
-        PrintError(LOG_ERR, TEXT("Failed to uninstall old drivers"));
-        goto cleanupAdapters;
+        PrintError(LOG_WARN, TEXT("Failed to uninstall old drivers, probably some are in use by adapters. Continuing."));
     }
     if (!InstallWintun(!!ExistingAdapters))
     {

--
2.11.0

#1 lore raw

PATCH v2 1/1 installer: do not enforce driver removal

Persistend network adapters hold locks on installed driver. Forced removal breaks service/PnP ownership references.

Do not enforce driver removal and make failure non-fatal. In-use driver will be kept until uninstall or next update.

---
 installer/installation.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
installer/installation.c +3 -4
index cd93ffb..9c7992c 100644
@@ -345,9 +345,9 @@ static BOOL RemoveWintun(VOID)
         {
             PathStripPath(DriverDetail->InfFileName);
             Logger(LOG_INFO, TEXT("Removing existing driver"));
-            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, SUOI_FORCEDELETE, NULL))
+            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, 0, NULL))
             {
-                PrintError(LOG_ERR, TEXT("Unable to remove existing driver"));
+                PrintError(LOG_WARN, TEXT("Unable to remove existing driver"));
                 Ret = FALSE;
             }
         }
@@ -601,8 +601,7 @@ BOOL InstallOrUpdate(VOID)
     }
     if (!RemoveWintun())
     {
-        PrintError(LOG_ERR, TEXT("Failed to uninstall old drivers"));
-        goto cleanupAdapters;
+        PrintError(LOG_WARN, TEXT("Failed to uninstall old drivers, probably some are in use by adapters. Continuing."));
     }
     if (!InstallWintun(!!ExistingAdapters))
     {

--
2.11.0

#2 lore raw

PATCH v2 1/1 installer: do not enforce driver removal

In reply to Marc Becker

Persistend network adapters hold locks on installed driver. Forced removal breaks service/PnP ownership references.

Do not enforce driver removal and make failure non-fatal. Old driver is removed by regular disk cleanup or next MSM operation.

---
Does not change UninstallOEM result error message.

Patch (now correctly) mirrors https://github.com/OpenVPN/tap-windows6/pull/135
Effects discussed in https://github.com/OpenVPN/tap-windows6/issues/129

 installer/installation.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
installer/installation.c +3 -4
index cd93ffb..9c7992c 100644
@@ -345,9 +345,9 @@ static BOOL RemoveWintun(VOID)
         {
             PathStripPath(DriverDetail->InfFileName);
             Logger(LOG_INFO, TEXT("Removing existing driver"));
-            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, SUOI_FORCEDELETE, NULL))
+            if (!SetupUninstallOEMInf(DriverDetail->InfFileName, 0, NULL))
             {
-                PrintError(LOG_ERR, TEXT("Unable to remove existing driver"));
+                PrintError(LOG_WARN, TEXT("Unable to remove existing driver"));
                 Ret = FALSE;
             }
         }
@@ -601,8 +601,7 @@ BOOL InstallOrUpdate(VOID)
     }
     if (!RemoveWintun())
     {
-        PrintError(LOG_ERR, TEXT("Failed to uninstall old drivers"));
-        goto cleanupAdapters;
+        PrintError(LOG_WARN, TEXT("Failed to uninstall old drivers, probably some are in use by adapters. Continuing."));
     }
     if (!InstallWintun(!!ExistingAdapters))
     {

--
2.11.0