Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2370?usp=email )

Change subject: tapctl: use delete_device() to remove a half-created adapter
......................................................................

tapctl: use delete_device() to remove a half-created adapter

tap_create_adapter() open-coded delete_device() on its cleanup path.

Change-Id: I7e85442c6d7309b90e18a0ced7ae709b26c6dfc7
Signed-off-by: Razvan Cojocaru <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2370
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg42291.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/tapctl/tap.c
1 file changed, 1 insertion(+), 30 deletions(-)




diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c
index 76ec569..672bd2d 100644
--- a/src/tapctl/tap.c
+++ b/src/tapctl/tap.c
@@ -755,36 +755,7 @@
     if (dwResult != ERROR_SUCCESS)
     {
         /* The adapter was installed. But, the adapter ID was unobtainable. 
Clean-up. */
-        SP_REMOVEDEVICE_PARAMS removedevice_params = {
-            .ClassInstallHeader = {
-                .cbSize = sizeof(SP_CLASSINSTALL_HEADER),
-                .InstallFunction = DIF_REMOVE,
-            },
-            .Scope = DI_REMOVEDEVICE_GLOBAL,
-            .HwProfile = 0,
-        };
-
-        /* Set class installer parameters for DIF_REMOVE. */
-        if (SetupDiSetClassInstallParams(hDevInfoList, &devinfo_data,
-                                         
&removedevice_params.ClassInstallHeader,
-                                         sizeof(SP_REMOVEDEVICE_PARAMS)))
-        {
-            /* Call appropriate class installer. */
-            if (SetupDiCallClassInstaller(DIF_REMOVE, hDevInfoList, 
&devinfo_data))
-            {
-                /* Check if a system reboot is required. */
-                check_reboot(hDevInfoList, &devinfo_data, pbRebootRequired);
-            }
-            else
-            {
-                msg(M_NONFATAL | M_ERRNO, "%s: 
SetupDiCallClassInstaller(DIF_REMOVE) failed",
-                    __FUNCTION__);
-            }
-        }
-        else
-        {
-            msg(M_NONFATAL | M_ERRNO, "%s: SetupDiSetClassInstallParams 
failed", __FUNCTION__);
-        }
+        delete_device(hDevInfoList, &devinfo_data, pbRebootRequired);
     }

 cleanup_hDevInfoList:

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2370?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I7e85442c6d7309b90e18a0ced7ae709b26c6dfc7
Gerrit-Change-Number: 2370
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to